STM32H7B3I - Receiving an unknown interrupt on the EXT9_5 after clearing the interrupts on all lines 5 - 9.
Hi,
I have the following code: which clears the WXTI9_5 interrupts, enables the EXTI9_5 interrrupts and provides an interrupt handler for these.
void clearAll_EXTI9_5_IRQ(void)
{
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_5);
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_6);
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_7);
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_8);
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_9);
}
...
clearAll_EXTI9_5_IRQ();
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
/**
* @brief This function handles EXTI line[9:5] interrupts.
* GPIO_PIN_5 is the WiFi Ready status
*/
uint16_t flagInt;
void EXTI9_5_IRQHandler(void)
{
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
flagInt = 0;
if (__HAL_GPIO_EXTI_GET_IT(GPIO_PIN_5) != 0x00U)
{
/* DataReady Pin Rising */
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_5);
wiFiRdyState = true;
xSemaphoreGiveFromISR(wiFiReadySemHandle, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
return;
}
if(__HAL_GPIO_EXTI_GET_IT(GPIO_PIN_8) != 0x00U)
{
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_8); /* SD Card detect */
return;
}
if(__HAL_GPIO_EXTI_GET_IT(GPIO_PIN_6) != 0x00U)
{
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_6); /* NIU */
return;
}
if(__HAL_GPIO_EXTI_GET_IT(GPIO_PIN_7) != 0x00U)
{
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_7); /* NIU */
return;
}
if(__HAL_GPIO_EXTI_GET_IT(GPIO_PIN_9) != 0x00U)
{
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_9); /* NIU */
return;
}
/* What interrupt is this? */
flagInt = 1;
}I am using the line 5 interrupt on a rising edge and that works fine.
However before I initiate a SPI transaction which results in Line 5 asserting on completion, I get an interrupt which does not match any of the lines and I end up at line 58 i.e. flagInt = 1;
This is in spite of the fact that I clear all of the interrupts for EXTI9_5 and I have checked that there are no other active pins floating that could cause this. I also checked that I only enabled the EXTI9_5 once.
I have seen another question similar to this and putting __DSB()'s before the returns was the fix, but I do not seem to be missing genuine interrupts in the 5 - 9 range I just get the extra one at the start.
I would like to nail it down because rogue interrupts can cause nastiness to occur in complex projects.
Any ideas?
Regards
Rob
