cancel
Showing results for 
Search instead for 
Did you mean: 

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

Julian Y
Associate
Posted on September 28, 2017 at 04:33

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.

1 REPLY 1
Jagadish
Associate II
Posted on May 24, 2018 at 21:47

Hi Julian,

Were you able to fix this issue? Can you let us know how you were able to overcome the problem. 

Thanks,

Harsha