cancel
Showing results for 
Search instead for 
Did you mean: 

[F030] Using ADC with DMA and multiple channels

stanzanim
Associate III
Posted on January 30, 2016 at 13:38

hello all

I need advice about using the ADC embedded in the STM32F03. I am connecting 5 analogue sources which I want to acquire with different rate

S0 every 2nd sample

S1 every 3rd sample

S2 every 6th sample

The idea is to connect teh highest sampled souce S0 to 3 channel at the same time, S1 at 2 channels and S1 just one channel. S0 data are stor into 3 variables, S1 into 2 variables, S2 just one variable (transfer is of course via DMA and ADC is working in continuous mode with a sequence alength accordingly)

Is this approach correct? This prevent me from changing the sample rate whenever I acquire a channel

I am also looking for some examples showing ADC in contionuous multichall mode and DMA (using HAL is better): I attended a training in Milan a few weeks ago but I lost the ecercise example. thanks much
2 REPLIES 2
re.wolff9
Senior
Posted on January 31, 2016 at 14:13

Ah, yes, that would be nice. You configure the ADC sequence to: S0, S1, S0, S2, S0, S1 set it going and use the results anyway you like. 

From memory however this is not possible. F4 devices have a ''what channel should I sample at position X in the conversion sequence?'' where you would be able to configure multiple instances of a single source. 

But F0 devices have a ''should input X be sampled?'' register. So the order in which they are sampled is always the same and you cannot specify one to be sampled twice as there is just a yes/no bit. 

Posted on January 31, 2016 at 15:39

Yes, I think you're going to have to create a much larger buffer to fit the pattern (basically the minimum repeat length), double that so you can use DMA HT/TC and then extract the elements you want from the time line of data, discarding/ignoring the over sampling

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..