Sequence of ADC data reading with DMA in STM32F0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-10-19 2:09 PM
I am reading multiple ADC channels on an STM32F0 using DMA. I am reading the data into an array. The data does not appear in the array in the order of ADC channel number. It is my understanding that the F0 does not permit reordering the sequence of ADC channels. What sequence do the 16 channels follow?
#adc-poll #adc-reads #dma-adc #multichannel-adc #adcSolved! Go to Solution.
- Labels:
-
ADC
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-10-26 5:17 AM
Hi Jack,
Turvey.Clive
‌has said it all.STM32F0 and STM32L0 series have the specificity of ADC sequencer order fixed: order of sequencer ranksis defined by channels number.
On other STM32 series, ADC sequencer is flexible: you can specify what channel mapped into sequencer rank1, rank2, ...
You have to pick the each channel ADC conversion data to the corresponding DMA destination buffer index.
In the case of STM32F0, you can find some examples in STM32F0 FW package (can be downloaded here:
http://www.st.com/en/embedded-software/stm32cubef0.html
)You can find an example here:
Using driver HAL: ...\Projects\STM32F072RB-Nucleo\Examples\ADC\ADC_Sequencer\ Using driver LL: ...\Projects\STM32F072RB-Nucleo\Examples_LL\ADC\ADC_MultiChannelSingleConversion\- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-10-19 2:34 PM
Believe it can be backward or forward indexing based on settings.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-10-20 7:25 AM
I know there are settings for the more advanced members of the STM32 family, but can't find any for the F0.
Further info on what I'm seeing: I'm using ADC channels 1, 4, 8 and 10. The readouts are going by DMA into an array. The elements in the array are getting filled in this order (starting with element 0): Ch1, Ch10, Ch8, Ch4.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-10-20 10:27 AM
Have to take you at your word about the order, as I have nothing to look at here.
You should be able to scan forward or backward, and you shouldn't enable DMA before calibrating, and you should only use circular mode, initialized once.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-10-26 5:17 AM
Hi Jack,
Turvey.Clive
‌has said it all.STM32F0 and STM32L0 series have the specificity of ADC sequencer order fixed: order of sequencer ranksis defined by channels number.
On other STM32 series, ADC sequencer is flexible: you can specify what channel mapped into sequencer rank1, rank2, ...
You have to pick the each channel ADC conversion data to the corresponding DMA destination buffer index.
In the case of STM32F0, you can find some examples in STM32F0 FW package (can be downloaded here:
http://www.st.com/en/embedded-software/stm32cubef0.html
)You can find an example here:
Using driver HAL: ...\Projects\STM32F072RB-Nucleo\Examples\ADC\ADC_Sequencer\ Using driver LL: ...\Projects\STM32F072RB-Nucleo\Examples_LL\ADC\ADC_MultiChannelSingleConversion\- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-11-07 6:55 AM
Thank you all very much for the terrific help, especially Philippe Cherbonnel! The examples are just what I needed.
