cancel
Showing results for 
Search instead for 
Did you mean: 

Why ADC_IRQHandler() having all three HAL_ADC_IRQHandler() ?

Mani1
Associate II

I enable three ADC. ADC1, ADC2, ADC3.

example:

I enable these DMA, DMA2_Stream1_IRQHandler, DMA2_Stream2_IRQHandler, DMA2_Stream4_IRQHandler. Each DMA IRQ handler having each HAL_DMA_IRQHandler().

But ADC_IRQHandler() having three HAL_ADC_IRQHandler(). In this case some time i want ADC1 interrupt only, but ADC interrupt enable means all HAL_ADC_IRQHandler() is executed.

Is there any separate IRQ_Handler for Three ADC.

Thanks

Manikandan D

5 REPLIES 5
TDK
Guru

What chip? On some, a single interrupt exists for all ADCs.

If you only want ADC1 interrupts, ensure interrupts are not enabled on the other two ADCs.

Since HAL_ADC_IRQHandler checks for both the interrupt flag and the interrupt enable flag, there are no side effects other than lost processor cycles of calling it on, say, ADC2 if ADC2 interrupts are disabled.

If you feel a post has answered your question, please click "Accept as Solution".

You can always dispense with the HAL stuff and create something more tailored based on an actual understanding of the hardware, algorithms, etc.

The HAL_ADC_IRQHandler() is a common sink point for identifying the instance and interrupt source, and managing/calling the call back routines you've specified.

It is a rather heavy abstraction at times, and you're obviously free to code a different/better solution, and use whatever individual IRQ handlers the NVIC/ADC support on your specific STM32

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Mani1
Associate II

Board : STM32F746G

Is there any individual ADC_IRQHandler() for All ADC. like ADC1_IRQHandler() , ADC2_IRQHandler(), ADC3_IRQHandler().

In my code:

ADC_IRQHandler()

{

HAL_ADC_IRQHandler(&hadc1);

HAL_ADC_IRQHandler(&hadc2);

HAL_ADC_IRQHandler(&hadc3);

}

But my expectation:

ADC1_IRQHandler()

{

HAL_ADC_IRQHandler(&hadc1);

}

ADC2_IRQHandler()

{

HAL_ADC_IRQHandler(&hadc2);

}

ADC3_IRQHandler()

{

HAL_ADC_IRQHandler(&hadc3);

}

Thanks

Manikandan D

TDK
Guru

The STM32F7 has a single interrupt for all ADCs. It's not something you can change.

Some interrupts are shared between peripherals, you can look at the vector table to see.

https://github.com/STMicroelectronics/STM32CubeF7/blob/master/Drivers/CMSIS/Device/ST/STM32F7xx/Source/Templates/gcc/startup_stm32f746xx.s#L166

If you feel a post has answered your question, please click "Accept as Solution".
Mani1
Associate II

Thank you for your answer @TDK​