Skip to main content
Visitor II
July 25, 2025
Question

STM32L073RZ unable to enter sleep mode with STM32CubeIDE, but works in Keil.

  • July 25, 2025
  • 1 reply
  • 246 views

Hello All,
I am very worried about this as time is short.
I am attempting to get my STM32L073RZ into low power mode using STM32CubeIDE version 19, and it wakes as soon as it sleeps. I am wondering if this is a problem with my code, or possibly an issue with the STM32CubeIDE?

I am attempting sleep mode like so:

void Enter_Stop_Mode(void)
{
	ConsolePrintf("Preparing to enter Stop mode\r\n");

 // Clear Wake-Up flag
 __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&hrtc, RTC_FLAG_WUTF);
 ConsolePrintf("RTC Wake-Up flag cleared\r\n");

 // Enter Stop mode (low-power mode)
 ConsolePrintf("Entering Stop mode\r\n");
 HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
 ConsolePrintf("Exited Stop mode\r\n");
}

 

And this fails. Am I the only one experiancing this, how have others got this working?
Are there any examples I could go off of?

For more context, here is my repo: https://github.com/CropWatchDevelopment/tempSensorx2
If anyone could help, I would be very greatful.
-Kevin

    This topic has been closed for replies.

    1 reply

    Super User
    July 25, 2025

    @kevin192291 wrote:

     it wakes as soon as it sleeps.


    How do you determine that?

    Do you have 'Debug in low power modes' enabled in CubeIDE, but not Keil?

    Visitor II
    July 25, 2025

    so, when waking from sleep, it initializes my usart1, then sends data over the serial line to my pc.
    Then, I disable to usart, and all other periferals, and wait for my RTC to wake it up again. Sadly it wakes up immediately, I know because I get the instant response on the computer.

    I have tried re-configuring the lpuart to a normal usart as it shouldn't wake my board, and I should be safe from any data coming back to wake the mcu up, but that also doesn't prevent the instant wake.

    I am sure I am missing something, but the real problem is, where.... Any ideas where I am going wrong?