cancel
Showing results for 
Search instead for 
Did you mean: 

Simultaneous/synchronized start of ADC conversions without DMA

Tob G
Associate II
Posted on February 20, 2017 at 18:23

The microcontroller i am using is a STM32F446.

The STM32F446 is equipped with 3 ADCs.

I would like to start one conversion of all 3 ADCs at the same time (simultaneous/synchronized start).

I do not want to use DMA.

I would like to start the conversions by software (no external trigger) and to poll if the conversions of all 3 ADCs have finished.

Is this possible and how do i have to configure the ADCs for doing this?

I searched all given examples by CubeHAL and StdPeriph_Lib but didn't find anything that fits.

Searching the internet for 'Triple regular simultaneous mode, -DMA' and things like that was also quite disappointing.

Any help is greatly appreciated
4 REPLIES 4
Posted on February 20, 2017 at 18:44

So Triple mode, non-continuous, non-triggered, non-scanned, all ADC configure with same/equivalent settings. Then start the conversion at each instant you want an answer.

Should be able to read ADCx->CDR, just like it would if you'd used DMA, waiting for EOC on one of the ADC

Assume the 'internet' isn't going to have code for everyone's unique situation/use case. Should be able to use a 3-UP example with minimal modification to do the manual trigger/start.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
S.Ma
Principal
Posted on February 20, 2017 at 19:52

Asking for perfect synchronisation, in a first step for debug purpose, would use the IO pin ADC trigger (I guess using it as GPIO output and toggling it by SW would kick-in the 3 adc at once. Then use a timer channel to do the job internally.

With or without DMA, have a look at this thread:

https://community.st.com/0D50X00009XkYIoSAN

Tob G
Associate II
Posted on February 24, 2017 at 15:24

Hey guys!

Thanks for your replies.

I am still starting all 3 ADCs in a sequential way like this (because this is the easiest way for me :(

...

SET_BIT(ADC1->CR2,(uint32_t)ADC_CR2_SWSTART);

SET_BIT(ADC2->CR2,(uint32_t)ADC_CR2_SWSTART);

SET_BIT(ADC3->CR2,(uint32_t)ADC_CR2_SWSTART);

...

I will build up a small test circuit where each ADC will convert the same analog signal.

With this test i will figure out if the small time delay between each ADC start will effect my measurement or if it is neglectable.

If it is not neglectable i will try to start the ADC conversions synchronized by using a timer as suggested by KIC8462852 EPIC204278916.

Posted on February 24, 2017 at 20:09

If you disable/enable interrupts during the kick off sequence it will probably meet your needs without unforeseen side effects.