2018-03-08 09:39 PM
Hello,
I am working on STM32f429ii controller, I want to used a interrupt from different sources say EXTI2, this interrupt can be activated for PH2 and PB2 so I was thinking to use this like,
void EXTI2_IRQHandler(void)
{
if( !HAL_GPIO_ReadPin(GPIOH, GPIO_PIN_2)){ // Low level triggered interrupt
// if interrupt from this pin Do something
}
elseif( !HAL_GPIO_ReadPin( GPIOB, GPIO_PIN_2)){
// if interrupt from this pin DO someting //its from keyboard so it can wait
}
}
My question is can we use more then one pin for same interrupt, if yes then my code will work. if not what then what should I do. I don't have any free pins.
I can't use a timer interrupt as it may destroy other critical tasks and main already have other time consuming stuff.
#external-interrupt #interrupt-issueSolved! Go to Solution.
2018-03-08 11:28 PM
Hello
singhjadon541
,you cannot enable the same interrupt. In SYSCFG registers, you have to specify PORT and only single one can be entered. This means that active GPIO port will be the one you initialized last.
Best regards,
Tilen
2018-03-08 09:55 PM
You can use only one pin per input, EXTI2 from either PA2, PB2, PC2, etc
With the higher order EXTI the pins are grouped, so EXTI 5 to 9 go to a single interrupt handler, so one could look for PA5,PA6,PA7,PA8,PA9, each should be flagged separately, but drop into EXTI9_5_IRQHandler
2018-03-08 11:05 PM
Hi, there
Thanks for clarifying. what will exactly happen if I enable same interrupt for different sources and what should I do, if you have any suggestions.
2018-03-08 11:28 PM
Hello
singhjadon541
,you cannot enable the same interrupt. In SYSCFG registers, you have to specify PORT and only single one can be entered. This means that active GPIO port will be the one you initialized last.
Best regards,
Tilen