2020-05-03 01:10 AM
Hi,
I want to use 3 (and after 5) ADCs to be triggered with the same trigger (TIM3) and to receive an interrupt when the ADC conversion is completed, with DMA. I assumed that if the 3 ADCs have the same trigger and the same configuration, when one of them returns an interrupt and because of the fact that all the ADCs are working in parallel, I will have the result of all the ADCs at the same time.
To check this, I used the HAL_ADC_ConvCpltCallback function and I toggle an output just for debug.
What it happens is that I receive an unexpected 2 toggles after the first conversion. So the HAL_ADC_ConvCpltCallback was called 3 times. I used a PWM output for the timer trigger to synchronize the oscilloscope as well.
Is there any way to receive an interrupt when all the ADC (or one interrupt per ADC) when the DMA transfer is complete?
2020-05-03 06:14 AM
HAL_ADC_ConvCpltCallback is also called if there is a DMA error on the stream, such as an overrun. It's possible that is what is happening. Set a breakpoint and figure out the calling function, and why it's being called.
The behavior you want (one interrupt per ADC when DMA is complete) is the intended behavior.