External interrupt not working. Why?
Hi. I have two sensors connected to an STM32f410r8t6, where they send a high signal whenever new data is ready to be read.
Pin connections are as follows:
PC9 (GPIO_EXTI9) -> INT_IMU2
PC7 (GPIO_EXTI7) -> INT_IMU1
I have them setup as follows in the ioc file.

The GPIO and NVIC code is automatically generated.
In my stm32f4xx_it.c file I have the following:
void EXTI9_5_IRQHandler(void)
{
/* USER CODE BEGIN EXTI9_5_IRQn 0 */
/* USER CODE END EXTI9_5_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_7);
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_9);
/* USER CODE BEGIN EXTI9_5_IRQn 1 */
/* USER CODE END EXTI9_5_IRQn 1 */
}So I navigate to the HAL_GPIO_EXTI_IRQ_Handler function.
void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin)
{
/* EXTI line interrupt detected */
if(__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != RESET)
{
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
HAL_GPIO_EXTI_Callback(GPIO_Pin);
}
}I see that I must implemented the code I wish to be executed in the interrupt within the HAL_GPIO_EXTI_Callback function. I head back to main and insert this: under user code begin 4:
void HAL_GPIO_EXTI_CALLBACK(uint16_t GPIO_Pin)
{
//if (GPIO_Pin == INT_IMU1_Pin) //IMU1 has sample ready
if (GPIO_Pin == GPIO_PIN_9)
{
HAL_GPIO_TogglePin(LED_3_GPIO_Port, LED_3_Pin);
Entered_ISR = 1;
/*
ICM_ReadAccelGyroData(&IMU1);
ICM_ReadAccelGyroData(&IMU2);
filterUpdate(&IMU1);
filterUpdate(&IMU2);
*/
}
//else if (GPIO_Pin == INT_IMU2_Pin) //IMU2 has sample ready
else if (GPIO_Pin == GPIO_PIN_7)
{
HAL_GPIO_TogglePin(LED_3_GPIO_Port, LED_3_Pin);
Entered_ISR = 1;
/*
ICM_ReadAccelGyroData(&IMU1);
ICM_ReadAccelGyroData(&IMU2);
filterUpdate(&IMU1);
filterUpdate(&IMU2);
*/
}
}When I debug the program, it never enters the interrupt routine. The flag isn't set, and the LED doesn't toggle.
Looking at the line with an oscilloscope I see that the pulses are there:
The high signal is 2.5 V, which should be high enough, as the datasheet for the MCU specifies 0.7*VCC is accepted as V_Hin, and the MCU is supplied with 3.3 V
What stupid thing am I missing?