2023-10-05 01:45 AM
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:
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
2023-10-05 04:35 AM
hello @justinjoseph ,
example for U5 (don't know which device you are using).
as stated in Reference manual :
for WKUP pin you can read the following status register :
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