In this tutorial series, we’ll discuss all STM32 Low Power Modes and every option you may need to try while designing your next STM32 Ultra Low Power Application. Each low-power mode in STM32 microcontrollers that we’ll mention in this guide tutorial will be thoroughly explored in a dedicated tutorial with code examples for entering each low-power mode, and wakeup sources to exit each mode; one at a time, so make sure to stick around. Without further ado, let’s get right into it!
This is the 1st tutorial in the STM32 Low Power Modes Tutorial Series which you can navigate through using the links in the table below.
Table of Contents
- STM32 Low Power Modes
- STM32 Embedded Voltage Regulators
- STM32 Low Power Run Mode
- STM32 Sleep Mode
- STM32 Deep Sleep (Low Power Sleep) Mode
- STM32 Stop0, Stop1, Stop2 Modes
- STM32 Standby Mode
- STM32 Shutdown Mode
- Wrap Up
STM32 Low Power Modes
By default, the STM32 microcontroller is in Run Mode after a system or a power Reset. Several low-power modes are available to save power when the CPU does not need to be kept running, for example when waiting for an external event.
It is up to the system designer (us) to select the mode that gives the best compromise between low-power consumption, short startup time, and available wakeup sources.
Note That only the Ultra-Low-Power product line of the STM32 family (STM32Lxx, STM32Uxx) supports all of the low-power modes listed below. Different lines of STM32 microcontrollers will support some of those modes and might not have all of them available in the same target microcontroller.
List of all STM32 Low Power Modes:
- Low Power Run Mode
- Sleep Mode
- Deep Sleep (Low Power Sleep) Mode
- Stop0, Stop1, Stop2 Modes
- Standby Mode
- Shutdown Mode
Below is a state diagram that shows you the possible transitions for STM32 low-power modes.
In addition to those 8 different low-power modes, we can still reduce the system’s power consumption even if we don’t want to use any of these low-power modes and keep the CPU in Run Mode. Here is how we can reduce power consumption in run mode without switching to any of the low-power modes listed above:
- Reducing the SYSCLK frequency will directly lower the power consumption (if it’s feasible and your CPU will meet all timing requirements of the app)
- Gating the clock going to the APB and AHB peripherals (if not being used)
We’ll discuss each STM32 Low Power Mode briefly hereafter one by one and we’ll dig deeper into each mode in a dedicated tutorial in this series. Links to all tutorials of this series will be at the end of this article.
STM32 Embedded Voltage Regulators
There are two embedded linear voltage regulators that supply most of the digital circuitries in STM32 microcontrollers: the main regulator (MR) and the low-power regulator (LPR).
- MR is used in the Run and Sleep modes and in the Stop 0 mode.
- LPR is used in Low-power run, Low-power sleep, Stop 1 and Stop 2 modes. It is also used to supply the 32 Kbyte SRAM2 in Standby with SRAM2 retention.
Both regulators are turned OFF in Standby and Shutdown modes; The regulator output is in high impedance, and the kernel circuitry is powered down thus inducing zero power consumption.
The main regulator has two possible programmable voltage ranges:
- Range 1: with the CPU running at up to Max frequency.
- Range 2: with a lower CPU frequency (i.e. 26MHz). All peripheral clocks are also limited to that lower frequency.
Let’s consider the target device (STM32L432KC) for example and keep it as a reference for comparison between all low-power modes.
By referencing its datasheet, we can see the following.
In Run Mode, using range 1 voltage scaling and a SysClk of 80MHz, we can expect a maximum current draw of 8.5mA.
Using range 2 and a minimum SysClk of 100kHz, we can expect a current draw of 0.12mA.
And keep in mind, this is while we’re still in Run Mode. Let’s keep going through the rest of the low-power modes and check the numbers.
STM32 Low Power Run Mode
This mode is achieved by reducing the system clock frequency (SYSCLK) below 2 MHz. The code is executed from the SRAM or the flash memory. The regulator is in low-power mode to minimize its operating current.
For the STM32L432KC target microcontroller, in Low-Power Run Mode, the current consumption is:
- At 2MHz: 211µA
- At 100kHz: 30µA
After entering this mode, the CPU has no way to check the clock frequency. This means you can “theoretically” increase it a bit more beyond the 2MHz limit. However, it’s not recommended by the datasheet nor guaranteed to work in a stable manner.
STM32 Sleep Mode
In Sleep mode, the CPU clock is OFF and there is no effect on other clocks or analog clock sources. All peripherals continue to operate and can wake up the CPU when an interrupt/event occurs.
For the STM32L432KC target microcontroller, in Sleep Mode, the current consumption is:
- At voltage scaling Range 1 & SysCLK=80MHz, the current draw is 2.23mA
- At voltage scaling Range 2 & SysCLK=100kHz, the current draw is 0.11mA
While debugging a target MCU in sleep mode, make sure you’re working in Range 1 by checking the voltage regulator scale configuration in CubeMX.
STM32 Deep Sleep (Low Power Sleep) Mode
This mode is entered from the Low-power run mode. Only the CPU clock is stopped. When wake-up is triggered by an event or an interrupt, the system reverts to the Low-power run mode.
Unlike Sleep mode, in Low-power sleep mode (Deep Sleep): the main regulator is OFF and the low-power regulator is ON.
For the STM32L432KC target microcontroller, in Low-Power Sleep (Deep Sleep) Mode, the current consumption is:
- At 2MHz: 72µA
- At 100kHz: 23µA
Unlike the STM32 sleep mode, while the target MCU is in the deep sleep (low-power sleep) mode, it’s not possible to start a debugging session. Due to the fact that the CPU core is no longer clocked during low-power mode so debugging features are disabled.
STM32 Stop0, Stop1, Stop2 Modes
Stop mode achieves the lowest power consumption while retaining the content of SRAM and registers. All clocks in the VCORE domain are stopped, and the PLL, the MSI RC, the HSI16 RC, and the HSE crystal oscillators are disabled. The LSE or LSI can be kept running.
Stop 1 offers the largest number of active peripherals and wake-up sources, a smaller wake-up time but a higher consumption than Stop 2.
In Stop 2 mode, most of the VCORE domain is put in a lower leakage mode.
For the STM32L432KC target microcontroller, in Stop Modes, the current consumption is:
- Stop0 mode at 25°C and VDD = 3.6V, the current consumption should be 114μA
- Stop1 mode at 25°C and VDD = 3.6V, the current consumption should be 4.56μA
- Stop2 mode at 25°C and VDD = 3.6V, the current consumption should be 1.23μA
STM32 Standby Mode
The STM32 Standby mode is used to achieve the lowest power consumption with a brown-out reset. The internal regulator is switched OFF so that the VCORE domain is powered off. The PLL, the MSI RC, the HSI16 RC, and the HSE crystal oscillators are also switched OFF.
The RTC can remain active (Standby mode with RTC, Standby mode without RTC). Brown-out reset (BOR) always remains active in the Standby mode. The state of each I/O during standby mode can be selected by software: I/O with internal pull-up, internal pull-down, or floating.
The system can be woken up from standby mode using a SYS_WKUP pin, an RTC event (alarm or timer), IWDG, or an external reset in the NRST pin. After waking up from Standby mode, program execution restarts in the same way as after a Reset (boot pin sampling, option bytes loading, reset vector is fetched, etc.).
For the STM32L432KC target microcontroller, in Standby Mode, the current consumption is:
- Standby Mode at 25°C and VDD = 3V, the current consumption should be 90nA
When exiting Standby or Shutdown mode, all registers in the VCORE domain are set to their reset value.
STM32 Shutdown Mode
The STM32 Shutdown mode allows us to achieve the lowest power consumption. The internal regulator is switched OFF so that the VCORE domain is powered off. The PLL, the HSI16, the MSI, the LSI, and the HSE oscillators are also switched OFF.
The system can be woken up from shutdown mode using a SYS_WKUP pin, an RTC event (alarm or timer), or an external reset in the NRST pin. After waking up from Shutdown mode, program execution restarts in the same way as after a Reset (boot pin sampling, option bytes loading, reset vector is fetched, etc.).
For the STM32L432KC target microcontroller, in Shutdown Mode, the current consumption is:
- Shutdown Mode at 25°C and VDD = 3V, the current consumption should be 44.3nA
This is the minimum power consumption we could ever achieve with this target microcontroller.
All current consumption numbers mentioned in this article are referenced to the STM32L432KC microcontroller’s datasheet. Which has been our reference device to compare between various low-power modes of operation in this article.
Required Parts For STM32 Examples
All the example Code/LABs/Projects in this STM32 Series of Tutorials are done using the Dev boards & Electronic Parts Below:
QTY. | Component Name | Amazon.com | AliExpress | eBay |
1 | STM32-F103 BluePill Board (ARM Cortex-M3 @ 72MHz) | Amazon | AliExpress | eBay |
1 | Nucleo-L432KC (ARM Cortex-M4 @ 80MHz) | Amazon | AliExpress | eBay |
1 | ST-Link V2 Debugger | Amazon | AliExpress | eBay |
2 | BreadBoard | Amazon | AliExpress | eBay |
1 | LEDs Kit | Amazon & Amazon | AliExpress | eBay |
1 | Resistors Kit | Amazon & Amazon | AliExpress | eBay |
1 | Capacitors Kit | Amazon & Amazon | AliExpress & AliExpress | eBay & eBay |
1 | Jumper Wires Pack | Amazon & Amazon | AliExpress & AliExpress | eBay & eBay |
1 | Push Buttons | Amazon & Amazon | AliExpress | eBay |
1 | Potentiometers | Amazon | AliExpress | eBay |
1 | Micro USB Cable | Amazon | AliExpress | eBay |
★ Check The Links Below For The Full Course Kit List & LAB Test Equipment Required For Debugging ★
Wrap Up
In conclusion, we’ve explored all the STM32 low power modes, what does each mode do to reduce the current consumption, and what are the current consumption numbers for each mode using the same target microcontroller (STM32L432KC).
This tutorial has been the first part of a series of tutorials on STM32 Low Power Modes. In the next tutorials, you’ll find example code projects that show you how to enter and exit each of these low-power modes. Check it out using the links below!