AnsweredAssumed Answered

How to change GPIO pin mode efficiently

Question asked by pavel a on Feb 17, 2018
Latest reply on Feb 20, 2018 by pavel a

Dear experts,

I need to change mode of a GPIO pin of STM32 for some 1-wire protocol.

In one state, the pin must be EXTI interrupt, in other state the same pin must be output - at least the MCU should be able to drive it high or low. These states need to switch often, quickly, without glitches.

In the Cube the pin is configured as EXTI interrupt, it generated HAL-style init code and interrupt handlers, and it seems to work.

Now the question is, to drive the pin high or low - do I need to call HAL_GPIO_DeInit and HAL_GPIO_Init with new settings? If I only set pullup/pulldown using LL GPIO calls while the pin is in EXTI mode, should it work?

 

Thanks,

-- Pavel

Outcomes