Based on STM32 MC Motor Pilot 1.2.5 (included in STM32 MC-SDK 6.2.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
The added value features of the STM32 MC Motor Pilot are indicated below.
- Enhanced plotting features: the user can now plot most registers.
- Real time monitoring: registers for each PWM sample can be retrieved, plotted, and recorded.
- GUI customization: the user can easily customize the GUI at runtime 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).
- It runs on Windows, Mac, and Linux platforms.
2. STM32 MC Motor Pilot quick guide
2.1. Installation and run
The STM32 MC Motor Pilot is now automatically installed with the STM32 MC SDK, and a shortcut is created on the Windows menu to run it.
2.2. Quick startup
When you start Motor Pilot for the first time, you can choose three different actions:
- Detect the connected board
Motor Pilot tries to communicate on all STLINK virtual Port COMs at 1843200 and 115200 baud to detect your board. If the detection succeeds, the Motor Pilot loads the corresponding UI.
- Load the UI that is dedicated to the FOC SDK profiler.
- Load the custom UI.
2.2.1. Startup guide with STOPLL/Cordic algorithm
If the automatic detection process failed, then press Load UI and select a QML file for STOPLL/Cordic (MC_FOC_SDK.qml).
At this moment, Motor Pilot is not connected:
And it lists the available serial ports:
- Connect a Motor control board to the PC.
- Select the port and the baud rate according to your application.
- Click Connect.
2.2.1.1. Connect to the board
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.
2 - Spin the motor by clicking on the Start button:
3 - Motor starts and the pilot updates the GUI:
2.2.1.2. Control the motor
To control the motor, you can perform these actions:
- Slide the knob to set the speed:
- Set target speed and duration and click Execute Speed Ramp to apply this ramp:
- Click Stop Ramp to immediately stop the ramp:
- Click Stop to stop spinning the motor:
2.2.2. Start up guide with HSO algorithm
If the automatic detection process failed, then press Load UI and select a QML file for HSO (MC_FOC_ZEST.qml).
At this moment, Motor Pilot is not connected:
And it lists the available serial ports:
- Connect a Motor control board to the PC.
- Select the port and the baud rate according to your application.
- Click Connect.
2.2.2.1. Connect to the board
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
2 - Select your startup method: RsDC estimation, Pole pulse, or manual
To control correctly the motor in closed loop mode, FOC controller needs to know the initial angle. We have three different ways to achieve it:
Automatic mode 1: Polarization pulse (recommended)
- To estimate initial angle, zest firmware injects some current on different angles.
- No motion is generated on the rotor
- Polarization pulse parameters can be set in pol. pulse window.
Automatic mode 2: RsDC estimation
- Zest firmware estimates RsDC at startup. To achieve it, D current is injected, which can generate a motion on the rotor
Manual mode:
- step 1: Enter in Open Current mode
- step 2: Inject some id current. The motor moves to a closer magnetic position
- step 3: Remove id current
- step 4: Enter in any close loop
3 - Start the motor by clicking on the Enable button:
2.2.2.2. Control the motor
To control the motor, you can change few parameters.
Refer to the MCSDK documentation for more details about HSO parameters.
3. MC application parameters
The STM32 MC Motor Pilot obtains the MC application parameters from the board and adapts the widgets to them.
3.1. DAC
If the DAC feature is enabled in the firmware, the DAC widget will be enabled with its corresponding capabilties.
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.
4. MC application advanced settings
4.1. Speed PID, Toque PID, Flux PID, and Flux reference
- Click Advanced Configuration to display another panel with additional settings:
- Customize the following settings from this panel:
- Speed PID
- Toque PID
- Flux PID
- Set Flux reference
Depending on the features available on your firmware, some of the settings can be disabled.
4.2. State Observer, PLL parameters, CORDIC parameters
- Click Advanced Configuration to display another panel with additional settings.
- You can customize the following settings from this panel:
- State Observer + PLL parameters
- State Observer + CORDIC parameters
Depending on the features available on your firmware, some of the settings can be disabled.
4.3. Rev-up configuration
Click on the Rev-up tab to display rev-up parameters:
Then click on Read all to read rev-up parameters from the board.
- This panel allows to set up to five 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 fewer steps.
You can switch the display from s16 A to amp but you need to fill the current sensing parameters according to your board.
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.
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.
- Once the fault conditions are cleared, enter the FAULT_OVER state.
- Click Ack Faults to go back to IDLE.
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).
- Click the Registers tab to display the list containing all the registers.
- Click the Configure button to:
- add register plot into a new plot window,
- or add it into an existing plot window.
You can zoom over the plot using the combination of CTRL key + left click of the mouse
- The user can stop plotting the register:
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:
- A High Frequency Plot window opens:
- 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:
- Click again to plot more registers:
- The data display width is defined by adjusting the buffer size. Change buffering to display more data.
- When displaying two registers, you can switch to the X/Y plot:
- 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.
4.7. UI is changeable at runtime
- 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.
- 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 an offset resistance detection.
- Be able to see and change the 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 software binary to answer this requirement.
The new MCSDK WB tool is able to generate a Motor profiler project based on the described boards and the FOC motor control software. In consequence, there is no more need to store and update all possible or new Motor profiler binaries that depend on a hardware board setup and different MCU topologies.
The Motor profiler algorithm is provided into the MCSDK firmware 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 on the IDEs (type of Arm compilers that is, arm cc, gcc...), the Motor profiler algorithm is 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 contain .json board description files. For some power and inverter boards, a resistorOffset parameter is embedded, useful for determining 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 firmware is generated without the resistorOffset parameter described into the power or inverter board selected, a default value equal to -32768 of this parameter is found into the resulting generated Motor profiler firmware. In consequence, the motor profiling will not be allowed by the Motor profiler tool. The Motor profiler tool then provides 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 a Hall sensor to detect the position and speed of the motor. With a Hall sensor, the positioning of the rotor is obtained by reading the digital signals coming from the Hall sensors (that is, connected to three timer channel inputs). Thanks to the Motor profiler tool and the Motor profiler firmware 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 a 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 projects 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.
To profile a Hall sensor, the user must configure the Motor profiler project of the MCSDK WB with the speed auxiliary sensor mode set to Hall sensor.
The Motor profiler firmware can then be generated, compiled, and downloaded into the flash as explained in the previous chapter. As soon as the Motor profiler tool is connected to the control or inverter board, the Hall sensor profiling window is accessible by pushing the button Hall profiler button. 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.
Now, you can save and generate the Motor profiler project for the wished IDE tool chain (that is, 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 that is, the STM32CubeProgrammer tool.
When the Motor profiler firmware 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 an embedded firmware to profile the motor.
5.2.2. Profiler parameter
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. pole pairs detection
Pole pair detection is a new feature that comes with this profiler and does not require a power generator to detect the pole pair number. To use this feature, click the Detect pole pairs button, which opens a new window.
To start detection, click Next.
In this window, enter the value of the current to be injected to make the motor strong enough to be able to turn it manually afterwards. The value entered must be close to 15% of the maximum current that the motor can support. Otherwise, the motor may overheat.
Please apply a mark on the fixed part of the motor and the rotating part, then you can turn the rotating part and count the number of Pole Pair. The firmware then prepares the motor by applying a current ramp of the value entered in the previous step.
You have 15 seconds to make a complete rotation of the rotating part of the motor and must count the number of notches. This number is the number of pole pairs. Then, click Finish.
Finally, you can enter the number of Pole Pairs found, then close the window and start the Motor profiling.
5.2.4. Start profiling
Finally, it is time to press the "start profile" button. The motor profiling sequence starts, and the 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 the process, an option is proposed to save all these motor parameters into a .json file.
5.2.5. Start Hall sensor profiling
Note that the Start Hall profiling is accessible only if a profiling of the motor has been executed previously. If it is not the case, first launch a motor profiling and then profile the Hall sensor.
Click on the Start Hall profiling to start the process. The Motor profiler tool asks 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 also asks the user to verify that the motor is spinning into a positive direction. If it is not the case, recheck your Hall sensor connection and power supply, and reexecute the Hall sensor profiling.
The Hall sensor profiling is 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.6. Profiling results
All parameters generated thanks to the motor and Hall sensor profiler can be stored into an MCSDK WB motor .json database that is, C:\Users\frqxxxxx.st_workbench\hardware\motor. When you have saved your file, you can load your motor on the workbench. Here is an example of the generated .json: