cancel
Showing results for 
Search instead for 
Did you mean: 

Sequence of ADC data reading with DMA in STM32F0

Jack Juni
Associate II
Posted on October 19, 2017 at 23:09

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 #adc
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on October 26, 2017 at 12:17

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\

View solution in original post

5 REPLIES 5
Posted on October 19, 2017 at 23:34

Believe it can be backward or forward indexing based on settings.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Jack Juni
Associate II
Posted on October 20, 2017 at 16:25

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.

Posted on October 20, 2017 at 17:27

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on October 26, 2017 at 12:17

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\

Jack Juni
Associate II
Posted on November 07, 2017 at 15:55

Thank you all very much for the terrific help, especially Philippe Cherbonnel!  The examples are just what I needed.