STM32 MC Motor Pilot - Start-up guide

Revision as of 16:42, 30 August 2023 by Registered User


Based on STM32 MC Motor Pilot 6.1 V1.1.3 (included in STM32 MC-SDK 6.1).

1. Overview of the STM32 MC Motor Pilot tool

The STM32 MC Motor Pilot is a monitoring tool for STM32 motor-control applications that:

  • connects to MC applications built with the UI module through the serial port
  • uses the new Monitor and Control Protocol (MCPV2)
  • allows for controlling, monitoring, and tuning MC applications
  • replaces the monitor part of STM32 MC workbench 4.X
STM32 MC MotorPilot slide3.png

The added value features of the STM32 MC Motor Pilot are the following :

  • Enhanced plotting feature: the user can now plot most registers.
  • Real time monitoring : registers for each PWM sample can be retrieve, plot and record
  • GUI customization : the user can easily customize the GUI at run time to fit specific needs or to experiment with new firmware features.
  • Solid foundation to support future firmware features (ACIM, 6-Step, sensor-less zero speed, enhanced debug features).
  • Runs on Windows, Mac, and Linux platforms.

2. STM32 MC Motor Pilot quick guide

2.1. Installation and run

STM32 MC Motor Pilot is now automatically installed with STM32 MC SDK.

A shortcut is created on the Windows menu to run it.

2.2. Quick start-up

When you start Motor Pilot for the first time , you can choose 3 different actions:

  • Detecting the connected board.

Motor Pilot tries to communicate on all STLINK Virtual Port COM at 1843200 Mbaud to detect your board. If the detection succeeds, the Motor Pilot loads the corresponding UI.

  • Loading the UI that is dedicated to the FOC SDK profiler.
  • Loading the custom UI.


2.2.1. Quick step 1

If the automatic detection process failed, then press Load UI and select a qml file with the dedicated UI for your application.

At this moment, Motor Pilot is not connected:

STM32 MC MotorPilot slide6 1.png

And it lists the available serial ports:

STM32 MC MotorPilot slide6 2.png


  1. Connect a Motor Control board to the PC.
  2. Select the port and the baudrate according to your apllication.
  3. Click Connect.
STM32 MC MotorPilot slide6 3.png

2.2.2. Quick step 2

  1. Connect Motor Pilot to
  • retrieve the embedded firmware features,
  • retrieve important parameters of motor control from the board and adjust the GUI with such information,
  • start monitoring the parameters needed by the GUI:
    STM32 MC MotorPilot slide3.png
  1. Spin the motor by clicking on the Start button:
    STM32 MC MotorPilot slide7 2.png
  2. Motor starts and the pilot updates the GUI:
    STM32 MC MotorPilot slide7 4.png

2.2.3. Quick step 3

To control the motor, you can perform these actions:

  • Slide the knob to set the speed:
    STM32 MC MotorPilot slide8 1.png
  • Set Target Speed and Duration and click Execute Speed Ramp to apply this ramp :
    STM32 MC MotorPilot slide8 2.png
  • Click Stop Ramp to immediately stop the ramp:
    STM32 MC MotorPilot slide9 1.png
  • Click Stop to stop spinning the motor:
    STM32 MC MotorPilot slide9 2.png
STM32 MC MotorPilot slide9 3.png

3. MC application parameters

The STM32 MC Motor Pilot obtains the MC application parameters from the board and adapts widgets to them.

MC Pilot FOC SDK Config.png

3.1. DAC

If the DAC feature is enabled in the firmware, the DAC widget will be enabled with its corresponding capabilties.

MC Pilot FOC SDK DAC.png

3.2. CPU Performance Measurement

If the MCU Load feature is enabled in the firmware, the CPU Performance Measurement widget will be enabled with its corresponding capabilties.

MC Pilot FOC SDK CPU PERF.png

4. MC application advanced settings

4.1. Speed PID, Toque PID, Flux PID and Flux reference

  1. Click Advanced Configuration to display another panel with additional settings:
    STM32 MC MotorPilot slide11.png
  2. Customize the following settings from this panel:
    • Speed PID
    • Toque PID
    • Flux PID
    • Set Flux reference

Depending of the features available on your firmware, some of the settings can be disabled.

4.2. State Observer, PLL parameters, CORDIC parameters

  1. Click Advanced Configuration to display another panel with additional settings.
  2. You can Customize the following settings from this panel:
  • State Observer + PLL parameters
  • State Observer + CORDIC parameters

Depending of the features available on your firmware, some of the settings can be disabled.

STM32 MC MotorPilot ADVANCED CONFIG.png


4.3. Rev-up configuration

Click on Rev-up tab to display rev-up parameters:

MC Pilot FOC SDK RevUP.png

Then click on Read all to read rev-up parameters from the board.

MC Pilot FOC SDK RevUP2.png
  • This panel allows to set up to 5 rev-up steps by direct edit in the corresponding table for which a step rev-up duration, a final torque value and a final speed value are defined. Use the same values to have less steps.

You can switch display from s16A to Amp but you need to fill current sensing parameters according to your board.

MC Pilot FOC SDK s16Amp.png

4.4. Handling errors

4.4.1. Control Board disconnection

Board freeze due to firmware critical error or breakpoint trigger:

  • Resume execution or reset the board to resume the connection.
STM32 MC MotorPilot Connect ERROR.png

4.4.2. Firmware errors

Current and past errors are indicated as in the example below.

  • In the FAULT_NOW state, the Ack Faults button has no effect.
STM32 MC MotorPilot FAULT NOW.png
  • Once the fault conditions are cleared, enter the FAULT_OVER state.
STM32 MC MotorPilot FAULT OVER.png
  • Click Ack Faults to go back to IDLE.
STM32 MC MotorPilot FAULT ACK.png



4.5. Viewing and plotting registers with low-speed plotting

With this method of plot, plotting any register is possible at low rate (polling every 200 ms by default).

  1. Click the Registers tab to display the list containing all of the registers.
    STM32 Motor Pilot - new picture.png
  2. Click the Configure button to:
MC Pilot FOC register Plot 2.png
  • add register plot into a new plot window,
MC Pilot FOC register Plot 3 send to new plot.png
  • or add it into an existing plot window.
MC Pilot FOC register Plot 4 send to other plot.png


STM32 MC MotorPilot slide16 2.png
  • The user can stop plotting the register:
MC Pilot FOC register Plot 9 stop plot.png

4.6. Viewing and plotting registers with high-speed plotting

Plotting at PWM frequency rate is only possible for a subset of registers with this method of plot.

  • Once the motor is connected and started, click the Plot button:
    STM32 MC MotorPilot plot button.png
  • A High Frequency Plot window opens:
    STM32 MC Motor Pilot plot1.png
  • Click again to open more plot windows.
  • Resize these windows to optimize the display of plots on your desktop.
  • Right-click to select the register to plot:
    STM32 MC Motor Pilot plot2.png
  • Click again to plot more registers:
    STM32 MC Motor Pilot plot3.png
  • The data display width is defined by adjusting the buffer size. Change buffering to display more data.
    STM32 MC Motor Pilot plot4.png
  • When displaying 2 registers, you can switch to the X / Y plot:
    STM32 MC Motor Pilot plot5.png
  • Dynamic plot display can be paused and resumed as desired.
  • Each register plot can be hidden or displayed by double-clicking on the register name in the plot legend. Then, when the register plot is hidden, the corresponding register name is strikethrough.
    STM32 MC Motor Pilot plot6.png


4.7. UI is changeable at run-time

  • Click the File menu item, then Load.
  • Search for a .qml file and open it. For instance, GUI\PositionControlApp.qml found in the release.
  • This loads a new GUI with other features. In the case of PositionControlApp.qml, a position control enabled monitoring application.
STM32 MC MotorPilot slide19.png
  • Users can change the UI by copying any existing ".qml" file and editing it.


5. Motor Profiler

The Motor Profiler software is now integrated to the Motor Pilot as a QML file. It allows the user to:

  • do a basic profiling,
  • do a profiling with the Hall sensors,
  • do a offeset resistance detection,
  • ability to see and change voltage threshold
  • detect the number of Pole pairs with guided detection.


5.1. How to Generate profiler project

In a way to ease the user to profile a motor, the new MCSDK6.2.0 provides an updated efficient manner to generate a Motor Profiler SW binary to answer this requirement.

The new MCSDK WB tool is able to generate a Motor Profiler project based on described boards and the FOC motor control SW. In consequence, there is no more needs to store and update all possible or new Motor Profiler binaries that depend on a HW board set up and different MCU topologies.

The Motor Profiler algorithm is provided into the MCSDK FW as a library linkable and compliable with ARMv7 and ARMv8 architecture. Any kind of IDEs or ARM compilers can be used to generate this Motor Profiler binary. Depending of the IDEs (type of arm compilers i.e. armcc, gcc...), the Motor Profiler algorithm will be embedded into two different libraries. The following table describes these different versions of libraries.

IDE Compiler Arm V7 Motor Profiler Lib ARM V8 Motor Profiler Lib
IAR, Stm32Cube libmp-IAR_ARMv7-M.a libmp-IAR_ARMv8-M.a
Keil libmp-MDK-ARM_ARMv7-M.a libmp-MDK-ARM_ARMv8-M.a

The MCSDK WB tools contains .json board description files. For some power and inverter boards, a resistorOffset parameter is embedded, useful for determinate the resistor rs, one of the electrical parameters of the motor. As soon as one of these kinds of board is described and use for motor profiling, this parameter must be present into its corresponding .json file. If a Motor Profiler FW is generated without resistorOffset parameter described into the power or inverter board selected, a default value equal to -32768 of this parameter will be found into the resulting generated Motor Profiler FW. In consequence, the motor profiling will not be allowed by the Motor Profiler tool. The Motor Profiler tool provides then the ability to compute this missing resistorOffset parameter.

The Motor Profiler tool is a subset of the Motor Pilot tool, and it shares the same interface. This proven and efficient tool allows to connect a control or inverter board and execute the profiling of a motor by computing electrical and mechanical parameters of a motor.

Some of the motor control algorithms are using Hall sensor to detect position and speed of the motor. With Hall sensor the positioning of the rotor is obtained by reading the digital signals coming from the Hall sensors (i.e. connected to three timers channel inputs). Thanks to the Motor Profiler tool and the Motor Profiler FW loaded into a control or inverter board, any Hall sensor can be profiled generating two specific parameters useful for Hall processing.

5.1.1. Profiler Firmware generation

A described board configuration means that the power or inverter board is present into the MCSDK WB data base (MC_SDK_6.2.0\Utilities\PC_Software\STMCWB\assets\hardware\board), as a .json file, and the reistorOffset parameter is embedded into this board description file. As it is done for any kind of FOC project, the MCSDK6.2.0 WB version allows the user to generate a Motor Profiler project by following the following steps:

Create a new motor control FOC algorithm configuration project with any kind of motor, a described power and a control board, or a described inverter board. The following table contains the list of described power and inverter boards supported by this MCSDK WB version to generate Motor Profiler project.

Inverter Power Board Power Board Power Board Power Board Inverter Power Board Power Board Power Board Power Board Power Board Power Board
EVSPIN32G4 X-NUCLEO-IHM07M1 X-NUCLEO-IHM16M1 X-NUCLEO-IHM17M1 X-NUCLEO-IHM17M1 B-G431B-ESC1 STEVAL-IHM023V3 STEVAL-IPM05F STEVAL-IPM10B STEVAL-IPM15B STEVAL-IPMN3GQ STEVAL-IPMNM1N

This list may be updated as soon as STMicroelectronics designs new efficient boards to support improvement in motor control algorithm and new STM32 ICs in each new MCSDK release.

When the project is created, first check the "current sensing" configuration and specially set a "Three shunt resistors" for "Current reading topology".

As most of the project are using a "3 shunts / 2 ADC current sensing" topology (except iNUCLEO-H563ZI), please set up this configuration into the "ADC" line.

To configure this created FOC project in a motor profiling way, please tick the "Motor Profiler" feature into the "Application configuration" stage.

This is time to save and generate the Motor Profiler project for the wished IDE tool chain (i.e. Stm32CubeIDE) proposed by the MCSDK WB.

As soon as the Motor Profiler project has been generated, a compilation of this project must be performed thanks to the selected IDE or any ARM compilation script.

The binary generated is now ready to be loaded into the FLASH of the control or inverter board with the selected IDE tool or using i.e. the STM32CubeProgrammer tool.

When the Motor Profiler FW runs into the MCU, the Motor Profiler tool can be used, by launching the Motor Pilot tool on MCSDK 6.2.0.


5.2. How to use Profiler

5.2.1. Board connection

Like for the Motor Pilot, check the Board connection part, and connect the Motor Profiler tool to the control or inverter board. A Motor Profiler GUI is now accessible for the user.

As soon as the Board is connected, all pieces of information are displayed, and the Motor Profiler tool is now able to communicate with embedded FW to profile the motor.

5.2.2. Profiler parameter

Please, configure the required know information of the motor: Pole pairs, max speed and max current information, and voltage thresholds. Besides, the internal permanent magnet synchronous motors (IPMSM) with its Ld/Lq ratio, or the surface permanent magnet synchronous motors (SM-PMSM) can be selected.

5.2.3. Start Profiling

Finally, it is time to press the "start profile" button. The motor profiling sequence starts and electrical and mechanical model parameters are successively computed during the execution of the profiling represented by the progress of the bar increment. As soon as the profiling is finished all these parameters are updated and displayed. To end, an option is proposed to save all these motor parameters into a .json file.


5.2.4. Start Hall sensor profiling

Please note that the Start Hall profiling will be accessible only if a profiling of the motor has been executed previously. If it is not the case, please first launch a motor profiling and then profile the Hall sensor.

Please click on the Start Hall profiling to start the process. The Motor Profiler tool will ask the user at the beginning of the process to check the connections and the power supply required for a Hall sensor profiling.


Then, the Motor Profiler tool will also ask the user to verify that the motor is spinning into a positive direction. If it is not the case, please re-check your Hall sensor connection and power supply and, re execute the Hall senor profiling.

The Hall sensor profiling will be done in both directions. As soon as the two rotation directions processes are finished, the two computed values of the parameters are displayed.


5.2.5. Profiling results

All parameters generated thanks to the motor and Hall sensor profiler can be stored into a MCSDK WB motor ,json database i.e. C:\Users\frqxxxxx.st_workbench\hardware\motor.