cancel
Showing results for 
Search instead for 
Did you mean: 

Example code PWR_LPSLEEP (low-power sleep mode) in STM32Cube_FW_G0_V1.6.2

Kmax18
Senior II

Question about the above PWR_LPSLEEP example code.
My test setup includes this:
* STM32CubeIDE Version: 1.17.0, Build: 23558_20241125_2245 (UTC).
* HAL library STM32Cube_FW_G0_V1.6.2.
* NUCLEO-G0B1RE.

The example code in main() reduces the clock frequency (lines 123-124):

/* Reduce the System clock to below 2 MHz */
SystemClock_Decrease();

 

What is the advantage of the reduced clock frequency, as the Cortex-M0+ CPU clock is already off in LP Sleep Mode? The Reference Manual RM0444 states on page 128that this has "no effect on other clocks or analog clock sources". Does the reduced system clock frequency save power by reducing the clock for all other clocks or analog clock sources?

Thank you for your response.

1 ACCEPTED SOLUTION

Accepted Solutions
Haifa_BEN_HSOUNA
ST Employee

Hello Kmax18,

While "Table 26. Low-power mode summary" indicates that the CPU clock is turned off and there is no effect on other clocks or analog clock sources, reducing the system clock frequency before entering low-power modes can still be beneficial:

  • Lower Power consumption: This reduction can lower the power consumption of active peripherals and components. For example, reducing the system clock to below 2 MHz before entering Low-power sleep mode can decrease the power consumption of peripherals that rely on the system clock.

 

  • Active peripherals: Even though the CPU is off in LP Sleep Mode, peripherals and other components may still be active (refer to "Table 27. Functionalities depending on the working mode"). The system clock frequency affects the power consumption of the AHB and APB buses, which in turn affects the power consumption of peripherals connected to these buses. Reducing the system clock frequency can lower the power consumption of these peripherals.

 

  • Reduced Wake-Up Time: Additionally, lowering the clock frequency can reduce the wake-up time from low-power modes. The system can transition more quickly from a lower frequency to the operational frequency.

 

I hope this explanation meets your needs.

View solution in original post

1 REPLY 1
Haifa_BEN_HSOUNA
ST Employee

Hello Kmax18,

While "Table 26. Low-power mode summary" indicates that the CPU clock is turned off and there is no effect on other clocks or analog clock sources, reducing the system clock frequency before entering low-power modes can still be beneficial:

  • Lower Power consumption: This reduction can lower the power consumption of active peripherals and components. For example, reducing the system clock to below 2 MHz before entering Low-power sleep mode can decrease the power consumption of peripherals that rely on the system clock.

 

  • Active peripherals: Even though the CPU is off in LP Sleep Mode, peripherals and other components may still be active (refer to "Table 27. Functionalities depending on the working mode"). The system clock frequency affects the power consumption of the AHB and APB buses, which in turn affects the power consumption of peripherals connected to these buses. Reducing the system clock frequency can lower the power consumption of these peripherals.

 

  • Reduced Wake-Up Time: Additionally, lowering the clock frequency can reduce the wake-up time from low-power modes. The system can transition more quickly from a lower frequency to the operational frequency.

 

I hope this explanation meets your needs.