cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G070: How to wakeup from STOP1 using RTC? Any example? Does anybody can help me, please?

WBian.1
Associate II

Hi all,

I'm trying to periodically wakeup from STOP1 using RTC, but it is not working...

    SystemClock_Decrease();
 
    __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WUF);
 
    /* De-init LED4 */
    BSP_LED_DeInit(LED4);
 
    HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 5, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);
 
    /* Suspend Tick increment to prevent wakeup by Systick interrupt.         */
    /* Otherwise the Systick interrupt will wake up the device within 1ms     */
    /* (HAL time base).                                                       */
    HAL_SuspendTick();
 
    /* Enter Sleep Mode, wake up is done once User push-button is pressed */
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_SLEEPENTRY_WFI);

7 REPLIES 7
Imen.D
ST Employee

Hello @WBian.1​ and welcome to the Community :)

I advise you to review the PWR examples available within STM32CubeG0 MCU package.

How to configure the RTC to wake up the STM32 periodically from Low Power modes

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Of course, the code in that article and all of the ST examples showing how to enter Stop modes for all series are broken. The following topic explains how to do it correctly:

https://community.st.com/s/question/0D53W00001nYvGgSAK/mc-sdk-not-work-with-mcu-stop-mode

Post edited by moderation team for it to adhere to community guidelines.

WBian.1
Associate II

Hi Imen,

Thanks for your promptly reply. I don't know if you **** a read in my code (the attached one), but this was made using the link you sent...This is the reason I asked for support...it never wakes up through RTC, just using the button on NUCLEO's board....

As Piranha said, it is broken....it have to be a way to do it...the datasheet says it is possible, but it is not working at all.

Could you please sugest me something tested and working code?

Piranha, I'll try your sugestion, tks.

WBian.1
Associate II

Piranha, unfortunately your suggestion just say how to enter in stop mode....this is working to me. The problem is the G070 can't wakeup using RTC....do you have any idea on how to fix this?

Read that link carefully - ST's code also seems to work, but it actually is broken.

Regarding wake-up by RTC, this could be related:

https://community.st.com/s/question/0D53W00000NY28FSAT/clearing-the-rtc-wutf-saving-your-sanity-by-sharing-my-hard-lesson-learned-

WBian.1
Associate II

Thank you for replying me! I just started to read that link...and this makes a lot of sense to me.