cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 ADC DMA (External Trigger conversion source and Continuous Conversion mode)

LPetr.1
Senior

I am reading multiple ADC channels using Circular DMA and I have got a question that I want to clarify

 

On the STM32CubeMX, I have configured my ADC as following:

LPetr1_0-1715060693983.png

As you can see from above, I have Scan Conversion Mode and DMA Continuous Requests enabled. I have setup DMA in circular mode. I also use External Trigger Conversion Source as Timer 8 Trigger Out event and I have the Timer 8 running at 1Hz for testing purposes. I would like to clarify a few things.

 

I want to understand the relationship between Continuous Conversion Mode and External Trigger Conversion Source. 

 

What is the point of having External Trigger Conversion Source (in my case TIM8) if the Continuous conversion Mode is enabled? Since the Continuous conversion ensures that another conversion is started immediately after the previous is finished, why would you ever need External Trigger Conversion Source.

 

 

 

 

 

 

 

3 REPLIES 3
Sarra.S
ST Employee

Hello @LPetr.1

The point is to combine the benefits of both (continuous sampling with the precision of external triggering).

In some scenarios, you might want to start the continuous conversion at a specific moment (determined by the TIM as external trig). Once the external trigger from TIM 8 starts the ADC conversion sequence, the ADC will continuously convert the input signals of all enabled channels in a loop, without waiting for another trigger event.

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Michael E
ST Employee

Hello @LPetr.1 ,

To complete Sarra's answer, I suggest you take a look at basic examples like DMA, ADC/DAC or HRTIM on the STM32MCU wiki.
They can be very useful.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Which STM32? The ADC modules in different families differ significantly.

> What is the point of having External Trigger Conversion Source (in my case TIM8) if the Continuous conversion Mode is enabled? Since the Continuous conversion ensures that another conversion is started immediately after the previous is finished, why would you ever need External Trigger Conversion Source.

The answer, as always, lies in the Reference Manual, which you should have read first.

waclawekjan_0-1718306107392.png

It means, that:

- setting ADC_CR2.CONT "tells" the ADC, that after one conversion finishes, automatically start a next one

- but it does not "tell" that "start a conversion now", so you need to start the first conversion somehow

- you've selected "external trigger", so the first conversion starts when the selected trigger arrives; subsequent conversions are started automatically, ignoring the trigger.

JW