AnsweredAssumed Answered

GPIO read not working as expected following EXTI + wakeup from sleep

Question asked by Julian Y on Sep 28, 2017
Latest reply on May 24, 2018 by Harsha Jagadish

I noticed there are already several questions about reading both edges in an EXTI callback, but my problem seems different as it involves waking up from sleep. Anyway, do point me to the right place if this has already been answered.

 

Basically I am trying to determine whether a rising or falling edge triggered an EXTI on a GPIO pin.

1) I configure the interrupt for both rising + falling edges

2) in the interrupt callback i call  HAL_GPIO_ReadPin() to determine whether the pin is HIGH or LOW

 

The read value is correct under normal conditions (microcontroller is awake). But the value I get is incorrect following a wakeup, such as in the following steps.

 

1) Same configuration as before(configure the interrupt for both rising + falling edges)

2) Wait for interrupt using HAL_PWR_EnterSTOPMode( PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI );

3) in the interrupt callback i call  HAL_GPIO_ReadPin() to determine whether the pin is HIGH or LOW

4) The read value is always LOW even when it should be HIGH

 

Am I missing some step here? Do I have to enable something first that refreshed the GPIO read register?

Thanks in advance.

Outcomes