2025-01-01 09:04 AM - last edited on 2025-01-02 01:57 AM by Amel NASRI
Hi, I am building a custom board with stm32h7r3z8t6.
Have a problem with EXTI function:
I use 2 EXTIs - EXTI8 in PD8 and EXTI9 on PC8.
Both are defined as rising edge interrupt sources. Both pulled down and without any signal.
Both are toggling LEDs.
EXTI8 generates a square signal of 2.1MHz on the LED pin.
EXTI9 nothing, never entering to the interrupt.
The picture is the same if the signal source with 400KHz is connected to EXTI9 and EXTI8.
system clock running at 600MHz HCLK at 300MHz.
External crystal 48MHz.
I tried just reading pins and applying the value to LEDs - it works fine, so I guess, the pins are soldered well and not burned.
Using ST-LINK3 Debugger.
The Signal on LED2_Pin:
void EXTI8_IRQHandler(void)
{
/* USER CODE BEGIN EXTI8_IRQn 0 */
/* USER CODE END EXTI8_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(DRDY_Pin);
/* USER CODE BEGIN EXTI8_IRQn 1 */
HAL_GPIO_TogglePin(LED2_GPIO_Port,LED2_Pin);
/* USER CODE END EXTI8_IRQn 1 */
}
/**
* @brief This function handles EXTI line9 interrupt.
*/
void EXTI9_IRQHandler(void)
{
/* USER CODE BEGIN EXTI9_IRQn 0 */
/* USER CODE END EXTI9_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(DCLK_Pin);
/* USER CODE BEGIN EXTI9_IRQn 1 */
HAL_GPIO_TogglePin(LED3_GPIO_Port,LED3_Pin);
/* USER CODE END EXTI9_IRQn 1 */
}
2025-01-01 10:51 AM
>>EXTI9 on PC8
No, EXTI9 would need to come from a GPIO_PIN_9 on one of the GPIO Banks
2025-01-01 11:11 AM
Thanks for answer.
It's my typo.
EXTI9=>PC9
EXTI8=>PD8
2025-01-02 05:38 AM
If the interrupt is being triggered, there's a reason for it. Set a breakpoint in EXTI8_IRQHandler and examine the state of pins and registers to determine why it's being called. Look at VECTACTIVE to make sure the correct handler is being called. (Compare the value VECTACTIVE - 16 to those listed in IRQn_Type.)
2025-01-02 08:33 AM
Thanks for your answer,
I get VECTACTIVE = 0x28 when it triggers the EXTI8 And nothing on EXTI9. With and without input signal.
I tried to use HSI - the same behavior.
I am pretty sure it comes from the MCO1, It generates 2.2MHz. If it is OFF, EXTI9 is not triggered but still does not respond to the external signal.
2025-01-02 09:04 AM - edited 2025-01-02 09:06 AM
> I get VECTACTIVE = 0x28 when it triggers the EXTI8
0x28 - 16 = 24, which is EXTI8_IRQn, so that lines up. Something is triggering it.
> I am pretty sure it comes from the MCO1, It generates 2.2MHz. If it is OFF, EXTI9 is not triggered but still does not respond to the external signal.
Makes sense. Perhaps PD8 is not hooked up to what you think it is, or the EXTI8 interrupt is not set to PD8. Note that MCO1 output is on PA8, which is the default EXTI port.
Look at SBS->EXTICR2 and ensure lower 4 bits are set to 0x3.
2025-01-02 11:02 AM
Read out and check/post content of relevant GPIO and EXTI, and as @TDK said above, the EXTI steering registers.
JW