cancel
Showing results for 
Search instead for 
Did you mean: 

Detect origin of a wake-up from standby mode

bluexav
Associate III

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

7 REPLIES 7
bluexav
Associate III

Any clue, anybody ?

Have you interrupt enabled ???

bluexav
Associate III

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).

bluexav
Associate III

if (__HAL_PWR_GET_FLAG(PWR_FLAG_WUFI) == SET) won't work either...

Maybe no solution ?

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.

bluexav
Associate III

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.

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