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

### On this page

- STM32CubeMX Tips & Tricks
- STM32CubeMX Frequently Asked Questions
  - 1. How should I proceed if I encounter issues after installing STM32CubeMX on a macOS machine with ARM (Apple Silicon) architecture?
  - 2. How to open the video tutorial “Configuring LPBAM applications on the STM32U5 with STM32CubeMX”?
  - 3. Why is Picolibc set as the default C library for CMake projects?
  - 4. Why were the default compiler optimization levels changed for CMake projects?
  - 5. I encountered some compilation errors when configuring X-CUBE-FREERTOS package in STM32 projects with TrustZone enabled
  - 6. I encountered some issues while configuring X-CUBE-FREERTOS V1.3.1 package in STM32N6 projects across multiple contexts
  - 7. I encountered some issues while configuring USB OTG feature with Azure RTOS in STM32F4 projects
  - 8. I encountered some issues while downloading a firmware package
  - 9. How can STM32CubeMX detect automatically Python’s installation directory?
  - 10. I have trouble authenticating to STM32CubeMX
  - 11. I encountered a network connection error during a download from STM32CubeMX
  - 12. Since I changed my login to access the Internet, some software packs appear not available
  - 13. On dual-context products, why are some peripherals or middleware not available for a given context?
  - 14. On the Pinout configuration panel, why does STM32CubeMX move some functions when I add a new peripheral mode?
  - 15. How can I manually force a function remapping?
  - 16. Why are some pins highlighted in yellow or in light green in the Pinout view? Why can I not change the function of some pins?
  - 17. Why does the RTC multiplexer remain inactive on the Clock tree view?
  - 18. How can I select LSE and HSE as clock source and change the frequency?
  - 19. Why does STM32CubeMX not allow me to configure some pins as outputs?
  - 20. Ethernet configuration: why can I not specify DP83848 or LAN8742A in some cases?
    - Note for STM32H7
  - 21. How to fix MX_DMA_Init call rank in STM32CubeMX generated projects?
    - Important behavior
    - Workaround
  - 22. When is the `PeriphCommonClock_Config()` function generated?
    - When RCC is in LL mode
    - When RCC is in HAL mode
    - Reason
  - 23. How to handle thread-safe solution in STM32CubeMX and STM32CubeIDE?

# FAQ

## STM32CubeMX Tips & Tricks

This page is your go-to destination for quick and practical advice across various issues related to STM32CubeMX.

## STM32CubeMX Frequently Asked Questions

### 1. How should I proceed if I encounter issues after installing STM32CubeMX on a macOS machine with ARM (Apple Silicon) architecture?

For macOS users with ARM-based machines, it is recommended to use the STM32CubeMX installer specifically designed for Apple Silicon:

- `SetupSTM32CubeMX-VERSION-Mac-ARM.app`

Using the ARM-specific installer helps avoid potential post-installation issues on Apple Silicon systems.

### 2. How to open the video tutorial “Configuring LPBAM applications on the STM32U5 with STM32CubeMX”?

The video link provided in STM32CubeMX does not open the tutorial directly. Instead:

1. Click the link in STM32CubeMX.

2. You will be redirected to a page.

3. Click Watch video on YouTube to start the video.

### 3. Why is Picolibc set as the default C library for CMake projects?

For STM32CubeMX projects using CMake, Picolibc is selected as the default C library because it integrates smoothly with the STARM-Clang toolchain, ensuring:

- clean compilation,

- correct linking,

- reliable debugging workflows.

### 4. Why were the default compiler optimization levels changed for CMake projects?

For the debug configuration, the optimization level was changed from `-Os` to `-Oz` to reduce code size even further.

Also, `-Og` is now used instead of `-O0`. This provides a better balance:

- some useful optimizations,

- improved runtime behavior,

- code that remains easy to debug.

### 5. I encountered some compilation errors when configuring X-CUBE-FREERTOS package in STM32 projects with TrustZone enabled

When TrustZone is enabled ( `TZ=1`), it is recommended to activate X-CUBE-FREERTOS in both:

- the secure domain,

- the non-secure domain.

In both domains, CMSIS-RTOS V2 should also be enabled to avoid compilation errors.

### 6. I encountered some issues while configuring X-CUBE-FREERTOS V1.3.1 package in STM32N6 projects across multiple contexts

The X-CUBE-FREERTOS V1.3.1 package in STM32N6 projects cannot be configured in two secure contexts at the same time.

### 7. I encountered some issues while configuring USB OTG feature with Azure RTOS in STM32F4 projects

When creating a project with USB_OTG_FS using the X-CUBE-AZRTOS-F4 package, compilation errors may occur if the peripheral configuration does not match the software package settings.

To avoid issues, make sure the configuration is consistent:

- If USB_OTG_FS is set to device-only mode, select the corresponding USBX device components, not host components.

- If USB_OTG_FS is set to host-only mode, select the corresponding USBX host components, not device components.

### 8. I encountered some issues while downloading a firmware package

If you try to download a firmware package that is not currently installed, a popup may appear with the message:

`Error while moving the downloaded package into repository`

If this happens:

1. Close the popup.

2. Click GENERATE CODE in STM32CubeMX.

3. The package download should resume.

4. You can then regenerate the project successfully.

### 9. How can STM32CubeMX detect automatically Python’s installation directory?

To help STM32CubeMX locate Python automatically, it is recommended to enable:

- Add Python.exe to PATH

during the Python installation process.

This makes Python accessible from the command line and allows STM32CubeMX to detect the installation directory without manual configuration.

### 10. I have trouble authenticating to STM32CubeMX

If you encounter authentication issues in STM32CubeMX, you need to configure your connection parameters.

For more details, refer to:

- https://community.st.com/t5/stm32-mcus/how-to-set-the-network-connection-parameters-for-stm32cubeide/ta-p/585694

### 11. I encountered a network connection error during a download from STM32CubeMX

If a network connection issue occurs during a download:

1. Open Help > Updater settings.

2. Check the current connection status.

3. If needed, click Check connection.

4. Adjust the parameters to match your network configuration.

5. Click Check connection again until the connection is restored.

6. Once the connection displays as successful, proceed with the download.

### 12. Since I changed my login to access the Internet, some software packs appear not available

A practical workaround is to delete the following folder from your user directory:

- `.stm32cubemx`

Then relaunch STM32CubeMX.

Note: any software packs installed using From URL must be installed again.

Additional checks:

- Open Help > Updater settings

- Verify the repository path in the Updater Settings tab

- If a proxy is used, enter your login and password in the Connection Parameters tab

### 13. On dual-context products, why are some peripherals or middleware not available for a given context?

Some peripherals and middleware depend on other components being enabled in the same context.

For example:

- LwIP requires the ETH peripheral to be enabled in the same context.

### 14. On the Pinout configuration panel, why does STM32CubeMX move some functions when I add a new peripheral mode?

This can happen because some pins were deselected, and STM32CubeMX automatically remaps functions to optimize the pin placement.

### 15. How can I manually force a function remapping?

Use the Manual Remapping feature.

### 16. Why are some pins highlighted in yellow or in light green in the Pinout view? Why can I not change the function of some pins?

Those pins are special-purpose pins, such as:

- power supply pins,

- BOOT pins.

They are not available as peripheral signals, so their function cannot be changed.

### 17. Why does the RTC multiplexer remain inactive on the Clock tree view?

To activate the RTC multiplexer, you must first enable the RTC peripheral in the Pinout view.

### 18. How can I select LSE and HSE as clock source and change the frequency?

The LSE and HSE clocks become active once RCC is configured accordingly in the Pinout view.

After that:

- you can edit the clock source frequency,

- you can select the external source.

### 19. Why does STM32CubeMX not allow me to configure some pins as outputs?

STM32CubeMX enforces restrictions documented in the reference manuals.

In particular, PC13, PC14, PC15, and PI8 are powered through a switch that can sink only a limited current. Therefore, their use as output GPIOs is restricted:

- the speed should not exceed `2 MHz`,

- the maximum load should not exceed `30 pF`,

- they must not be used as a current source, for example to drive an LED.

### 20. Ethernet configuration: why can I not specify DP83848 or LAN8742A in some cases?

For most STM32 series, STM32CubeMX adjusts the available PHY drivers according to the selected Ethernet mode:

- MII mode: you can choose DP83848 or User Phy

- RMII mode: you can choose LAN8742A or User Phy

If you select User Phy, you must manually include the component drivers in your project.

#### Note for STM32H7

For STM32H7 series, the PHY is treated as an external component and is not specified directly under Ethernet peripheral configuration.

Instead:

- select the PHY under the LwIP Platform settings tab,

- the interface typically offers User Phy and LAN8742,

- when LAN8742 is selected, the BSP driver code is copied into the generated project.

### 21. How to fix MX_DMA_Init call rank in STM32CubeMX generated projects?

When DMA is used, `MX_DMA_Init()` must always be called before any other `HAL_***_Init()` function for peripherals that depend on DMA initialization.

A regression in STM32CubeMX 6.3.0 caused initialization calls to be generated in the wrong order.

#### Important behavior

- STM32CubeMX 6.4.0 fixed the issue for newly created projects.

- However, existing projects generated with 6.3.0 may still keep the wrong order because it is stored in the `.ioc` file.

#### Workaround

1. Open the `.ioc` file with a text editor.

2. Delete the line:

       ProjectManager.functionlistsort=...

3. Save the file.

4. Reopen it with STM32CubeMX 6.4.0 or later.

5. In Project Manager > Advanced Settings, verify the initialization order.

6. Regenerate the project.

### 22. When is the `PeriphCommonClock_Config()` function generated?

The generation depends on the RCC mode and on how clock domains are used.

#### When RCC is in LL mode

`PeriphCommonClock_Config()` is generated to initialize:

- `ckper` clock, when used by a peripheral on series that support `ckper`

- `pll2`

- `pll3`

- `pllsai1`

- `pllsai2`

#### When RCC is in HAL mode

`PeriphCommonClock_Config()` is generated to initialize:

- `pll2`

- `pll3`

- `pllsai1`

- `pllsai2`

but only when they are used by more than one peripheral.

#### Reason

This function helps split responsibilities:

- `SystemClock_Config()` handles the system clock

- `HAL_MspInit()` / `MX_..._Init()` handle RCC peripheral initialization

The generation differs between HAL and LL because:

- in LL, PLLs are initialized directly,

- in HAL, at least one peripheral must typically be initialized first.

If a PLL is used by only one peripheral, its initialization is done in `HAL_MspInit()` / `MX_..._Init()`. Otherwise, it is placed in `PeriphCommonClock_Config()`.

### 23. How to handle thread-safe solution in STM32CubeMX and STM32CubeIDE?

The application note AN5731, titled “STM32CubeMX and STM32CubeIDE thread-safe solution”, is available on st.com and provides a detailed description of the topic.