5 STM32CubeMX tools ¶
This window displays STM32CubeMX version information. To open it, select Help > About from the STM32CubeMX menu bar.
5 STM32CubeMX tools
5.1 External Tools
This panel is accessible from the home page. It provides an overview of the tools relevant for the STM32 product portfolio (see Figure 356):
5.2 Compare Projects
This new feature is designed to enable the comparison of two projects, based on the same or on different microcontrollers. This tool allows users to efficiently analyze and correlate similarities and differences in IP configurations and project structure between two projects.
5.2.1 User interface of the Compare Projects tool
The user can activate this function from the Tools panel by clicking the Compare Projects field (see Figure 357), or from the home page (see Figure 358) by clicking ACCESS TO COMPARE PROJECT under Other services (even before creating any project).
Figure 357. Reaching Compare Project from the Tools panel
The tool is composed of:
• Two main panels, named Project 1 and Project 2.
– Each field contains a “Browse” button from where we can load the desired .ioc file.
– The check box “Use Current project” in the first panel is to use the opened project in STM32CubeMX instead of loading a saved one in the local device.
• Three check boxes, named Project 1, Project 2, and “Show differences only”:
– Once the second project is loaded, the Project 1 and Project 2 check boxes are checked systematically, indicating that the output table contains all the parameters of Project 1 and Project 2 (whether they are different or not).
– If the user wants to see only the parameters that are different between the two projects, it can check “Show differences only”.
• Refresh button: once clicked, it performs an instantiated comparison. • Export button: allows users to save or transfer the result of the comparison to an external file in Excel format.
Figure 359. User interface of the Compare Projects tool
1. Load the first project from the local device ( Figure 360).
– Once the first .ioc is loaded, a popup appears to indicate the need to upload the second .ioc.
2. Load the second project ( Figure 361).
– After uploading the second .ioc file, the output is displayed in the UI ( Figure 362).
– If the user uploads the same .ioc file (having the same path) into the two fields, a popup appears to indicate that it is irrelevant to perform a comparison ( Figure 363).
– If the two projects have the same structure and the user checks “Show differences only”, only the headers of the respective tables “Target”, “Peripherals & Middleware”, and “Project Settings” are shown, no data are displayed ( Figure 364).
Figure 364. The result of comparing two projects having the same structure
The user has the following options for comparing a current project:
1. Load a project from local and start comparing it as the current project (Project 1).
2. Compare a newly created project (after configuration), even unsaved, with a saved project, see Figure 365.
3. Compare a currently open project with itself (the popup blocking the comparison of two similar projects does not appear), see Figure 366:
a) Load a the first project saved on the local as the current project (current project automatically ticked and the configuration can be modified after loading)
b) Load the same project file from the local in the Project 2 field.
Figure 365. Compare the current non saved project with another project
5.2.3 The output of the comparison
After starting the comparison, the following elements are added to the UI:
Target table ( Figure 367): provides a comparison of the parameters used in each project. It clearly shows differences in:
• Part numbers
• Number of IOs
• Package types
• Core configurations
• Available flash memory sizes
The Target table is composed of 3 column:
• Structure: a listing of the MCU parameters.
• Project 1: the values corresponding to the MCU parameters of the first project.
• Project 2: the values corresponding to the MCU parameters of the second project.
The user has the option to:
• Side-by-side comparison: showing data from both projects simultaneously.
• Individual inspection: inspect each file separately by selecting the Project 1 or Project 2 checkbox.
• Focus on differences: exclusively view the differences between 2 projects by checking ‘Show differences only’.
The Target table offers a quick and straightforward overview of key differences between the two projects. It represents an invaluable tool for project migrations and initial hardware evaluations.
Peripherals & Middleware table ( Figure 368): displays the differences and similarities in the configuration of each peripheral or middleware used in the two projects (the subparameters and the corresponding values).
The data are presented by lines. It is composed of the following columns:
• Category name
• IP name
• Mode
• Parameters settings
• Project 1
• Project 2
The table includes a highlighting feature, which uses color coding to visually differentiate parameters:
• Specific parameters for project 1 are marked in blue color
• Specific parameters for project 2 are marked in pink color
• The common parameters for the two projects are marked in black color
All peripheral categories are displayed collectively, with the option of sorting in alphabetical order.
Project Settings table ( Figure 369), helping the users to know the software environment required for each project, and to determine the necessary tools for ensuring project compatibility and facilitating migration. The table contains information about the firmware package used for each MCU and about the toolchain used for building each project.
It is composed of three columns:
• Settings:
– CustomerFirmwarePackage
– FirmewarePackage
– ProjectStructure
– TargetToolchain
• Project 1
• Project 2
Figure 369. Project Settings table
5.2.4 Saving the comparison result of the two projects
In the user interface of the “Compare Projects” tool, there is an Export button that allows users to save the result of the comparison in an external Excel file.
By clicking the Export button, a window named Save appears to allow the user to choose a name for the resulting file and save it ( Figure 370).
The available format:
• The result is exported into three sheets in an Excel format ( Figure 371).
• Each sheet represents a table (Target, Peripherals & Middleware, Projects Settings).
If the user wants to get only the differences in the exported file, they should click on “Show differences only”.
Figure 370. Choosing the Excel format to save the comparison result
Figure 372. Comparison result in Excel format - Peripherals and middleware
5.3 Power Consumption Calculator view
For an ever-growing number of embedded systems applications, power consumption is a major concern. To help minimizing it, STM32CubeMX offers the Power Consumption Calculator tab (see Figure 374), which, given a microcontroller, a battery model and a user-defined power sequence, provides the following results:
• Average current consumption
Power consumption values can be taken from the datasheet or interpolated from a user specified bus or core frequency.
• Battery life
• Average DMIPs
DMIPs values are directly taken from the MCU datasheet and are neither interpolated nor extrapolated.
• Maximum ambient temperature (T AMAX )
According to the chip internal power consumption, the package type, and a maximum junction temperature of 105 °C, the tool computes the maximum ambient temperature to ensure good operating conditions.
Current T AMAX implementation does not account for I/O consumption. For an accurate estimate, I/O consumption must be specified using the Additional Consumption field. The formula for I/O dynamic current consumption is specified in the microcontroller datasheet.
The Power Consumption Calculator view allows developers to visualize an estimate of the embedded application consumption and lower it further at each power sequence step:
• make use of low power modes when available
• adjust clock sources and frequencies based on the step requirements • enable only the peripherals necessary for each phase.
For each step the user can choose V BUS as possible power source instead of the battery, impact battery life. If power consumption measurements are available at different voltage levels, STM32CubeMX also proposes a choice of voltage values (see Figure 377).
An additional option, the transition checker, is available for STM32L0, STM32L1, STM32L4, STM32L4+, STM32G0, STM32G4, STM32H7 and STM32WB series. When enabled, the transition checker detects invalid transitions within the currently configured sequence. It ensures that only possible transitions are proposed to the user when a new step is added.
5.3.1 Building a power consumption sequence
The default starting view is shown in Figure 374.
Figure 374. Power Consumption Calculator default view
Selecting a VDD value
From this view and when multiple choices are available, the user must select a V DD value.
Selecting a battery model (optional)
Optionally, the user can select a battery model. This can also be done once the power consumption sequence is configured.
The user can select a predefined battery or choose to specify a new battery that best matches its application (see Figure 375).
Figure 375. Battery selection
Power sequence default view
The user can now proceed and build a power sequence.
Managing sequence steps
Steps can be reorganized within a sequence ( Add new, Delete a step, Duplicate a step, move Up or Down in the sequence) using the set of Step buttons (see Figure 376).
The user can undo or redo the last configuration actions by clicking the Undo button in the Power Consumption Calculator view or the Undo icon from the main toolbar
Figure 376. Step management functions
Adding a step
There are two ways to add a new step:
• Click Add in the Power Consumption panel. The New Step window opens with empty step settings.
• Or, select a step from the sequence table and click Duplicate. A New Step window opens duplicating the step settings (see Figure 377).
Figure 377. Power consumption sequence: New Step default view
Once a step is configured, resulting current consumption and T AMAX values are provided in the window.
Editing a step
To edit a step, double-click it in the sequence table, this opens the Edit Step window.
Moving a step
By default, a new step is added at the end of a sequence. Click the step in the sequence table to select it and use the Up and Down buttons to move it elsewhere in the sequence. Deleting a step
Select the step to be deleted and click the Delete button.
Using the transition checker
Not all transitions between power modes are possible. The Power Consumption Calculator power menu proposes a transition checker to detect invalid transitions or restrict the sequence configuration to only valid transitions.
Enabling the transition checker option prior to sequence configuration ensures that the user will be able to select only valid transition steps.
Enabling the transition checker option on an already configured sequence will highlight the sequence with a green frame if all transitions are valid (see Figure 378), or in fuchsia if at least one transition is invalid (fuchsia frame with description of invalid step highlighted in fuchsia, see Figure 379). In the latter case, the user can click the Show log button to find out how to solve the transition issue (see Figure 380).
Figure 378. Enabling the transition checker option on an already configured sequence - All transitions valid
Figure 379. Enabling the transition checker option on an already configured sequence - At least one transition invalid
5.3.2 Configuring a step in the power sequence
The step configuration is performed from the Edit Step and New Step windows. The graphical interface guides the user by forcing a predefined order for setting parameters.
Their naming may differ according to the selected MCU series. For details on each parameter, refer to glossary in Section 5.3.4 and to Appendix C, or to the electrical characteristics section of the datasheet.
The parameters are set automatically by the tool when there is only one possible value (in this case, the parameter cannot be modified and is grayed out). The tool proposes only the configuration choices relevant to the selected MCU.
To configure a new step:
1. Click Add or Duplicate to open the New step window or double-click a step from the sequence table to open the Edit step window.
2. Within the open step window, select in the following order:
– The Power Mode
Changing the Power Mode resets the whole step configuration.
– The Peripherals
Peripherals can be selected/deselected at any time after the Power Mode is configured.
– The Power scale
The power scale corresponds to the power consumption range (STM32L1) or the power scale (STM32F4).
Changing the Power Mode or the Power Consumption Range discards all subsequent configurations.
– The Memory Fetch Type
– The V DD value if multiple choices available
– The voltage source (battery or VBUS)
– A Clock Configuration
Changing the Clock Configuration resets the frequency choices further down.
– When multiple choices are available, the CPU Frequency (STM32F4) and the AHB Bus Frequency/CPU Frequency (STM32L1) or, for active modes, a user specified frequency. In this case, the consumption value will be interpolated (see Using interpolation).
3. Optionally set
– A step duration (1 ms is the default value)
– An additional consumption value (expressed in mA) to reflect, for example, external components used by the application (external regulator, external pull-up, LEDs or other displays). This value added to the microcontroller power consumption will impact the step overall power consumption.
4. Once the configuration is complete, the Add button becomes active. Click it to create the step and add it to the sequence table.
Using interpolation
For steps configured for active modes (Run, Sleep), frequency interpolation is supported by selecting CPU frequency as User Defined and entering a frequency in Hz (see Figure 381).
Figure 381. Interpolated power consumption
Importing pinout
Figure 382 illustrates the example of the ADC configuration in the Pinout view: clicking Enable IPs from Pinout in the Power Consumption Calculator view selects the ADC peripheral and GPIO A ( Figure 383).
The Enable IPs from Pinout button allows the user to automatically select the peripherals that have been configured in the Pinout view.
Selecting/deselecting all peripherals
Clicking Enable All IPs allows the user to select all peripherals at once.
Clicking Disable All IPs removes them as contributors to the consumption.
Figure 383. Power Consumption Calculator configuration window:
ADC enabled using import pinout
5.3.3 Managing user-defined power sequence and reviewing results
The configuration of a power sequence leads to an update of the Power Consumption Calculator view (see Figure 384):
• The sequence table shows all steps and step parameters values. A category column indicates whether the consumption values are taken from the datasheet or are interpolated.
• The sequence chart area shows different views of the power sequence according to a display type (e.g. plot all steps, plot low power versus run modes)
• The results summary provides the total sequence time, the maximum ambient temperature (T AMAX ), plus an estimate of the average power consumption, DMIPS, and battery lifetime provided a valid battery configuration has been selected.
Figure 384. Power Consumption Calculator view after sequence building
Managing the whole sequence (load, save and compare)
From the power menu (see Figure 385), the current sequence can be saved, deleted or compared to a previously saved sequence that will be displayed in a dedicated popup window.
Figure 385. Sequence table management functions
Managing the results charts and display options
In the Display area, select the type of chart to display (e.g. sequence steps, pie charts, consumption per peripherals). You can also click External Display to open the charts in dedicated windows (see Figure 386).
Right-click on the chart to access the contextual menus: Properties, Copy, Save as png picture file, Print, Zoom menus, and Auto Range to reset to the original view before zoom operations. Zooming can also be achieved by mouse selecting from left to right a zone in the chart and Zoom reset by clicking the chart and dragging the mouse to the left.
Figure 386. Power Consumption: Peripherals consumption chart
Overview of the Results summary area
This area provides the following information (see Figure 387):
• Total sequence time, as the sum of the sequence steps durations.
• Average consumption, as the sum of each step consumption weighed by the step duration.
• The average DMIPS (Dhrystone million instructions per second) based on Dhrystone benchmark, highlighting the CPU performance for the defined sequence.
• Battery life estimation for the selected battery model, based on the average power consumption and the battery self-discharge.



















