STM32CubeMX

Table Of Contents

- STM32CubeMX documentation
- CubeMX User Manual
  - 1 STM32Cube overview
  - 2 Getting started with STM32CubeMX
  - 3 Installing and running STM32CubeMX
  - 4 STM32CubeMX user interface
  - 5 STM32CubeMX tools
  - 6 STM32CubeMX C Code generation overview
  - 7 Code generation for dual-core MCUs (STM32H7 dual-core product lines only)
  - 8 Code generation with TrustZone enabled (STM32L5 series only)
  - 9 Device tree generation (STM32MPUs only)
  - 10 Support of additional software components using CMSIS-Pack standard
  - 11 Tutorial 1: From pinout to project C code generation using an MCU of the STM32F4 series
  - 12 Tutorial 2 - Example of FatFs on an SD card using STM32429I-EVAL evaluation board
  - 13 Tutorial 3 - Using the Power Consumption Calculator to optimize the embedded application consumption and more
  - 14 Tutorial 4 - Example of UART communications with an STM32L053xx Nucleo board
  - 15 Tutorial 5: Exporting current project configuration to a compatible MCU
  - 16 Tutorial 6 - Adding embedded software packs to user projects
  - 17 Tutorial 7 - Using the X-Cube-BLE1 software pack
  - 18 Creating LPBAM projects
  - Appendix A STM32CubeMX pin assignment rules
  - Appendix B STM32CubeMX C code generation design choices and limitations
  - Appendix C STM32 microcontrollers power consumption parameters
  - Appendix D STM32Cube embedded software packages
  - Revision history
- Release Notes
  - Release details
  - Release fixes
  - Known limitations
    - Miscellaneous
    - 2.1. When selecting microcontrollers in the STM32C0 series
    - 2.2. When selecting microcontrollers in the STM32G0 series
    - 2.3. When selecting microcontrollers in the STM32G4 series
    - 2.4. When selecting microcontrollers in the STM32H5 series
    - 2.5. When selecting microcontrollers in the STM32H7 series
    - 2.6. When selecting dual-core microcontrollers in the STM32H7 series
    - 2.7. When selecting microcontrollers in the STM32L5 series
    - 3.4. How to improve the wake-up from Stop sequences without relying on the global SystemClock_Config()
    - 3.3. List pinout-compatible microcontrollers
    - 3.2. DDR binaries for the STM32MP1 boards
    - 3.1. Command line authentication required
    - 2.21. Symbolic links on Ubuntu
    - 2.20. User manual
    - 2.19. DDR test suite
    - 2.18. STM32CubeIDE toolchain
    - 2.13. When selecting microcontrollers in the STM32WL series
    - 2.11. When selecting microcontrollers in the STM32WB series
    - 2.17. When using additional software packs
    - 2.16. When using the Example Selector
    - 2.15. When using the Memory Management Tool
    - 2.14. When selecting microprocessors in the STM32MP1 series
    - 2.11.1. When selecting microcontrollers in the STM32WB0 product lines
    - 2.12. When selecting microcontrollers in the STM32WBA series
    - 2.13.1. When selecting microcontrollers in the STM32WL33 product lines
    - 2.10. When selecting microcontrollers in the STM32U5 series
    - 2.9. When selecting microcontrollers in the STM32U3 series
    - 2.8. When selecting microcontrollers in the STM32N6 series
- Running STM32CubeMX in command-line mode
- FAQ
- Community

# Appendix C STM32 microcontrollers power consumption parameters

This section provides an overview on how to use STM32CubeMX Power Consumption Calculator.

> Microcontroller power consumption depends on chip size, supply voltage, clock frequency and operating mode. Embedded applications can optimize STM32 MCU power consumption by reducing the clock frequency when fast processing is not required and choosing the optimal operating mode and voltage range to run from. A description of STM32 power modes and voltage range is provided below.

> C.1 Power modes

> STM32 MCUs support different power modes (refer to STM32 MCU datasheets for full details).

> C.1.1 STM32L1 series

> STM32L1 microcontrollers feature up to 6 power modes, including 5 low-power modes:

> • Run mode

> This mode offers the highest performance using HSE/HSI clock sources. The CPU runs up to 32 MHz and the voltage regulator is enabled.

> • Sleep mode

> This mode uses HSE or HSI as system clock sources. The voltage regulator is enabled and the CPU is stopped. All peripherals continue to operate and can wake up the CPU when an interrupt/event occurs.

> • Low- power run mode

> This mode uses the multispeed internal (MSI) RC oscillator set to the minimum clock frequency (131 kHz) and the internal regulator in low-power mode. The clock frequency and the number of enabled peripherals are limited.

> • Low-power sleep mode

> This mode is achieved by entering Sleep mode. The internal voltage regulator is in lowpower mode. The clock frequency and the number of enabled peripherals are limited. A typical example would be a timer running at 32 kHz.

> When the wake-up is triggered by an event or an interrupt, the system returns to the Run mode with the regulator ON.

> > • Stop mode

> This mode achieves the lowest power consumption while retaining RAM and register contents. Clocks are stopped. The real-time clock (RTC) an be backed up by using LSE/LSI at 32 kHz/37 kHz. The number of enabled peripherals is limited. The voltage regulator is in low-power mode.

> The device can be woken up from Stop mode by any of the EXTI lines.

> • Standby mode

> This mode achieves the lowest power consumption. The internal voltage regulator is switched off so that the entire V CORE domain is powered off. Clocks are stopped and the real-time clock (RTC) can be preserved up by using LSE/LSI at 32 kHz/37 kHz.

> STM32 microcontrollers power consumption parameters

> RAM and register contents are lost except for the registers in the Standby circuitry. The number of enabled peripherals is even more limited than in Stop mode.

> The device exits Standby mode upon reset, rising edge on one of the three WKUP pins, or if an RTC event occurs (if the RTC is ON).

> Note: When exiting Stop or Standby modes to enter the Run mode, STM32L1 MCUs go through a

> state where the MSI oscillator is used as clock source. This transition can have a significant impact on the global power consumption. For this reason, the Power Consumption Calculator introduces two transition steps: WU_FROM_STOP and WU_FROM_STANDBY . During these steps, the clock is automatically configured to MSI.

> C.1.2 STM32F4 series

> STM32F4 microcontrollers feature a total of 5 power modes, including 4 low-power modes:

> > • Run mode

> This is the default mode at power-on or after a system reset. It offers the highest performance using HSE/HSI clock sources. The CPU can run at the maximum frequency depending on the selected power scale.

> • Sleep mode

> Only the CPU is stopped. All peripherals continue to operate and can wake up the CPU when an interrupt/even occurs. The clock source is the clock that was set before entering Sleep mode.

> • Stop mode

> This mode achieves a very low power consumption using the RC oscillator as clock source. All clocks in the 1.2 V domain are stopped as well as CPU and peripherals. PLL, HSI RC and HSE crystal oscillators are disabled. The content of registers and internal SRAM are kept.

> The voltage regulator can be put either in normal Main regulator mode (MR) or in Lowpower regulator mode (LPR). Selecting the regulator in low-power regulator mode increases the wake-up time.

> The flash memory can be put either in Stop mode to achieve a fast wake-up time. or in Deep power-down to obtain a lower consumption with a slow wake-up time.

> The Stop mode features two sub-modes:

> – Stop in Normal mode (default mode)

> In this mode, the 1.2 V domain is preserved in nominal leakage mode and the minimum V12 voltage is 1.08 V.

> – Stop in Under-drive mode

> In this mode, the 1.2 V domain is preserved in reduced leakage mode and V12 voltage is less than 1.08 V. The regulator (in Main or Low-power mode) is in under-drive or low-voltage mode. The flash memory must be in Deep-power-down mode. The wake-up time is about 100 µs higher than in normal mode.

> • Standby mode

> This mode achieves very low power consumption with the RC oscillator as a clock source. The internal voltage regulator is switched off so that the entire 1.2 V domain is powered off: CPU and peripherals are stopped. The PLL, the HSI RC and the HSE crystal oscillators are disabled. SRAM and register contents are lost except for registers in the backup domain and the 4-byte backup SRAM when selected. Only RTC and LSE oscillator blocks are powered. The device exits Standby mode when an external reset (NRST pin), an IWDG reset, a rising edge on the WKUP pin, or an RTC alarm/ wake-up/tamper/time stamp event occurs.

> > • VBAT operation

> It allows to significantly reduced power consumption compared to the Standby mode. This mode is available when the V BAT pin powering the Backup domain is connected to an optional standby voltage supplied by a battery or by another source. The V BAT domain is preserved (RTC registers, RTC backup register and backup SRAM) and RTC and LSE oscillator blocks powered. The main difference compared to the Standby mode is external interrupts and RTC alarm/events do not exit the device from V BAT operation. Increasing V DD to reach the minimum threshold does.

> C.1.3 STM32L0 series

> STM32L0 microcontrollers feature up to 8 power modes, including 7 low-power modes to achieve the best compromise between low-power consumption, short startup time and available wake-up sources:

> • Run mode

> This mode offers the highest performance using HSE/HSI clock sources. The CPU can run up to 32 MHz and the voltage regulator is enabled.

> • Sleep mode

> This mode uses HSE or HSI as system clock sources. The voltage regulator is enabled and only the CPU is stopped. All peripherals continue to operate and can wake up the CPU when an interrupt/event occurs.

> • Low-power run mode

> This mode uses the internal regulator in low-power mode and the multispeed internal (MSI) RC oscillator set to the minimum clock frequency (131 kHz). In Low-power run mode, the clock frequency and the number of enabled peripherals are both limited.

> • Low-power sleep mode

> This mode is achieved by entering Sleep mode with the internal voltage regulator in low-power mode. Both the clock frequency and the number of enabled peripherals are limited. Event or interrupt can revert the system to Run mode with regulator on.

> • Stop mode with RTC

> The Stop mode achieves the lowest power consumption with, while retaining the RAM, register contents and real time clock. The voltage regulator is in low-power mode. LSE or LSI is still running. All clocks in the V CORE domain are stopped, the PLL, MSI RC, HSE crystal and HSI RC oscillators are disabled.

> Some peripherals featuring wake-up capability can enable the HSI RC during Stop mode to detect their wake-up condition. The device can be woken up from Stop mode by any of the EXTI line, in 3.5 µs, and the processor can serve the interrupt or resume the code.

> • Stop mode without RTC

> This mode is identical to “Stop mode with RTC “, except for the RTC clock which is stopped here.

> • Standby mode with RTC

> The Standby mode achieves the lowest power consumption with the real time clock running. The internal voltage regulator is switched off so that the entire V CORE domain STM32 microcontrollers power consumption parameters

> is powered off. The PLL, MSI RC, HSE crystal and HSI RC oscillators are also switched off. The LSE or LSI is still running.

> After entering Standby mode, the RAM and register contents are lost except for registers in the Standby circuitry (wake-up logic, IWDG, RTC, LSI, LSE crystal 32 kHz oscillator, RCC_CSR register).

> The device exits Standby mode in 60 µs when an external reset (NRST pin), an IWDG reset, a rising edge on one of the three WKUP pins, RTC alarm (Alarm A or Alarm B), RTC tamper event, RTC timestamp event or RTC wake-up event occurs.

> • Standby mode without RTC

> This mode is identical to Standby mode with RTC, except that the RTC, LSE and LSI clocks are stopped.

> The device exits Standby mode in 60 µs when an external reset (NRST pin) or a rising edge on one of the three WKUP pin occurs.

> Note: The RTC, the IWDG, and the corresponding clock sources are not stopped automatically by entering Stop or Standby mode. The LCD is not stopped automatically by entering Stop mode.

> C.2 Power consumption ranges

> STM32 MCUs power consumption can be further optimized thanks to the dynamic voltage scaling feature: the main internal regulator output voltage V12 that supplies the logic (CPU, digital peripherals, SRAM and flash memory) can be adjusted by software by selecting a power range (STM32L1 and STM32L0) or power scale (STM32 F4).

> Power consumption range definitions are provided below (refer to STM32 MCU datasheets for full details).

> C.2.1 STM32L1 series features three VCORE ranges

> • High performance Range 1 (V DD range limited to 2.0-3.6 V), with the CPU running at up to 32 MHz

> The voltage regulator outputs a 1.8 V voltage (typical) as long as the V DD input voltage is above 2.0 V. Flash program and erase operations can be performed.

> • Medium performance Range 2 (full V DD range), with a maximum CPU frequency of

> 16 MHz

> At 1.5 V, the flash memory is still functional but with medium read access time. Program and erase operations are still possible.

> • Low performance Range 3 (full V DD range), with a maximum CPU frequency limited to

> 4 MHz (generated only with the multispeed internal RC oscillator clock source)

> At 1.2 V, the flash memory is still functional but with slow read access time. Program and erase operations are no longer available.

> C.2.2 STM32F4 series features several VCORE scales

> The scale can be modified only when the PLL is OFF and when HSI or HSE is selected as system clock source.

> • Scale 1 (V12 voltage range limited to 1.26 - 1.40 V), default mode at reset.

> HCLK frequency range = 144 MHz to 168 MHz (180 MHz with over-drive).

> This is the default mode at reset.

> • Scale 2 (V12 voltage range limited to 1.20 - 1.32 V).

> HCLK frequency range is up to 144 MHz (168 MHz with over-drive).

> • Scale 3 (V12 voltage range limited to 1.08 - 1.20 V), default mode when exiting Stop mode.

> HCLK frequency ≤120 MHz.

> The voltage scaling is adjusted to f HCLK frequency as follows:

> • STM32F429x/39x MCUs:

> – Scale 1: up to 168 MHz (up to 180 MHz with over-drive) – Scale 2: from 120 to 144 MHz (up to 168 MHz with over-drive) – Scale 3: up to 120 MHz.

> • STM32F401x MCUs:

> No Scale 1

> – Scale 2: from 60 to 84 MHz – Scale 3: up to 60 MHz.

> • STM32F40x/41x MCUs:

> – Scale 1: up to 168 MHz

> – Scale 2: up to 144 MHz

> C.2.3 STM32L0 series features three VCORE ranges

> • Range 1 (V DD range limited to 1.71 to 3.6 V), with CPU running at a frequency up to

> 32 MHz

> • Range 2 (full V DD range), with a maximum CPU frequency of 16 MHz

> • Range 3 (full V DD range), with a maximum CPU frequency limited to 4.2 MHz.

> STM32Cube embedded software packages