Skip to main content
Graduate II
March 4, 2025
Question

Detect origin of a wake-up from standby mode

  • March 4, 2025
  • 4 replies
  • 801 views

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

    This topic has been closed for replies.

    4 replies

    bluexavAuthor
    Graduate II
    March 5, 2025

    Any clue, anybody ?

    Graduate II
    March 5, 2025

    Have you interrupt enabled ???

    bluexavAuthor
    Graduate II
    March 5, 2025

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

    Graduate II
    March 6, 2025

    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.

    bluexavAuthor
    Graduate II
    March 6, 2025

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

    Maybe no solution ?

    bluexavAuthor
    Graduate II
    March 7, 2025

    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.

    Graduate II
    March 7, 2025

    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