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:

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.

../../_images/Figure_435._Pinout_view_-_Enabling_the_RTC.webp

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.

../../_images/Figure_436._Pinout_view_-_Enabling_LSE_and_HSE_clocks.webp ../../_images/Figure_435._Pinout_view_-_Enabling_the_RTC.webp

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.