Imagine this scenario:
You are using a timer driven ADC in DMA mode, nothing special. Now, because you are interested in having a Watchdog, you also enable the ADC Global Interrupt in CubeIDE (enabling this is necessary so the watchdog triggers the interrupt).
Now imagine the DMA finishes transfering: the DMA will call "
HAL_ADC_ConvCpltCallback", BUT since we also enabled global interrupts for the watchdog,
HAL_ADC_IRQHandler will also be called, and this function will also call "
So, do you end up having "
HAL_ADC_ConvCpltCallback" called twice? One by the DMA and another one by the IRQ handler?
Things get more confusing when DMA fails and an overrun happens in the ADC. The DMA will by itself call "
HAL_ADC_ErrorCallback" due to transfer error, BUT because we also have an overrun,
HAL_ADC_IRQHandler will also call "
HAL_ADC_ErrorCallback" due to overrun error.
So, you end up having "
HAL_ADC_ErrorCallback" called twice? One by the DMA transfer error and another one by the IRQ handler due to overrun?
I have tried to find the answer for this in the STM32 manual, also the HAL manual and by directly looking at HAL code but could not figure it out.