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.

MSP430F2274-EP: Safe way to interrupt ADC10 measurement?

Part Number: MSP430F2274-EP
Other Parts Discussed in Thread: MSP430F2274

Hello,

I am looking for a safe way to stop an ADC measurement before it has completed on the MSP430F2274. Reading the user guide, I came across this information in the ADC section:

22.2.6.6 Stopping Conversions
Stopping ADC10 activity depends on the mode of operation. The recommended ways to stop an active conversion or conversion sequence are:

  • Resetting ENC in single-channel single-conversion mode stops a conversion immediately and the results are unpredictable. For correct results, poll the ADC10BUSY bit until reset before clearing ENC.
  • Resetting ENC during repeat-single-channel operation stops the converter at the end of the current conversion.
  • Resetting ENC during a sequence or repeat sequence mode stops the converter at the end of the sequence.
  • Any conversion mode may be stopped immediately by setting the CONSEQx = 0 and resetting the ENC bit. Conversion data is unreliable.

In the paragraph above, is there a meaningful difference between the phrase "results are unpredictable" and "Conversion data is unreliable"? When I read "Conversion data is unreliable", I know that means not to trust the result in ADC10MEM, which I'm fine with. But the phrase "results are unpredictable" is a bit more vague...is that suggesting the program counter could be corrupted? or some other undesirable issue could occur? Or does it mean the same thing as "Conversion data is unreliable"?

Also, if I interrupt the ADC by resetting ENC in the middle of a measurement, do I need to do anything special to any ADC registers before I start my next ADC measurement? For example, a dummy read to the ADC10MEM register to clear it of possibly corrupted data?

Thanks

  • Hi, Thanks for your post and the detailed question!

    "results are unpredictable" means the same thing as "Conversion data is unreliable" and poll the ADC10BUSY bit until reset before clearing ENC is needed.

     

  • Hi Xiaodong Li,

    Thank you for the quick reply. I had one follow-up question: When operating in "Single Channel Single Conversion Mode", is polling the ADC10BUSY until reset before clearing ENC required if I do not care what the results are for that conversion? In other words, if I don't check ADC10BUSY and immediately clear ENC, can anything bad happen (like PC gets corrupted, interrupt registers get disabled, some other undesirable behavior) besides losing the current conversion? Or do I need to poll ADC10BUSY before clearing ENC for another reason?

    Thanks

  • Hi adevries


    I'm not sure what bad things will happen if don't check ADC10BUSY and immediately clear ENC.
    I think it should be better to follow the spec which is poll the ADC10BUSY bit until reset before clearing ENC if your system timing is allowed.

    Thanks!

  • Hi Xiaodong Li,

    Understood. I definitely want to follow the specification, but my system timing doesn't always allow me to poll ADC10BUSY. When I asked a similar question on another thread, the TI employee there seemed to think that I could immediately disable ENC as long as I didn't care about the conversion results. (This thread: https://e2e.ti.com/support/microcontrollers/msp430/f/166/p/933919/3450167#3450167). Unfortunately, the wording in the user guide is kind of ambiguous for this use case. My priority is to stop the conversions as quickly as possible, as long as it doesn't corrupt the code or cause errors. In  this case, my gut is telling me to trust the wording of the last bullet point, "Any conversion mode may be stopped immediately by setting the CONSEQx = 0 and resetting the ENC bit. Conversion data is unreliable." That sounds to me like the designers intention was to allow a conversion to be interrupted and stopped immediately and safely by resetting the ENC bit. The conversion results can't be trusted, but nothing else bad should happen.

    Thank you for your help, I appreciate it!

    Okay. In the tests I did before sending them out, I used the same flex board and power board with each stack. Should I do the same thing again? Or do we want to start assigning individual power and flex boards with the SOM/COM board stack?
     
    -Alex

  • Hi adevries. I checked the previous thread discussed with Eddie.

    I agree with your understanding: the designers intention was to allow a conversion to be interrupted and stopped immediately and safely by resetting the ENC bit. The conversion results can't be trusted, but nothing else bad should happen.

    If your system timing is not allowed, please reset the ENC bit to stop conversion w/o busy polling.

    Thanks!

  • Hi Xiaodong Li,

    Thanks, that makes me more confident in that conclusion. Thank you for all the help!

**Attention** This is a public forum