Skip to main content
Explorer II
August 15, 2024
Solved

RTC Wake-Up from Stop3 on STM32U545RE

  • August 15, 2024
  • 11 replies
  • 8631 views

I would like to use the Stop3 low-power mode on an STM32U545RE (NUCLEO-U545RE-Q board) and to wake-up the device by the RTC. I have a working example for Stop2 mode for which I largely used the inspiration from the stm32u5 workshop. But when I replace the HAL_PWREx_EnterSTOP2Mode call(s) with HAL_PWREx_EnterSTOP3Mode, the device does not wake up from the stop mode anymore. At least the current consumption drops down to 3uA so I am confident that the Stop3 mode itself is working.

The code parts of my main function which I believe are relevant look as follows:

HAL_Init();
SystemClock_Config();
SystemPower_Config();

MX_GPIO_Init();
MX_ICACHE_Init();
MX_RTC_Init();

/* The SMPS regulator supplies the Vcore Power Domains */
HAL_PWREx_ConfigSupply(PWR_SMPS_SUPPLY);

/* Enable ultra low power mode */
HAL_PWREx_EnableUltraLowPowerMode();

/* Enable the Autonomous Mode for the RTC Stop0/1/2 */
__HAL_RCC_RTCAPB_CLKAM_ENABLE();

/* Set RTC wakeup timer for 2s */
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 2, RTC_WAKEUPCLOCK_CK_SPRE_16BITS, 0);

/* Enter in Stop 3 mode */
HAL_PWREx_EnterSTOP3Mode(PWR_STOPENTRY_WFI);

 

Is there anything missing to make the RTC (interrupt) work in Stop3 mode? In the reference manual, I found that the RTC should be able to run and to wake up the CPU from Stop3 mode but I guess some configuration is missing here. Thanks in advanve for any helpful advice.

    This topic has been closed for replies.
    Best answer by STealthy_sneezer

    Hi @TNaum,

    I apologize for the oversight. It seems the hal_RTC.c files were unintentionally linked to my MX repository.

    I'm sending you a new project, which I have tested on another computer to ensure it works correctly. In this example code, LD2 should light up after 10 seconds when we exit STOP3 mode. You can also check the power consumption on the IDD jumper. Please let me know if you encounter any issues.

    If anything about the configuration is unclear, feel free to send us your code, and I'll be happy to take a look.

    Best regards

     

    11 replies

    TNaumAuthor
    Explorer II
    December 19, 2024

    Just in case this is interesting for anyone: The magic missing line is the HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN7_HIGH_3) call which is in a user-code section and never generated by CubeMX, no matter how it is configured: https://github.com/STMicroelectronics/STM32CubeU5/blob/main/Projects/NUCLEO-U575ZI-Q/Examples/PWR/PWR_LPMODE_RTC/Src/stm32u5xx_hal_msp.c#L114