2018-05-09 03:54 AM
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 #adc2018-05-09 05:14 AM
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?
2018-05-09 05:16 AM
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
2018-05-09 07:57 AM
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?
2018-05-09 12:05 PM
Check out the core speed SYSCLK in MHz and each ADC Sampling frequency. Are all ADC sharing the same sampling frequency?
2018-05-10 01:02 AM
Everything is configured in the same way. Every ADC is the same.
2018-05-10 08:42 AM
Take your ADC sampling frequency and find out how many core cycles this correspond to.
It will tell you if an interrupt of high priority can read all ADC registers and back it up before the next one.
2018-05-10 08:43 AM
Note: Actually this is only a quick look at the clock prescalers, no need the absolute value.
2018-05-13 12:46 PM
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.