AnsweredAssumed Answered

Getting the source of wakeup from STANDBY

Question asked by vanco.juraj on Sep 17, 2011
Latest reply on Sep 19, 2011 by Clive One
I have an application where I have 2 sources that wake my STM32F from STANDBY: RTC and wakeup pin. Both work well as designed (they wake my MCU from STANDBY) but I cannot get the flag to tell what caused the MCU to wake up: if it was the WAKE pin or RTC alarm.

To be more specific, I can do that, when I start running the code with JTAG debugger.
When I disconnect the debugger during runtime (let the code run), everything works as before, i.e. the MCU goes to STANDBY and then leaves it after RTC or WAKE pin and determines correctly the source of reset (RTC or pin).
The only case the application is not running as designed is when I run target without JTAG, i.e. POR without debugging. In this case I see always RTC alarm not set even if it was the cause.

I check PWR_FLAG_SB to determine if I get POR or STANDBY-reset. After that I use RTC_FLAG_ALR status to determine if the RTC alarm was the cause of reset from STANDBY.