2025-03-04 2:51 PM - edited 2025-03-06 9:49 AM
Hello !
I have a problem : I'm looking for a way to know the origin of a wake-up from standby mode.
I'm using STM32U083C Discovery Kit.
In my application, MCU can wake-up in two different manners : an external wake-up pin and an RTC periodic wake-up.
The question is : how to distinguish the two after MCU reset ?
I tried :
if (__HAL_RTC_WAKEUPTIMER_GET_FLAG(&hrtc, RTC_FLAG_WUTF) == SET)
{...}
But the flag is never SET...
Thank you in advance for your feedback !
Xavier
2025-03-05 12:19 PM
Any clue, anybody ?
2025-03-05 12:50 PM
Have you interrupt enabled ???
2025-03-05 3:42 PM
Well yes, interrupts are enabled...but not executed as mcu is stopped in standby mode !
My board has no problem to wake up from the two sources : RTC and EXTI button.
After leaving standby, mcu performs a complete reset. Only VBAT domain (RTC and backup registers) is saved).
2025-03-06 12:55 AM
if (__HAL_PWR_GET_FLAG(PWR_FLAG_WUFI) == SET) won't work either...
Maybe no solution ?
2025-03-06 7:20 AM
I mean RTC WU interrupt, i mean his flag is set only when WUIE is set. And EXTI not wakeup from standby, only wake pins work.
2025-03-07 8:17 AM
Thank you MM..1 but that won't help me...
You're right my button is connected to an wake-up pin.
Apparently there is no flag indicating a wake-up from RTC after mcu's reset.
2025-03-07 10:30 AM
HAL have some issue on init , that can reset clear RTC . Try use noinit memory and store flag in asm init part. Standby is hard to debug.How to avoid reset RTC after wake up from standby ... - STMicroelectronics Community