cancel
Showing results for 
Search instead for 
Did you mean: 

Get Standby Mode wake up source?

Andres Smithuis
Associate II
Posted on June 01, 2018 at 12:16

I'm putting my STM32L0 in Standby Mode and it can be woken up either by an RTC timer event or by WKUP Pin. Is there a way to check what the source was of the wakeup event? (So check if wakeup was because of WAKEUP pin or by RTC)?

*EDIT*

Found a method which works for my application. I check to see if the WUTF is set from the RTC->ISR register. If it is set, it means the MCU woke up from the RTC timer. Otherwise I assume it was from the WKUP pin.

2 REPLIES 2
Nesrine M_O
Lead II
Posted on June 01, 2018 at 13:21

Hi

andressmithuis

,

WUF: Wakeup flag

, this

bit is set by hardware when awakeup event was received from the

WKUP pin or from the

RTC alarm (Alarm A or Alarm B),

RTC Tamper event,

RTC TimeStamp event or

RTC Wakeup.

An additional wakeup event is detected if the WKUP pins are enabled (by setting the EWUPx (x=1, 2, 3) bits) when the WKUP pin levels are already high.

so you may check the status of the EWUPx and theWUF bits in the PWR power control/status register.

Please refer toPower control (PWR) chapter in your reference manual.

-Nesrine-

Posted on June 01, 2018 at 15:07

Thank you for your response!

But I'm not quite there yet. Checking the EWUPx flag and WUF yields the same results in both situations (awoken by RTC Wakeup or WKUP pin). The WUF seems to always return 0 and the EWUPx flag always returns 1.