Unexpected EXTI Interrupt Behavior on STM32F407VETx
- December 12, 2025
- 3 replies
- 101 views
Hello everyone,
I’m working on a control unit board based on the STM32F407VETx (LQFP100) microcontroller. During development I noticed that some pins configured as external interrupts (rising edge) were being triggered more often than expected.
To better analyze the issue and exclude possible mistakes in my code, I prepared a minimal test project with the following configured pins in IOC:
Pin 9 – PC15: GPIO_EXTI15 - INPUT_1
Pin 97 – PE0: GPIO_EXTI0 - INPUT_2
External crystal/ceramic resonator (HSE)
Serial Wire Debug with SysTick as timebase source
The only user code added is in gpio.c:
/* USER CODE BEGIN 0 */
volatile uint8_t counter_1 = 0;
volatile uint8_t counter_2 = 0;
/* USER CODE END 0 */
.
.
.
/* USER CODE BEGIN 2 */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
if(GPIO_Pin == INPUT_1_Pin) {
counter_1 = (counter_1 + 1) % 255;
}
if (GPIO_Pin == INPUT_2_Pin) {
counter_2 = (counter_2 + 1) % 255;
}
}
/* USER CODE END 2 */
On my board both PIN9 and PIN97 have the following input circuit:

Additionally, although not used in this test project, the board also supports CAN communication thanks to the following circuit:

For testing, another ECU cyclically sends 8 CAN messages (DLC 8, extended ID):
7 messages at 10 ms repetition rate
1 message at 100 ms repetition rate
On the input pin I generate a 0–12 V square signal (verified with an oscilloscope), and I monitor counter_1 and counter_2 using STM32CubeMonitor.
OBSERVATIONS:
counter_1 (PIN 9 - PC15): Increases more than expected only when ST-Link is connected and CubeMonitor is running. Disconnecting ST-Link restores the expected behavior. CAN traffic has no influence.
counter_2 (PIN97 - PE0): Increases more than expected only when CAN messages are being sent. Stopping CAN traffic restores the expected behavior. ST-Link connection has no influence.
I’ve attached the code and screenshots from both the oscilloscope and CubeMonitor showing all test combinations.
Has anyone experienced similar behavior? Could you help me understand why these unexpected triggers occur?
Thanks in advance!
