cancel
Showing results for 
Search instead for 
Did you mean: 

how to handle multiple interrupt (2 interrupt pin PA0 & PA2 ) two call back in main.c . single pin interrupt working fine . any other solution than this https://community.st.com/s/article/how-to-manage-multiple-extis-with-the-stm32cube-hal

MMARI.1
Senior
 
3 REPLIES 3
S.Ma
Principal

It is better to handle exti interrupts directly wihout using HAL. Past experience show that support of EXTI interrupt on an alternate function pin was not supported.

Also that all separated interrupt vectors are rejojned by HAL (few years back on STM32L4).

So DIY for EXTI is prefferred. Check the LL if it is easier to grasp than the time it takes to read the refman and code directly...

HI, good morning
do you think I should keep the code inside the IRQ Handler as an alternative solution to handle multiple interrupts? ..
void EXTI0_IRQHandler(void)
{
/* USER CODE BEGIN EXTI0_IRQn 0 */
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
/* USER CODE END EXTI0_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0);
/* USER CODE BEGIN EXTI0_IRQn 1 */
/* USER CODE END EXTI0_IRQn 1 */
}
/**
* @brief This function handles EXTI line2 interrupt.
*/
void EXTI2_IRQHandler(void)
{
/* USER CODE BEGIN EXTI2_IRQn 0 */
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
/* USER CODE END EXTI2_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_2);
/* USER CODE BEGIN EXTI2_IRQn 1 */
/* USER CODE END EXTI2_IRQn 1 */
}
keeping the call back as dummy in main.c
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){}
S.Ma
Principal

There is another fresh post about EXTI to consult. In 8 but mcu way, the interrupt handler should be very brief to release the pending interrupt. Interrupt replace missing HW by SW+Time, simply.