2020-07-28 09:15 PM
I want to write an application in which whenever an external interrupt occurs on a GPIO pin, the EXTI gets disabled until a certain amount of time is passed, and then it gets enabled again.
What I tried is that I have put the following lines in the HAL_GPIO_EXTI_Callback function:
HAL_NVIC_DisableIRQ (EXTI9_5_IRQn);
//calls some other function
//end of function
and to re-enable the NVIC IRQ I have put the following lines on my application in the place where the amount of time is passed:
GPIO_INIT_EXTI ();
//in which the GPIO_INIT_EXTI(); function is as follows:
void GPIO_INIT_EXTI (void) {
GPIO_InitTypeDef GPIO_InitStruct = {0};
__HAL_RCC_GPIOE_CLK_ENABLE ();
GPIO_InitStruct.Pin = EX_TRG_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(EX_TRG_GPIO_Port, &GPIO_InitStruct);
HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 1);
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
HAL_NVIC_SetPriority(EXTI9_5_IRQn , 0, 1);
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn );
}
and I can confirm that the code gets to the GPIO_INIT_EXTI (); part by debugging, but the HAL_GPIO_EXTI_Callback function only executes once, even though there's a periodic rising edge on the gpio pin.
stm32f429 discovery board
2020-07-28 10:52 PM
If you disable interrupt in NVIC, just reenable it, don't reinit the pin.
JW
2020-07-28 11:46 PM
I had no luck with that too.
I just called HAL_NVIC_EnableIRQ(EXTI9_5_IRQn).
Is that the right way to enable an EXTI?
2020-07-28 11:56 PM
I think the problem is with the delay function that the LCD is using. I'm using the STemWin library, and the superloop contains a GUI_Delay(100); which I tried to replace with a while loop to produce the delay, but the LCD stopped working. I also tried this solution but had no luck with that too.