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.
pull/4676/head
Laurent MEUNIER 2017-06-30 09:37:26 +02:00
parent 9b082fff55
commit 88770528bd
1 changed files with 2 additions and 0 deletions

View File

@ -290,6 +290,8 @@ void gpio_irq_enable(gpio_irq_t *obj)
void gpio_irq_disable(gpio_irq_t *obj)
{
/* Clear EXTI line configuration */
LL_EXTI_DisableRisingTrig_0_31(1 << STM_PIN(obj->pin));
LL_EXTI_DisableFallingTrig_0_31(1 << STM_PIN(obj->pin));
LL_EXTI_DisableIT_0_31(1 << STM_PIN(obj->pin));
NVIC_DisableIRQ(obj->irq_n);
NVIC_ClearPendingIRQ(obj->irq_n);