2012-11-19 04:29 AM
Hello, everyone!
I have a question about ADC's EOC event, when is this bit been set?For example,there are 6 ADC channels in my program.Is it right as bellow:A channel converted--EOC--B channel converted--EOC...F channel converted--EOCorA channel converted--B channel converted--...F channel converted--EOCThanks! #adc-eoc #adc-eoc #adc-eoc #read-the-correct-f***-manual2012-11-19 07:25 AM
For multiple channels I think you're expected to use DMA, and the TC/HT interrupts to get your latter scenario.
2012-11-19 10:18 AM
I have a question about ADC's EOC event, when is this bit been set?
On End-Of-Conversion for every single channel. That means, 6 times in your example. As clive suggested, it is advised to use DMA if you convert more channels, or often, or both.
2012-11-19 05:16 PM
11.3.10 Discontinuous mode
Regular groupThis mode is enabled by setting the DISCEN bit in the ADC_CR1 register. It can be used toconvert a short sequence of n conversions (n <=8) which is a part of the sequence ofconversions selected in the ADC_SQRx registers. The value of n is specified by writing tothe DISCNUM[2:0] bits in the ADC_CR1 register.When an external trigger occurs, it starts the next n conversions selected in the ADC_SQRxregisters until all the conversions in the sequence are done. The total sequence length isdefined by the L[3:0] bits in the ADC_SQR1 register.Example:n = 3, channels to be converted = 0, 1, 2, 3, 6, 7, 9, 101st trigger: sequence converted 0, 1, 22nd trigger: sequence converted 3, 6, 73rd trigger: sequence converted 9, 10 and an EOC event generated4th trigger: sequence converted 0, 1, 2The paragraph above is quoted from Reference Manual(RM0008).Please take a attention about that bold sentence, How can i understand that sentence?In this sequence,there is only one EOC event generated.2012-11-19 11:05 PM
I referred to:
11.3.4 Single conversion mode...
Once the conversion of the selected channel is complete:
If a regular channel was converted:
– The converted data is stored in the 16-bit ADC_DR register
– The EOC (End Of Conversion) flag is set
11.3.5 Continuous conversion mode
...
After each conversion:
If a regular channel was converted:
– The converted data is stored in the 16-bit ADC_DR register
– The EOC (End Of Conversion) flag is set
Cited from the same document. Not sure how to comprehend this Discontinuous Mode, since the ADC has just one result register. Maybe the DMA relies on something else than EOC.
2015-09-13 07:49 AM
As we might logically think the EOC interrupt should occur after each channel succesfull conversion. Unfortunetlly it doesn't work it such a way. It took me a while to discover, it's acctually a crap. The interrrupt is generated ''only'' and''only'' when it finished to convert all of the channels. Natural consequences is that all of the data in DR register are overwritten, so what you going to get in EOC interrupt handler task is the result of last conversation. For me it's a terrible bug!!! It should work the following way:
1. Fire up the ADC conversation2. It creates EOC interrupt after each channel succefull3. Because it's discontinues mode it should stop itself when all of the channels are scaned.Like I said, crap.2015-09-13 02:54 PM
lee.stanley's quote is probably from RM0041 Rev 4 for the F100 series. For F101's and up, RM0008 Rev 15 currently applies, and states an EOC for each channel conversion.
So which chip do you have ? Cheers, Hal