cancel
Showing results for 
Search instead for 
Did you mean: 

RTC Wake-Up from Stop3 on STM32U545RE

TNaum
Associate III

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.

26 REPLIES 26
Malex
ST Employee

Hi @TNaum,

I would like to provide a quick update on your issue.

I've ported the example code "PWR_LPMODE_RTC" from STM32U575xx to STM32U545xx. You will find the project attached to this post; please check it out.

I managed to enter STOP3 mode and wake up from it with the RTC alarm. With the provided code, I observe a current consumption down to ~300uA in STOP3 and back to ~8.4mA in Run mode. Though it's still far from 3uA, it does prove that we repeatedly enter and leave STOP3 mode.

Please note that PWR debug pins: PWR_CSLEEP, PWR_CDSTOP, and PWR_SRDSTOP cannot be monitored in STOP3 mode as they are generated in the core domain and are consequently not driven.

If your values are correct, it may be worth conducting further investigation into power consumption. Please tell me what you used to measure the current (tools, setup, etc.).

Best regards.

 

 

 

initdb
Associate

One quick update:

I found the the wakeup source selection in the manual and learned of its existance:

initdb_0-1729153129516.png

I also noticed that i configured the sleep duration not to 1 minute but to 30 minutes last week since i testet the sleep current. So user error on my side.

But I have on question: is the wakeup source selection required and if yes can the wakeup pins of wkup7 be used and the rtc wakeup at the same time or are they exclusive?

TNaum
Associate III

Hi @Malex ,

I am sorry but your project is somewhat broken:

  1. It contains hard-coded paths to your development machine (see `.cproject` file lines 47 to 53)
  2. In CubeMX, the RTC is not even enabled. So even after fixing those paths manually to the `Drivers` directory in the project, it does not build.

Would it be possible to supply a working example which can be reproduced on another machine?

Additionally, 300 uA just seems too much current for STOP3 mode. First, how can we be sure that the system actually is in STOP3 mode? Second, what is the point of using this if it is not achieving the lowest power consumption? Third, based on my experience with other STM32 MCUs and the STOP2 mode on exactly this MCU, I find 3uA very plausible, 300 uA seems wrong in my opinion, at least if you can not explain the extra current.

Regarding my setup: I used the NUCLEO-U545RE-Q board and measured the current at the IDD jumper using a regular multimeter. I guess this should work because it is designed for this purpose, right?

So I consider this issue not yet solved, please don't stop investigating. Thanks for your effort.

Malex
ST Employee

Hi @TNaum,

I fixed the code that contained local references. I recommend opening it with CubeIDE.

Please tell me if you have any trouble running it.

About the power consumption, I am using a power shield on the VDD selection pin (JP5). So the measured 300uA is not just the MCU current but also the level shifter, the SMPS and basically every other peripherals that use VDD.

Using your setup with the amperemeter at IDD JP4, I do get about 3uA in STOP3, which is the MCU power consumption.

In fact, in Run mode I measure 720uA on JP4 and 3uA when in STOP3. After exiting, it goes back to 550uA. You can compare it with the other Low power modes with that code.

 

Best regards

 

 

TNaum
Associate III

Hi @Malex ,

sorry to bother you again, but could you please fix the project? It is broken in the same way as before:

  1. Hard-coded paths to your development machine, in `.cproject` lines 47 to 53
  2. The RTC is still not enabled in the .ioc file. So I can not regenerate the Drivers directory.

Could you maybe validate that it is fixed by trying it on a different machine?

Thanks a lot and best regards

TNaum
Associate III

Hi @Malex ,

anyway, I have copied your code into my previously used project and it does not work as desired: The system apparently goes to STOP3 mode (3uA current consumption), but it never goes back to run mode (stays at 3uA forever). So if the system goes back in your case, there is some magic happening in one of the other files. And I want to find out what that is, that's why I need a working project.

Best regards

Malex
ST Employee

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