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
2025-02-01 09:16 AM
Which refMan are you mentioning ?
Table 26 on the datasheet is for "Typical and maximum current consumption from the Vdda supply" Figure 19 on page 63 shows "TC and TTa I/O input characteristics"
It seems datasheet I am referring and the RefMan you are mentioning are different.
2025-02-01 09:38 AM
//There are two different things: ADC channels (inputs) and DMA channels// Naturally - Understood.
So how do one set DMA for ADC channel 1 and Channel 3 on this microcontroller ?
from the Analog -> ADC -> DMA Settings I get
DMA request - Channel - Direction - Priority
I can select ADC for DMA request
I get option to select Channel 1 or Channel 2 Under Channel
I can select Peripheral to memory under direction
I can select Low to Very High , any of the 4 options under priority
Under DMA settings
I can select Normal or Circular for Mode
Check box for Incremental Address is locked
Check box Memory is checked
Data width under Peripheral is Half word
Under memory is half width
should I configure DMA under System Core ?
Inside DMA under System Core
I get only Memory to memory for DMA request
Under Channel , I can select any of the 5 channels
Under direction only memory to memory could be selected
I can select any of the 4 options under priority
DMA added under ADC is displayed automatically on this screen too. as Peripheral to memory and channel as DMA1 channel 1. wich i can change to DMA 1 channel 2
Do I need the to entries DMA setting under system core memory to memory - DMA 1 channel 1 & DMA 1 channel 3