2019-01-21 06:59 AM
I'm trying to change GPIO mode at runtime, i could able to change mode from input to output and vice versa. But once configuring GPIO as EXTI i'm not able to change it to any other mode. and even if i try to change, ISR is getting executed.
2019-01-21 07:31 AM
Don't wan to receive the interrupt temporarily? Disable it in NVIC.
-- pa
2019-01-21 07:37 AM
To avoid any glitch, better write directly in the GPIO HW registers.
You can also use sometime when relevant output open drain with high level which would be equivalent to turn as input, maybe without glitches. EXTI on alternate function is not natively supported by HAL nor CubeMX: Write directly in the registers to enable EXTI on alternate function if this is the next development step from where you are. Changing alternate function of a GPIO dynamically also works when done properly. (what happen if you activate 2 UART1 RX GPIOs?)
In case you do still have EXTI glitch, disable EXTI interrupt, change the GPIO mode, clear the EXTI PR flag and reactivate EXTI.
2019-01-21 08:00 AM
i tried disabling nvic and also DeInit the GPIO and Init it again as output, but didn't work.
2019-01-21 08:30 AM
I'm using HAL so i dont know how to access registers..
can u please tell me how to access EXTI registers, i'm using SW4STM32
Thank you
2019-01-21 08:52 AM
As long as the GPIO is not an alternate function, you can use HAL or LL EXTI functions.
search for something like stm32l4xx_ll_exti.c