Skip to main content
Jakub Konieczny
Associate
May 9, 2018
Question

STM32F3 simultaneous ADC conversions

  • May 9, 2018
  • 8 replies
  • 2639 views
Posted on May 09, 2018 at 12:54

Hi.

I want to do do ADC conversions on all 3 ADCs simultaneous: they should be done in the same time. How should I achieve that?

1. With DMA? I can do multichannel conversions, but they are not simultaneous. When I start `HAL_ADC_Start_DMA(&hadc1, adcData[0], 5);` 3 times, it looks like it does conversions for each ADC synchronous. MultiMode is only for 2 DMA channels and I need to do 3 measurements simultaneous.

2. With IRQ: start conversions with interrupts and catch them all, and then when I get all 3 start them again?

3. Mix them?

#stm32f3 #dma #adc
This topic has been closed for replies.

8 replies

S.Ma
Principal
May 9, 2018
Posted on May 09, 2018 at 14:14

Normally the result of an ADC conversion is pushed onto a register. This value is available until the ADC took the time to finish converting the next conversion and overwrite the register.

To synchronize all 3 ADC only require to share the same start of conversion. Reading the 3 registers don't have to be done at the same CPU cycle speed. Thoughts?

Tesla DeLorean
Guru
May 9, 2018
Posted on May 09, 2018 at 14:16

Seem to think you can have ADC1&2 and ADC3&4 share a common TIM trigger, thus effecting paced and simultaneous acquisitions.

Likely will need to use two DMA, so two separate arrays. I know I built a 4-UP ADC with the F3+SPL

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Jakub Konieczny
Associate
May 9, 2018
Posted on May 09, 2018 at 14:57

I have only one free DMA for this.

This CPU has 3 SDADC (forgot to mention it's Sigma Delta, if that matters). So just start all 3 with interrupts in continous mode and read results in interrupt handler? Is it ensured that the measurements will not dissynchronize? I mean if I start 3 SDADCs in the same time (+- few CPU cycles, doesn't matter), time difference between each next measurements will be constant? After 5 seconds, every SDADC will do same amount of measurements?

S.Ma
Principal
May 9, 2018
Posted on May 09, 2018 at 19:05

Check out the core speed SYSCLK in MHz and each ADC Sampling frequency. Are all ADC sharing the same sampling frequency?

kader ben
Associate
May 13, 2018
Posted on May 13, 2018 at 21:46

hello please, I have a robotics project where I'm forced to use a stm32f3, but I do not know about stm32, I need a basic code to perform the digital analog conversion a continuous signal through pin PA0 ( first adc_in), to understand this part. thank you in advance.