2018-06-01 03:16 AM
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.
2018-06-01 04:21 AM
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-
2018-06-01 08:07 AM
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.