AnsweredAssumed Answered

Problems waking from Sleep Mode on STM32L152 Nucleo

Question asked by David Brooks on Jun 1, 2017

After waking from a WFI instruction, it appears my GPIO and possibly other processor configurations have been changed and are not correct. The Reference Manual implies Sleep Mode does not affect any settings. I see two particular symptoms after waking up. 1) I poll the pin that caused the interrupt and read a High when I know the input is Low (switch is still closed). This implies, I think, the pin has been reconfigured as and Output. 2) Although the pin was originally configured as a falling-edge interrupt, I now get an interrupt when the switch is released and the pin goes High. So, the software essentially misses this first switch closure coming out sleep. If I press the switch a second time, everything works properly. Any suggestions?

 

I am using Cube-generated project with HAL Library STM32Cube_FW_L1_V1.6.0. All examples are non-Cube/HAL based and seem to be of no help. Also, I am disabling the SYSTick Timer before entering sleep and re-enabling it after waking up.

Outcomes