2025-01-31 11:11 PM
Greetings
I am using STM32F030C8T6TR for ADC on two channels IN1 & IN3. It works. However I wanted to add DMA.
When trying to add DMA , It shows on two channels channel 1 and channel 2 , Though the datasheet mentions DMA is available for 5 channels. I can add DMA for channel 1 - Peripheral to memory. However when I try to add a DMA for another channel It shows error "No DMA available for this peripheral".
I could add DMA for the above channels in Memory to memory mode.for the ADC though. Is this OK can It my understanding that when using ADC, peripheral to memory should be used. In which case I can add only one of the two channels - channel 1 or channel 2.
How does this work ? will memory to memory on both channels work as expected ?
or is this some kind of version related error ? I use STM32CubeIDE1.15.0 on windows 7.
Thank you.
2025-01-31 11:24 PM
Please read the ADC description in Reference Manual. You only need one DMA channel for ADC, in peripheral to memory mode, programmed to transfer the number of item equal to the number of ADC channels being converter.For simple cases, it's convenient to setup ADC in continuous conversion mode and DMA in circular mode.
2025-02-01 05:08 AM
Thank you for responding.
//Please read the ADC description in Reference Manual.// Read several times
//You only need one DMA channel for ADC, in peripheral to memory mode, programmed to transfer the number of item equal to the number of ADC channels being converter. // The datasheet doesn't specifically that only one channel needs to be added to DMA so that we can use it for other channels. What was more confusing is the way STMCube IDE behaves / displays. If only one channel needs to be added why it is displaying channel nos at all against ADC-> DMA ? Channel selector could be left un-enabled. Pls read page 17 , section 3.8 of the datasheet. It starts with // 5-channel... // plus the thrid para starting with // Each channel is ...... //
I wouldn't have posted here at all if the IDE do not show either of channel.
2025-02-01 05:38 AM - edited 2025-02-01 05:41 AM
And how many channels may service the ADC simultaneously according to RefMan? Hint: there is only one ADC conversion result register, also see Fig. 19 and Table 26. ;)
2025-02-01 05:47 AM
There are two different things: ADC channels (inputs) and DMA channels. The DMA controller has 2 DMA channels with can be triggered by the ADC. The number of ADC channels is totally independent of that. All selected ADC channels will be typically sampled in one circular sequence. Think of 2 audio channels L and R that will be sampled in order L R L R .... and streamed to a common memory buffer by one DMA channel.
hth
KnarfB