Skip to content

Commit 8877052

Browse files
committed
STM32 Fuly disable GPIO irq settings
When disabling GPIO irq, also the falling / rising edge settings need to be reset (EXTI_RTSR and EXTI_FTSR registers). If not reset, the same EXTI line can be later enabled again with a wrong Rising / Falling configuration. This was especially seen and reported in ci-test tests-api-interruptin on NUCLEO_F446RE target where DIO2=PA_10 and DIO6=PB_10 were successively tested: as they are sharing the same EXTI_LINE (EXTI_10), this resulted in calling the irq_handler with wrong IRQ_FALL/IRQ_RAISE parameter and donothing being called in loop.
1 parent 9b082ff commit 8877052

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

targets/TARGET_STM/gpio_irq_api.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ void gpio_irq_enable(gpio_irq_t *obj)
290290
void gpio_irq_disable(gpio_irq_t *obj)
291291
{
292292
/* Clear EXTI line configuration */
293+
LL_EXTI_DisableRisingTrig_0_31(1 << STM_PIN(obj->pin));
294+
LL_EXTI_DisableFallingTrig_0_31(1 << STM_PIN(obj->pin));
293295
LL_EXTI_DisableIT_0_31(1 << STM_PIN(obj->pin));
294296
NVIC_DisableIRQ(obj->irq_n);
295297
NVIC_ClearPendingIRQ(obj->irq_n);

0 commit comments

Comments
 (0)