cancel
Showing results for 
Search instead for 
Did you mean: 

Standby Mode Wakeup

justinjoseph
Associate

I am creating a project in which I am using Standby mode as the low power mode of choice. I am using Cube IDE for development. These are the wakeup pins/procedures that I would like to implement:

  1. SYS_WKUP1 (PA0)
  2. SYS_WKUP2 (PC13)
  3. HAL_RTC WakeUpTimer Interrupt
  4. RTC Internal Alarm A
  5. RTC Internal Alarm B

My questions are:

1. Is there a way to distinguish between all the wakeups given above ( Callback functions that could execute at the moment of wakeup or flag status checks) since the wakeup from standby mode is like a complete reset and executes from main() ?

2. I am currently checking the flags

 __HAL_PWR_GET_FLAG(PWR_FLAG_SB) - for checking if its a power on scenario or wakeup from standby, and  __HAL_PWR_GET_FLAG(PWR_FLAG_WU) - for checking if its a wakeup event

But I am not able to distinguish between the above 5 wakeup cases. I am using the callback function HAL_RTCEx_WakeUpTimerEventCallback to check if its an internal wakeup from rtc. But its not entering the callback function.

Looking forward for suggestions and information.

Thank you,

Justin

1 REPLY 1
MikaelM
ST Employee

hello @justinjoseph ,
example for U5 (don't know which device you are using).
as stated in Reference manual : 

MikaelM_0-1696497170937.png

for WKUP pin you can read the following status register : 

MikaelM_1-1696498024429.png

but be careful to the configuration because this can be cleared automatically by hw. and be careful to read the value before some initialization, You have to check from which power reset you get up.

For RTC : if you select stand by with RTC (obviously you do) the the registers values are backed up in standby mode. So you should retrieve the interrupt that wakeup into the RTC status register.

Best regards,

Mikael

 

If you feel a post has answered your question, please click Accept as Solution.