STM32CubeMX

STM32CubeMX

The ultimate tool to configure and initialize STM32 code

STM32CubeMX enables developers to fully leverage device capabilities and optimize system costs by tailoring resources to application requirements and automating key development tasks.

STM32 series supported

STM32CubeMX
High performance
F2
F4
H5
F7
H7/RS
H7
N6
Mainstream
G0
C0
F0
F1
F3
G4
Ultra-low power
L0
U0
L1
L4
L4+
L5
U3
U5
Wireless
WB
WB0
WBA
WL
Supported MPUs
MP1
MP2
STM32CubeMX2
Mainstream
C5 All new microcontrollers series starting from STM32C5 will work exclusively with STM32CubeMX2.

Main features

STM32CubeMX is a user-friendly configuration and code generation tool for STM32 microcontrollers and microprocessors. It allows developers to generate optimized project outputs in a fast and effective way. 

STM32CubeMX is available in two offerings: STM32CubeMX and STM32CubeMX2, each supporting specific STM32 series.

  • Pinout
  • Clock
  • Peripherals
  • Software components
  • File generation

Pinout configuration

Define your pinout configuration for your overall system.

Pinout configuration

Clock configuration

Visualize the clock tree configuration and use the automatic solver to adapt the clock based on your needs.

Clock configuration

Peripheral configuration

Configure every peripheral for your project initialization while effectively managing hardware resource sharing.

Peripheral configuration

Add software packages​

Manage additional software packages and their dependencies. Add them to your project, and configure them just like any other native peripheral or middleware.

Add software packages​

Configure and generate the project

Finetune your project configuration and select your target IDE toolchain. Finally, generate the C code and include all the selected libraries in your project.​

Configure and generate the project
  • Pinout
  • Clock
  • Peripherals
  • Software components
  • File generation

Pinout configuration

Define your pinout configuration for your overall system.

Pinout configuration

Clock configuration

Visualize the clock tree and its configuration and use the automatic solver to adapt the clock based on your needs.

Clock configuration

Peripheral configuration

Configure every peripheral for your project initialization while effectively managing hardware resource sharing.

Peripheral configuration

Add software packages​

Manage additional software packages and their dependencies. Add them to your project, and configure them just like any other native peripheral or middleware.

Add software packages​

Configure and generate the project

Finetune your project configuration and select your target IDE toolchain. Generate the C code and include all the selected libraries in your project.​

Configure and generate the project

Resources to start your project

Installer
Documentation
Video tutorials Tutorial

STM32CubeMX

All MCU/MPU except STM32C5 Series All new microcontrollers series starting from STM32C5 will work exclusively with STM32CubeMX2

STM32CubeMX2

STM32C5 Series All new microcontrollers series starting from STM32C5 will work exclusively with STM32CubeMX2
Software name Supported hardware ECCN OS Version Action
STM32CubeMX All MCU/MPU except STM32C5 Series All new microcontrollers series starting from STM32C5 will work exclusively with STM32CubeMX2 NEC (EU)
5D992.c (US)
STM32CubeMX2 STM32C5 Series All new microcontrollers series starting from STM32C5 will work exclusively with STM32CubeMX2 NEC (EU)
5D992.c (US)
STMicroelectronics recommends always keeping your software up to date

Frequently asked questions

What is STM32CubeMX?

STM32CubeMX is the free ST graphical configuration tool for developers to easily set up and configure STM32 microcontrollers.

STM32CubeMX allows users to generate and initialize C code for peripherals, and to manage project settings.

What is the difference between STM32CubeMX and STM32CubeMX2?

STM32CubeMX2 is an evolution of STM32CubeMX. It is designed to work with MCUs that use the HAL2 software layer.

STM32CubeMX2 introduces enhancements such as the code preview feature during configuration.

These improvements significantly contribute to increasing design efficiency and user experience.

Which STM32 microcontrollers are supported by STM32CubeMX and STM32CubeMX2?

STM32CubeMX supports all the STM32 MCUs ported on the HAL1 software layer, while STM32CubeMX2 supports the STM32 MCUs ported on the HAL2 software layer.

What is the difference between STM32CubeMX and STM32CubeIDE?

STM32CubeMX is a standalone configuration tool that generates a complete project, compatible with various integrated development environments (IDEs).

STM32CubeIDE is an integrated development environment that allows developers to start their projects using the ones generated by STM32CubeMX, and to work on the application layer before compiling and debugging the project.

How to generate code using STM32CubeMX?

After configuring the peripherals, the clock, and the pins of your STM32 microcontroller using STM32CubeMX, select "Generate Code".

The tool will then produce a C initialization code project, which is compatible with various development environments, such as STM32CubeIDE or Keil MDK.

Can I modify the generated code? Will STM32CubeMX overwrite my changes?

Yes, you can modify the generated code. STM32CubeMX implements "User Code Sections"(marked by USER CODE BEGIN USER CODE END comments).

Any code written within these specific sections will be preserved. It will not be overwritten if the code is regenerated later on.​

For STM32CubeMX2, the new code strategy will separate the STM32CubeMX2 generated code and the user code in different files.

How to update STM32CubeMX to its latest version?

You can update STM32CubeMX directly from within the application.

Navigate to "Help" and "Check for Updates", or go to "Help" and "Manage embedded software packages".

The tool will detect the latest version available and then allow you to download and install it, together with the required microcontroller firmware packages.

Are STM32CubeMX and STM32CubeMX2 available for free?

Yes, they are completely free to download and use, making them accessible tools for both hobbyists and professional developers working with STM32 microcontrollers.

How to download and install STM32CubeMX?

Download the installer for your operating system.

Then run the installer and follow the on-screen instructions to complete the installation process.

What if my question is not listed here?

Visit our online documentation for direct access to additional guidelines, examples, and in-depth articles.