This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR2311: General Questions

Part Number: MSP430FR2311
Other Parts Discussed in Thread: L293D,

Hello I am going to say that I am very new to Embedded systems. I could have started with the arduino as everyone else seems to do but I wanted to really understand how MCUs work so I opted for TIs MSP430 Line. I have read a lot of the documentation for the FR2311 and just have some general questions about how to go about using it most efficiently. 

First what my end goals are, 

I want to be able to control two DC motors that are bidirectional with speed control through a pot for each motor. They will be controlled via a L293D IC. 

I also want two push buttons that turn on or off relays that controls some LEDs. I want this to be done via interrupts and when not in use have the MCU in low power mode.

I have looked through some of the examples that are provided and noticed that the "Analog Input to PWM Output" example they have uses the eCOMP module instead of the ADC. Is this the best/most efficient way to acheive this? Or would the only reason to do that would be A. the MCU doesn't include an ADC (like the FR2000) or B. Code size restrictions. 

My first goal is to get the ADC or eCOMP module set up with the pots. As I said before I want to be able to go both directions with one pot so I would need to have the value signed (right?) 

Also when reading through the user guide there are many different sampling modes. Which one would be best for sampling a pot? 

I am sure I will have more questions as I go along but I really want to get this done right and the reason I chose TI's products was because of the support behind them. 

Thanks in advance 

  • Hey Jacamo,

    Welcome to the MSP ecosystem, glad to see you diving in! :)

    If I understand, you want to use a pot as in input to control a motor speed and direction. This can be done and I would recommend using the ADC for the input. The comparator is good at telling if your voltage is above or below a threshold, but not much more. In this case, you would need to know how much more, so ADC measurements make the most sense.

    The ecomp to PWM demo is not a motor control demo, it's mainly just an example showing off some of the modules.

    As for the setup, I don't think you really need a signed value. You have a 10 bit ADC in the MSP430FR2311 with a range of 0 - DVcc, which is 0x00 to 0x3FF. Depending on your circuit, and the voltage coming off the pot, just find the middle point and use this as nuetral. Anything above this could spin the motor one way and below could spin the other.

    Hope this is helpful! Let the comunity know if you have any specific questions along the way.

    Thanks,
    JD
  • Ah ok that makes sense. Thank you for the info. A follow up question to that would be whats the best way to find find the neutral point on my pot? Do I write a program to print the value to the serial monitor? or can I calculate it some how?
    Also I want to set a "dead zone" so when it gets to a certain threshold it turns off. How do I set those limits?
    I just want to reiterate I have taken a few courses on the basics of programming the MSP430 line but this is my first attempt at actually doing a project on my own with no instructions. I really want to learn how to do this and I have already spent countless hours reading and taking classes and now my next step is to learn by doing. I just don't have anyone I can learn from except the internet so any help you guys/girls can give me will be much appreciated.
    Lastly the different sampling methods:

    ADC SINGLECHANNEL [Default] - one-time
    conversion of a single channel into a single memory
    buffer
    ADC SEQOFCHANNELS - one time conversion of
    multiple channels into the specified starting memory
    buffer and each subsequent memory buffer up until the
    conversion is stored in a memory buffer dedicated as
    the end-of-sequence by the memory's control register
    ADC REPEATED SINGLECHANNEL - repeated
    conversions of one channel into a single memory
    buffer
    ADC REPEATED SEQOFCHANNELS - repeated
    conversions of multiple channels into the specified
    starting memory buffer and each subsequent memory
    buffer up until the conversion is stored in a memory
    buffer dedicated as the end-of-sequence by the
    memory's control register
    Modified bits are ADCCONSEQx of ADCCTL1
    register.

    Should I used the Singlechannel or the Repeated Singlechannel to measure the pot?

    Thanks again for the reply! Look forward to learning more about the MSP430.
  • One other question I have run in to is what exactly does this mean?

    interruptMask is the bit mask of the memory buffer interrupt sources to be enabled.

    Mask value is the logical OR of any of the following:

    ADC OVERFLOW INTERRUPT - Interrupts when a new conversion

    is about to overwrite the previous one

    ADC TIMEOVERFLOW INTERRUPT - Interrupts when a new

    conversion is starting before the previous one has finished

    ADC ABOVETHRESHOLD INTERRUPT - Interrups when the input

    signal has gone above the high threshold of the window

    comparator

    ADC BELOWTHRESHOLD INTERRUPT - Interrupts when the input

    signal has gone below the low threshold of the low window

    comparator

    ADC INSIDEWINDOW INTERRUPT - Interrupts when the input

    signal is in between the high and low thresholds of the window

    comparator

    ADC COMPLETED INTERRUPT - Interrupt for new conversion data

    in the memory buffer

    Like what is an example of how to write that? In the provided ADC example they have has the following for setting up the memory buffer

    //Enable Memory Buffer interrupt
    ADC10_A_clearInterrupt(ADC10_A_BASE,
    ADC10IFG0);
    ADC10_A_enableInterrupt(ADC10_A_BASE,
    ADC10IE0);

    The highlighted parts are what I have a question about. If someone can explain to me how they get the highlighted values from the information provided in the driverlib users guide (the info in bold). 


    Thanks you

  • Hey Jacamo,

    I think you should first start with single channel conversions. Eventually, you would do 2 single channel conversions, one with each pot. Every time you want to measure it in your software loop, you would just trigger a new conversion.

    As for finding the middle point, that's going to depend on your circut and yout pot. You'll need to creat a resistor devider with the pot, then measure the voltage output range coming from the pot, etc. That voltage range will corispond with ADC readings, so those you probably want to check either in the debugger or via the terminal as you suggested.

    Let's say your reads were 0x00 to 0xFF, Then 0x7F would be your mid point. You can add a dead zone in software.

    I'm sure there are some pot controlled demos somewhere online that could give you a baseline.

    Thanks,
    JD
  • Hey Jacamo,

    The highlight bits in some of the ADC registers. Typically the bits can be found in the datasheet or in the driverlib header files.

    Was this from an example for the MSP430F2311 or a different MSP?

    Thanks,
    JD
  • I understand the basic concept behind it I just don't know how to implement it in software. I guess I just don't have enough experience to know how to write code from scratch. Any suggestions on a good resource for someone to learn how to use the C language for the MSP430?
    All of the classes I have taken are mostly Copy and Paste code from the instructions with little modification. This helped me understand how the MCU works but as far as the code goes I am still trying to figure all of that out.
    I have so far set up the ADC but have to still figure out how to actually use it. I will go with your suggestion on trying to get one working first and then move to two.
    I will also look around online to see if I can find any examples.
    Thanks for you help I really appreciate it!
  • This was from the example from the DriverLib for the MSP430fr2xx4xx family. Specifically the ADC peripheral examples, both of them use the same thing. I understand what it was doing It was just confusing that they did it that way and also didn't understand why you would want to choose more than one of those settings.
    I discovered the API Programmers Guide for the driverlib and that has helped out a ton.
    Again Thanks for the response

**Attention** This is a public forum