
The STM32Cube is a STMicroelectronics original initiative to ease developers’ life by reducing development efforts, time and cost.
The STM32Cube covers STM32 portfolio.
The STM32 microcontroller offers the performance of the industry-standard Cortex®-M core running either Six-Step or Field Oriented Control (FOC) modes, widely used in high-performance motor drive for Air Conditioning, Home Appliances, Drones, Building & Industrial Automation, Medical and E-bike applications.
The STM32 Motor Control (MC) Software Development Kit (SDK) includes:
The ST MC FOC FW library implements the FOC mode for driving both Internal and Surface Mounted Permanent Magnets Synchronous Motor (PMSM). This implementation can drive one or two motors simultaneously with the characteristics and features listed below.
The ST MC Six-Step FW library implements the Six-Step mode for driving both Internal and Surface Mounted Permanent Magnets Synchronous Motor (PMSM). This implementation can drive one motor with the characteristics and features listed below.
Please, note that some of these features are not supported on all MCUs. In other words, the possible combinations of features and MCUs are discussed below.
Click here to check the supported STM32 microcontrollers and there for the known limitations.
Please, visit us at http://www.st.com to download latest available documents and any update.
The ST MC FOC FW library provides the following features:
Driving one or two different motors simultaneously (only one for Six-Step)
Speed or Torque Control Mode:
Programmable Speed or Torque ramps:
SVPWM generation:
Open or Closed Loop operation
Flux Weakening algorithm to reach higher than rated motor speed (optional)
Feed Forward high performance current regulation algorithm (optional)
Maximum Torque Per Ampere (I-PMSM only, optional)
Rev-Up control for sensor less configuration
On-The-Fly startup The sensor less algorithm is able to detect if the motor is already spinning before startup, thus skipping the acceleration phase if needed (useful for fan application)
Real time tuning of:
Sensorless Voltage mode
Duty Cycle generation:
Open or Closed Loop operation
Startup Control for sensor less configurations
Real time tuning of PID parameters
Back-EMF detection during PWM On time capability
Support for Programmable Gain Amplifiers (PGA) usage for current sensing:
Support for comparators usage in Over-Current Protection (OCP) mode:
Graphical User Interface (GUI) to configure a Motor Control application:
.ioc file to interface STM32CubeMX PC software tool.Easy parameters tuning:
STM32CubeMx is a PC software tool provided by ST to configure STM32 based applications. It is not part of the STM32 MC SDK delivery, but can be downloaded freely at http://www.st.com.
It is used to generate IAR Embedded Workbench for ARM(IAR Systems AB) or μVision® IDE for Arm® (Keil® MDK) and STM32CubeIDE ready to use projects from .ioc files that the ST MC Workbench produces.
In the ST MC context, the STM32CubeMX might be used to customize pins implementation of the MC application as well as to configure other peripherals that are not MC specific but nonetheless needed for the MC application (e.g.GPIO pins).
Supported Devices:
Control Boards
STM32F0xxFamily:
STM32F1xx Family : WARNING STM32F1xx Family is not supported anymore from version 5.Y
STM32F3xx Family:
STM32F4xx Family:
STM32F7xx Family:
STM32L4xx Family:
STM32G0xx Family:
STM32G4xx Family:
STM32H7xx Family: (partially supported with examples)
Power Boards:
Inverter Boards
The MC SDK installer, the ST Motor Profiler and the ST Motor Control Workbench software tools are running only on a PC system, and have been tested using a Windows 10 Operating System.
LCD screen on EVAL boards are not supported;
Ac6 System Workbench for STM32 (SW4STM32) toolchain is not supported;
With Keil MDK-ARM toolchain, using an STM32F3 MCU, packs STM32F3xx_DFP version 2.0.0 and 2.0.1 are not supported by CubeMx. Version 1.4.0 of the pack is the last version known to work well.
With STM32CubeMx 4.24.0: During the generation of F303x based projects, CubeMx pops-up an error window but the generated project is actually OK. This issue is fixed on version 4.25.0 of STM32CubeMx.
With STM32CubeMx 4.26.0: Projects generated for Atollic TrueSTUDIO do not have the correct optimization level. Optimization level is set to "None (-O0)" although it should be "Optimize for Speed (-Ofast)". This needs to be changed manually, in TrueSTUDIO, Project's Build Settings, Tool Settings, C Compiler, Optimization.
With STM32CubeMx 5.0.0:
With STM32CubeMx 5.0.1:
With STM32CubeMx 5.2.0:
With STM32CubeMx versions 5.5.0, 5.6.0 and 5.6.1:
The example provided for the NUCLEO-H745ZI control board now requires ST32CubeMx version 5.6.0 or later to be generated properly.
With STM32CubeMx 6.2.0:
X-CUBE-MCSDK versions 5.Y.0 to 5.Y.4 do not support dual drive configurations.
Overmodulation is not working with STM32F0 family when running is negative speed.
With STM32CubeMx 6.4.0:
LL_RCC_SetTIMClockSource(LL_RCC_TIM1_CLKSOURCE_PLL) just after the call to MX_TIM1_Init() in the main()function in file main.c.Version 5.Y.4 of the Motor Control Software Development Kit (X-CUBE-MCDSK) is a bug fix release of version 5.Y.3. Its main purpose is to add support of STM32CubeMx version 6.4.0.
In addition, it also provides the new features listed in the following sections.
The state machine that controls overall motor operation has been redesigned and simplified. See New Motor Control state machine below.
MISRAC-2012 compliance. The SDK can produce software projects which sources are compliant with MISRAC-2012 recommendations. This feature is available for Motor Control applications running on STM32G4 MCUs only. See Activating MISRA compliance below.
Added an CPU load measurement mechanism. Thanks to this mechanism, the CPU consumption of the High and the Medium Frequency tasks is measured. Results can be retrieved through the Motor Pilot. See CPU load measurement feature below.
Changed the names of some example files to ensure that they are unique (no STMCX example file has the same name as another one in the release).
Added floating point API to the Motor Control API. For most of the functions of the Motor Control API that take numeric parameters as input and/or return a numeric parameters, another function is added that take and/or return float type parameters and values. This is the case for all functions whose numerical parameters represent physical quantities. the unit of the float parameters are the natural physical units: Amperes for currents and torques, Volts for voltages, seconds for time... See the Motor Control API module of the Motor Control SDK Reference Manuel for a complete information.
Added an API for getting the average measured motor power, in Watts: int16_t MPM_GetAvrgElPowerMotor*(void) (and float MC_GetAveragePowerMotor1_F(void) for its float version). See the Motor Control API module of the Motor Control SDK Reference Manuel for a complete information.
Added a APIs for getting information from auxiliary speed and position feedback components:
int16_t MC_GetMecAuxiliarySpeedAverageMotor*(void) and float MC_GetMecAuxiliarySpeedAverageMotor*_F(void);int16_t MC_GetAuxiliaryElAngledppMotor*(void) and int16_t MC_GetAuxiliaryElAngledppMotor*(void).See the Motor Control API module of the Motor Control SDK Reference Manuel for a complete information.
Removed the Encoder Align APIs from the Motor Control API (MC_AlignEncoderMotor*(void)). These API are not useful since an alignment is performed if needed on MC_StartMotor*() invocation.
Added an Offset Measurement (aka Polarization Measurement) API procedure and its APIs. This procedure measures the offsets of the current measurement network (the voltage sampled on the ADC when no current is flowing into the motor) so that they can be stored (e.g. in a non volatile memory) and be reused later. This allows for shortening the boot-to-spin time as it removes the need to measure these offsets at each power on. The API provided with the procedure allows for:
bool MC_StartPolarizationOffsetsMeasurementMotor*( PolarizationOffsets_t * PolarizationOffsets );bool MC_GetPolarizationOffsetsMotor*( PolarizationOffsets_t * PolarizationOffsets );bool MC_SetPolarizationOffsetsMotor*( PolarizationOffsets_t * PolarizationOffsets ).The use of this procedure is optional. On a call to MC_StartMotor*(), this procedure is triggered automatically if no offset has been provided before.
Enabled the use of the On The Fly feature with configurations that use Hall sensor as their Speed and Position feedback technique.
Release 5.Y.4 also fixes a number of issues found in earlier versions of the SDK.
FF_GetVqdAvPIout() function that now returns instead of .OPEN_LOOP_FOC was defined. This is now fixed.FAST_DEMAG on STM32F3 and STM32G4 MCUs.The state machine used in earlier versions of the SDK had several issues. Among others, it was more complex than actually needed and its implementation was letting the door open to missing state transitions. More especially, fault conditions and commands could be missed in some very specific (and very rare) conditions.
The new state machine aims at solving these issues. One of the most visible improvement is its simplification as it goes from 21 to 12 states. The following figure provides an overview of this new state machine.

The new state machine will be documented in details in further versions of the SDK.
MISRAC-2012 compliance brings an additional cost in RAM, FLASH and MIPS consumption. This is why this feature is disabled by default.
To enable it globally, define symbols FULL_MISRA_C_COMPLIANCY and NULL_PTR_CHECK at project level. The second symbol enables the checking of pointers passed as parameters to many the functions of the SDK. The first one enables the replacement of right shifts operations with divisions by powers of two. Null pointer checking activation can be enabled and disabled independently of the rest of MISRA compliance code because of its important impact on the performances.
The MISRA compliance feature can be activated either as a whole or on a per component basis thanks to two sets of defines (one for null pointer checks and one for the rest of MISRA code) named after the component they relate to. These symbols are defined in the mc_stm_type.h file. Refer to this file for more information.
The MISRA compliance feature is only available for STM32G4 MCUs.
This mechanism is activated at project generation time. Activation of the feature is not supported by the Workbench yet. So, to activate it, load the project IOC generated by the Workbench in STM32CubeMx, navigate to the Middleware, MotorControl panel and check the DBG_MCU_LOAD_MEASURE box. Then, click the "GENERATE CODE" button. See the Parameters visibility in STM32CubeMx section below for detailed information on parameters in STM32CubeMx.
To retrieve the measurements, three registers of the Motor Control Protocol are provided. The Motor Pilot can be used to get and to plot them:
PERF_CPU_LOAD: its value reflects the latest CPU load measurement available;PERF_MIN_CPU_LOAD: set to the minimum CPU load measured in the session;PERF_MAX_CPU_LOAD: set to the maximum CPU load measured in the session.The performance measurement counts the cumulative number of processor cycles spent in the High and Medium frequency tasks during a Medium Frequency Task period (typically 1 ms, see the Execution rate parameter of the Speed regulator panel in the Workbench). The values of the registers represent the ratio between the measured number of cycles and the total number of cycles in a period, expressed in percent.
Note that Min & Max value represent the absolute values measured during regular execution time. These values are not updated during the calibration phase.
The plotting of these registers is done with the polling method (and not using the Datalog service). So, the value plot of register PERF_CPU_LOAD in the GUI is a subsampling of the MCU load value.
| Components | Version | License Terms | Release Note |
|---|---|---|---|
| Utilities/PC_Software/STMotorProfiler | 1.3.2 | Binary image | Motor Profiler Release Note |
| Utilities/PC_Software/STMCWB | 5.Y.4.21553-1.6.0.template-22-01-11 | Binary Image | MCWorkbench Release Note |
| Utilities/PC_Software/MotorPilot | 0.9.20 | Ultimate Liberty | MotorPilot Release Note |
| Utilities/PC_Software/ACIMGUI | 1.3.0 | TBD | TBD |
| Middlewares/ST/MotorControl | 5.Y.4 | Ultimate Liberty | MC Firmware Release Note |
Version 5.Y.3 of the Motor Control Software Development Kit (X-CUBE-MCDSK) is a bug fix release of version 5.Y.2.
It fixes the following issues:
Reintroduced pdf documentations that had disappeared in 5.Y.2.
Motor Pilot:
SimpleApp.qml application that had been mistakenly removed from 5.Y.2Version 5.Y.2 of the Motor Control Software Development Kit (X-CUBE-MCDSK) is a bug fix release for supporting STM32CubeMX version 6.3.0. In addition, it provides a few other updates and improvements on top of 5.Y.1:
The Six Step drive firmware currently delivered with the SDK is not configurable with the Motor Control Workbench yet and it is only available through examples. However, the user can have some level of control over the configuration of the examples thanks to STM32CubeMx. Loading the .IOC file produced by the workbench into STM32CubeMx, navigating to the Pinout & Configuration pane, Component List (Categories) column, MiddleWare section and then clicking on MotorControl displays a configuration panel (See below).

This panel appears on the right of the Component list column and displays a subset of the parameters of the Motor Control firmware. Refer to the documentation for the meaning of these parameters and how to change them. Most of these parameters belong to the Six Step drive firmware while some are shared with the FOC drive. Among the latter, ASPEP_OVER_UART and those which name starts with MCP_ configure the remote communication with the application with Motor Control Protocol. Users should not change them from STM32CubeMx unless they know the consequences.
Note that parameters shared with FOC drive are also displayed in STM32CubeMx in FOC configurations. However in this context, they must not be changed from STM32CubeMx. Indeed, some other, non visible, but related parameters may not be updated accordingly and changes made in the IOC file are not propagated back to the .STMCX MC Workbench project file.
Version 5.Y.1 of the Motor Control Software Development Kit (X-CUBE-MCDSK) is a bug fix release of version 5.Y.0.
It fixes the following issues:
Some Motor Control examples delivered with MCSDK 5.Y.0 would not configure DMA channels properly to work with the new Motor Control and thus with the Motor Pilot. Also, the baudrate of the UART port configured by examples is set to 1,8 Mbps, the same as ST Motor Pilot's default.
ACIM motor based examples do not build on 5.Y.0. They build well on 5.Y.1.
The descriptions of EVSPIN32F0x inverter boards delivered with the Workbench had wrong DC & AC voltage supply ranges. These have been corrected as follows:
| Inverter | Wrong AC supply range | Corrected AC supply range | DC supply range |
|---|---|---|---|
| EVSPIN32F02Q1S1, EVSPIN32F0251S1 | 20 - 120 Vac | 15 - 120 Vac | 20 - 170 Vdc |
| EVSPIN32F06Q1S1, EVSPIN32F0601S1 | 50 - 280 Vac | 35 - 280 Vac | 50 - 400 Vdc |
| EVSPIN32F06Q2S1, EVSPIN32F0602S1 | 50 - 280 Vac | 35 - 280 Vac | 50 - 400 Vdc |
| EVSPIN32F06Q1S3, EVSPIN32F0601S3 | 50 - 280 Vac | 35 - 280 Vac | 50 - 400 Vdc |
Six-Step High Voltage examples based on the EVSPIN32F0251S1 inverter board were mistakenly not included into 5.Y.0 version. They are in 5.Y.1.
The Pilot would fail to update registers values from the embedded application in some situations. In such a case, information like the motor rotation speed, status and error information would not display.
Fixed issues with the DAC output feature.
Added many signals to the Datalog and the DAC output features. Among them, the observers, encoder and Hall sensors angles.
Running the motor in the negative direction on STM32F0 based designs with 1 shunt and Hall sensor configuration may trigger an overcurrent error.
Fixed an issue found on ESC G4 and F3 inverter boards with Motor Control Protocol v2.
The release 5.Y.0 of the Motor Control Software Development Kit (X-CUBE-MCDSK) is a step in between the current legacy version (v5.4.6 ) and the coming Version 6.
X-CUBE-MCSDK version 6 will allow:
In version 5.Y.0, the following changes are introduced:
For PMSM/BLDC Motors:
Discontinuous PWM (aka. Two-phase modulation)
Over Modulation
Single Shunt with Phase Shift. This variant of the Single Shunt current sensing topology replaces the active window variant that used to be delivered with the SDK
Circle Limitation VD, a better variant of the circle limitation algorithm where that Vd is never 0 which prevents some uncontrollable situations. It replaces the legacy implementation
Added support for the STSPIN32G4 devices
Added support for the following inverter boards:
Added support for the EVALSTDRIVE101 power board
Added support of the HSI clock source for STM32L452 and STM32L476 devices. This support is the default for the following two boards:
Removed support for the STM32F1 devices series.
Fixed an issue that prevented the NUCLEO-L452RE + X-NUCLEO-IHM16M1 from working out of the box
Fixed a wrong ADC clock configuration for STM32G4 devices
Six Step examples improvements:
For Asynchronous Motors:
- STM32F1 Family is not supported by X-CUBE-MCSDK version 5.Y. If you are using a STM32F1 MCU, please keep on using X-CUBE-MCSDK 5.4.x versions.
- Dual Drive is not supported by current X-CUBE-MCSDK version 5.Y. If you are using dual drive, please keep on using X-CUBE-MCSDK 5.4.x versions.
- Projects generated with previous X-CUBE-MCSDK versions will not load with the version 5.Y. Please stay with versions 5.4.x if you want to keep the compatibility.
- X-CUBE-MCSDK version 5.Y is released to provides users with an insight on the directions that the development of the Motor Control SDK is following but is not aiming to reach the same level of maturity of legacy X-CUBE-MCSDK version 5.4.6
Version 5.4.6 is a bug fix release of X-Cube-MCSDK v5.4.5.
Added support for STM32CubeMx version 6.2.0:
Fixed an error in the Release notes of version 5.4.5 of the SDK about the usage of Injected ADC conversions on STM32G4 devices. The corrected paragraph is readable in place, here;
Fixed a typo in the Release notes about the name of an inverter board: EVSPIN32F0601S1 was incorrectly named STSPIN32F0601S1.
Note: This bug fix release of X-Cube-MCSDK still supports IARM EWARM 7.x. See the V5.4.5 release section and IAR EWARM 7.x end of support paragraph below
Version 5.4.5 is mainly a bug fix release of X-Cube-MCSDK v5.4.4. It also introduces a few new features.
End of support of IAR EWARM 7.x for the Web release variant. Binary libraries delivered with the Web variant of MCSDK, for the IAR EWARM toolchain, were built with IAR EWARM version 7.80 in previous releases. Starting with MCSDK 5.4.5, they are built with IAR EWARM version 8.20. MCSDK 5.4.5 still provides binary libraries built with IAR EWAM 7.80, though. See section... for more details. Note that future MCSDK releases will not provide libraries for IAR EWARM 7 anymore.
Added support for the following power boards:
Added support for STM32G4 Cut 2.2:
Fixed an issue with the overcurrent error due to the overflow or underflow of CCR registers of the PWM Timer not being checked.
Fixed an issue with ICL activation/deactivation
Fixed an issue with regular ADC conversions on STM32G4 when the sampling time is high.
Fixed an issue with the G4 CCMRAM example where some function were not placed in CCMRAM while they should have been.
Fixed an issue with On The Fly startup feature when the motor is already spinning beyond the closing loop threshold, in the direction opposite to the requested startup speed.
Fixed issues with the default parameters used when creating projects with the following boards or kit
Updated Workbench to work with STM32CubeMx v6.0.1.
Fixed issues with setting OpAmps' external gains in Workbench
Fixed an issue with optimization level for projects generated for STM32CubeIDE
This section is meaningful for the web variant of the MCSDK only. The Full variant of MCSDK is not impacted since it is not delivered with binary libraries.
Binary libraries built with version 7.x of IAR EWARM can be used to generate MCSDK projects that build with IAR EWARM 7.x and 8.x. However, when used in EWARM 8.x projects, warnings are generated due to different sizes of the wchar_t type between EWARM 7.x and 8.x. These warnings are a source of frequent problem reports though they do not have negative consequences. In addition, EWARM 8.x has been available for a few years now. So, it is time now to definitively switch to EWARM 8.x and drop support for EWARM 7.x.
Starting with the next release of MCSDK, Web variant binary libraries will be built with EWAM 8.x. This will make it impossible to build with EWARM 7.x and older.
For the present release, Web variant binary libraries are provided both for EWARM 7.x and EWARM 8.x. However, when generating a project for IAR EWARM, only EWARM 8.x libraries are pulled in the project even if EWARM 7.x was selected in the workbench. To use the EWARM 7.x libraries the following procedure can be used:
MCSDK_v5.4.5/MotorControl/lib folder in the generated project and named libmc-iar_M*.a, with M* the name of the Cortex M core used by the STM32 in the project. The folder contains all the libraries for all the cores and toolchains. Only one of them is actually used and its name is listed in the EWARM project.Middlewares/ST/MotorControl/lib folder found in the MCSDK installation location. In this folder, EWARM v7.x libraries are named libmc-iar7_M*.a.libmc-iar7_M*.a file into libmc-iar_M*.a.
Version 5.4.4 is mostly a bug fix release of X-Cube-MCSDK v5.4.3. It also introduces some new feature.
If injected conversions are interrupting a set of scan conversions (scan group) then the first conversion from this injected group is always zero and the other conversions of this injected group are correct. This issue is found on the Cut 2.2 of STM32G4xx devices.
The Motor Control SDK uses Injected ADC conversions to perform current measurements where they are available. This includes the devices of the G4 series.
The workaround introduced in this release of the MCSDK consists in triggering one of the regular conversions scheduled for other needs right after the injected ones used for current measurement. This guarantees the injected conversions will not interrupt the regular ones. This strategy is the one used for STM32F0 and STM32G0 devices that do not have the injected conversion feature.
The selection of NUCLEO-G431RB in combination with any power board that require the X-NUCLEO-IHM09 adapter now results in the following settings:
For 3Shunt
PA0 instead of PA1PC1 instead of PB11PC0 instead of PA7PA1 instead of PC5PC2 instead of PC4For 1Shunt
PC1 instead of PB11PA1 instead of PC5PC2 instead of PC4Disabled the break feature for the combination NUCLEO-G431RB + X-NUCLEO-IHM11M1
Analyzing the UM of the boards and, verifying the formula with the application team, it appears that the UMs contain typos on the suggested values for the following OCP fields:
As a consequence, values has been changes as following:
0.53 --> 0.85.3 --> 8.00.52 --> 0.86.5 --> 10.00.52 --> 0.813 --> 10.00.52 --> 0.88.6667 --> 13.33330.52 --> 0.813 --> 20.00.53 --> 0.830.1 --> 0.25.3 --> 4.15000.1 --> 0.838.3 --> 6.38461.2 --> 0.830.1 --> 0.08212 --> 10.12200.14 --> 0.830.1 --> 0.681.4 --> 1.22060.3 --> 0.830.1 --> 0.33
Version 5.4.3 is a bug fix release of X-Cube-MCSDK v5.4.2.
It is now possible to generate Motor Control application projects for STM32CubeIDE. These projects come with two build configuration, Release and Debug.
The Release configuration builds the application with the highest level of optimization, geared towards speed (-Ofast) but does not provide any debug capability. This configuration is meant for production firmware.
The Debug configuration, on the contrary, will provide the highest level of debug capability (-g3) but no optimization (-O0). Unfortunately, this configuration may not work out of the box with Motor Control Application:
To be able to debug the application, the Debugbuild configuration needs to be modified to add optimization. This can be done in the Project properties dialog, section C/C++ Build, selecting the Debug configuration and selecting Optimize for Speed for the MCU GCC Compiler / Optimization item.
Added support for the following features to configurations based on STM32G4xx devices:
Introduction of the Position Control feature for configurations using a Quadrature Encoder as speed and position feedback. See the section Using the Position Control feature below for more details.
Projects can now be generated for the STM32CubeIDE IDE.
Added the support for Torque Ramps in the motor control protocol.
Introduced the support of STGAP1S drives family.
Enhanced existing and added new Six-Step examples. See Six-Step examples section below
Added support for the STSPIN32F0B device.
Added support for HSI on STM32G0 based Nucleo boards.
Introduced partial support for STM32H7xx devices. So far, only an example is provided with limited configurations capabilities.
Enabling the use of the fastest available timer clock source on STM32F3 (144 MHz) and STM32G0 (128 MHz).
The following issues have been fixed:
SPEED_UNIT value cannot be changed in the State Observer + PLL speed and position feedback component with the Web variant of the SDK.The position control feature can be activated on any configuration that uses an Encoder for speed and position feedback. To activate it, open the Drive Settings dialog from the main configuration panel of the workbench, and select the Position Control item from the Control mode combo box. Dual drive configurations are also supported; the position control can then be activated on any motor equipped with an Encoder.
A set of new APIs is provided to exercise the feature. Among these, the most important ones are the following:
void MC_ProgramPositionCommandMotor*(float fTargetPosition, float fDuration) to set the mechanical angle the rotor is to reach and the duration of the movement to reach itfloat MC_GetCurrentPosition1( void ) to retrieve the current rotor positionfloat MC_GetTargetPosition1( void ) to get the target rotor position float MC_GetMoveDuration1( void ) to get the duration of the programmed movement.The MC_ProgramPositionCommandMotor* functions work as the other ramp functions of the API. For a complete description of this API, refer to the reference documentation of the Motor Control SDK.
Note that when the Position Control is activated on a motor, the speed and torque control mode cannot be used.
The Position Control feature uses floating point arithmetic. It may require a lot of CPU power on STM32F0 and STM32G0 devices that do not have an FPU.
The following Six-Step examples have been added:
Other motors than those listed above can be supported provided that Six-Step parameters are adjusted.
Added support for the following STSPIN MCUs: STSPIN32F0601 / STSPIN32F0602 / STSPIN32F0251 / STSPIN32F0252
Added support for the following STSPIN and boards:
Added support for Dual drive configurations on the STM32G4 family.
Added support for STM32G4, STM32F7, STM32F4 , STM32L4 based boards into Motor Profiler
The following issues have been fixed:
_001HZPWM_FREQUENCY_SCALING parameter was incorrect in some cases When using the Motor Profiler the user must make sure that the motor is fully stopped (spinning at 0 RPM) before starting it again whatever the method (by clicking on Play, Start Profile, ...).
After a fault occurred, or before starting the motor, the low side switches are activated in order to detect if the motor is spinning.Indeed, if the motor is spinning at that time, it may decelerate abruptly which can be dangerous. Great care must be taken to tightly fasten the motor so that it does not become dangerous when accelerating or decelerating brutally.
Added support for the STM32G4 family.
Added the capability for customers to change the speed unit used at API level. In addition to historic 01Hz, RPM and 001Hz are made available.
Added electric angle estimation compensation in the current regulation loop (for Park and inverse Park transforms).
Added examples to demonstrates Six-Step motor drive.
Added FreeRTOS support for F1, F43, F4, F7, L4 and G4 families.
Turned most MC Library routines into __weak functions which simplifies and secures even further the changing or replacement of parts of the code to fit users' needs.
Changed the Curr_Components and Volt_Components types to improve code readability.
Improved the precision of the reconstruction of the motor speed for Hall sensor configurations.
Simplified the usage of the low level API: it is only needed to include motorcontrol.h to use it now.
Added examples to support the ESC-F3 and ESC-G4 boards
Enhanced the Circle Limitation algorithm so that is never 0 which prevents some uncontrollable situations.
Unidirectional Fast Com component support is reintroduced
Added support for negative amplifying network gains in Power stage - Current sensing.
Reworked the architecture of Three-Shunt and ICS PWM & Current Feedback components to add flexibility to MCSDK. The Single-Shunt implementations will be reworked as well in a future release.
Support arbitrary Timer peripherals for the Virtual DAC feature.
The layout of MCSDK in the Windows 10's Start Menu has been reworked:
Support for the following boards has been added:
STEVAL-CTM009V1 power board configured in ICS topology in WorkbenchSTEVAL-IPMNG3S for 3Sh and 1Sh topology in WorkbenchSTEVAL-IPMNM1S for 3Sh and 1Sh topology in WorkbenchSTEVAL-IPMNM2S for 3Sh and 1Sh topology in WorkbenchThe following issues have been fixed:
Up to now, the speed unit used by API functions that expect or return a speed (like MC_ProgramSpeedRampMotor1() or MC_GetMecSpeedAverageMotor1() for instance) was the tenth of Hertz (01Hz). For commodity, it is now possible to use other units for these functions. With release 5.4.0, the two new speed units are made available: the RPM (Revolution Per Minute) and the 001HZ (Hundredth of Hertz).
The choice of the speed unit is made at compile time, by setting the SPEED_UNIT symbol to the proper value in file mc_stm_types.h: _RPM for RPM, _001HZ for Hundredth of Hertz and _01HZ for Tenth of Hertz. The SPEED_UNIT define is placed in a User Section so that users' modification are resistant to project regeneration.
The default speed unit at API level remains the Tenth of Hertz for the time being. Refer to the reference documentation of the firmware to get a complete information on the functions that are impacted by this change.
Note: PID parameters computed by the Motor Control Workbench for speed regulation are suited for speed in 01Hz. The motor control subsystem internally scales them to adapt to the actual speed unit.
When using the Motor Profiler with configurations based on a NUCLEO-G431RB control board, the user must make sure that the motor is fully stopped (spinning at 0 RPM) before starting it again whatever the method (by clicking on Play, Start Profile, ...).
The current regulation loop of the motor control subsystem uses the rotor's electrical angle in its computation. It is needed for the Park transform that computes the and current components and then in the Inverse Park that computes the and voltages that are passed to the SVPWM algorithm for phase voltage computation. and are related to the current PWM period while and are meant to be used in the next one.
However, the implementation provided in MCSDK uses the same electrical angle for both the Park and the inverse Park transforms. Though this is not much of a problem when the ratio between the PWM frequency and the electrical rotation speed is high, this may be a problem when this ratio gets lower.
In addition, when using sensor-less configurations, the electrical angle used in a given PWM period is computed on current and VBus measurements made during the previous one.
The Motor Control firmware now allows for using different angles for the Park and Inverse Park. This is controlled with two symbols defined in the drive_parameters.h file:
PARK_ANGLE_COMPENSATION_FACTOR is multiplied to the last measured instantaneous rotor speed (which is the angle variation between the last two PWM periods) and the result is added to the current angle before it is used for the Park transform.
Its default value is 0.REV_PARK_ANGLE_COMPENSATION_FACTOR is multiplied to the last measured instantaneous rotor speed (which is the angle variation between the last two PWM periods) and the result is added to the current angle right before it is used for the inverse Park transform for reference computation.
Its default value is 0.A similar set of two symbols, PARK_ANGLE_COMPENSATION_FACTOR2 and REV_PARK_ANGLE_COMPENSATION_FACTOR2 respectively, are defined for the second motor in dual drive configurations.
All these symbols are defined in User Sections so they can be changed without being reset if the project is regenerated.
Note that the 6-Step drive implementation that is proposed in these examples is still experimental. Its integration within the Motor Control SDK is very preliminary and will change in future releases.
6 examples are provided on three different configurations:
In its current state, the Motor Control Protocol is only partially supported by the 6-Step implementation. Alternatively, a console like, command line interface over the serial port is provided which allows for a finer control over the application.
For each of the three configurations above, two examples are delivered, one for the console interface and one with the Motor Control Protocol.
In 6-Step configurations, the Motor Control Protocol currently suffers from the following limitations:
In addition the DAC feature is not supported yet. This status will change in future releases as the integration level of the 6-Step implementation increases.
Alternatively, the 6-Step implementation provides a command line interface over the serial port. This command line interface can be accessed with the TeraTerm terminal emulator for instance and allows for a finer control over the application.
The TeraTerm configuration to use is described in the TERATERM_G431RB_230400_Pnone.ini file delivered with the example.
At startup, the Application prints a banner followed by a list of possible commands as welcome message:
x******************** 6 STEP LIB ********************* List of commands:** <GETSPD> Get Motor Speed* <GETSTA> Get Motor Status* <SELMOT> Select Motor* <SETDIR> Set Motor Direction* <SETSPD> Set Motor Speed* <STARTM> Start Motor* <STOPMT> Stop Motor*
Then the application waits for the user to type a command and press the enter key to execute it. Each command is 6 characters long. For commands that expect arguments, first type the name of the command, then press enter and then a prompt line invites the user to enter the value of the argument.
The list of all commands follows:
GETSPD: Returns the current mechanical speed of the current motor, in RPM.GETSTA: Returns the current status of the current motor. Posible status are: IDLE, STOP, ALIGNMENT,
STARTUP, RUN, SPEEDFDBKERROR, OVERCURRENT, VALIDATION_FAIL, LF_TIMER_FAILURE.SETDIR: Sets the direction of the motor. Accept on parameter that can be either CW (Clockwise) or
CCW (Counter Clockwise).SETDCY: Sets the PWM duty cycle. This command is used to control the motor when the speed loop is
not built in the application, which is the default case. This command expects one parameter:
the value of the duty cycle in tenth of percent (in thousandths). Accepted values range from
0 to 1000.SETSPD: Sets the mechanical speed reference of the current motor. This command is active only if
the speed loop has been built in the application. This command expects one argument: the
speed in RPM.STARTM: Starts the current motor.STOPMT: Stops the current motor.In its current state the configuration possibilities of the application are limited.
There are two ways to configure the example.
First, by using STM32CubeMx, to choose which 6-Step features to use: In the Pinout and Configuration view, peripheral pane, click on "A-Z" to list all peripherals and middlewares in alphabetical order. Browse down to MotorControl and click on it. This opens a pane in the middle, showing some configuration options.
SIX_STEP_CONTROL_MODE allows for choosing between Current and Voltage modes. SIX_STEP_SPEED_LOOP: if checked, a speed regulation loop is built in the application and mechanical speed reference can be set. If it is unchecked the speed is not regulated and the only way to control the motor is by setting the PWM duty cycle applied to the active phase(s). Such a control cannot be achieved with the Motor Control Monitor at the moment.SIX_STEP_SET_POINT_RAMPING: if checked, builds the Set Point Ramping feature in the application.SIX_STEP_THREE_PWM: this must be checked for power boards where the MCU drives enable signalsOther parameters, like motor parameters or PID factors for instance can be changed in the USER CODE
sections of the 6step_conf_*.h files.
Motor Control projects generated with STM32 Motor Control Workbench fail to build. Before a solution can be developed for this issue, a work around exists that allows to use ST's new IDE with Motor Control projects by following the procedure described in this section and by respecting a few rules.
ST SW4 STM32 or ST TrueSTUDIO as the Target Toolchain.
Note: STM32G4 based projects cannot be generated with TrueSTUDIO.STM32CubeIDE, go to the File menu and select the "Open Projects from File System..." item.It is important to follow a few rules when working with such imported projects:
The DIAG/EN (over current detection) output of the L6230 driver on the IHM07M1 power board is used as Break Input of the PWM timer. This signal routed to three pins on the C12 connector of the NUCLEO-F746ZG board. One of these pins, C12_28, leads to the PB14 pin of the MCU which also controls one of the LEDs featured on this board.
If PB14 is configured to control the LED, the Break Input gets triggered when the LED is switched resulting in false over current faults. to avoid this issue, resistor R49 needs to be removed from the IHM07M1 board or PB14 must not be configured as output.
Note that ST Motor Control Workbench configures PB14 to drive the LED.
The Regular Conversion Manager (RCM) is a new component that primarily aims at handling ADC regular conversions needed by the Motor Control subsystem. These are typically needed for Bus Voltage sensing and Temperature reading.
This component ensures that Motor Control subsystem's regular conversions are performed well whether these conversions are done on an ADC that is already used for Current Sensing or not and even if the target ADC does not support injected channels. This service is needed to prepare for the support of future inverter boards.
The RCM component is instantiated only once in the system.
Customers application are welcome to use this service. Refer to the Reference documentation for more information.
Version 5.1.3 is a bug fix release of X-Cube-MCSDK v5.1.
Version 5.1.2 is a bug fix release of X-Cube-MCSDK v5.1.
MC_StopMotor*() function. They now return a boolean value to indicate success or failure.Version 5.1.1 is a bug fix release of X-Cube-MCSDK v5.1.
Added support for the STM32F1 High Density series (See Supported devices and boards below);
Added support for STEVAL-SPIN devices (See Supported devices and boards below);
Introduction of the Power Factor Correction feature for STM32F103 High Density MCUs;
Added support for Atollic® TrueSTUDIO® IDE on STM32F3 Family;
Added the possibility for the user to choose the version of STM32CubeMx to use;
Added support for the Start/Stop motor button;
Added support for IP initialization with LL libraries (except for STM32F1 family)
Bug fixes, among which:
In earlier versions of ST Motor Control SDK, Motor Control configurations using an STM32F4 MCU and a power board where both the high-side and low-side transistors are driven by the MCU are faulty: The complementary dead time parameter is set to 0 which may result in destructive short-circuits on the power stage.
This issue is fixed in ST Motor Control SDK version 5.1.0. It is highly recommended to update any such STM32F4 based project to this version of the SDK.
Note that configurations using motor drivers that automatically handle this dead time (such as the L6230 featured in the X-NUCLEO-IHM07M1 power board for instance) are not impacted.
The Power Factor Correction (PFC) feature is provided as an example running on the STEVAL-IHM034V2 inverter board. Look in the folder where the SDK is installed, in the Projects\STEVAL-IHM034V2\MotorControlWithPFCExample folder.
The PFC feature has been validated with an electronic load.
The support of TrueSTUDIO® requires the use of the STM32Cube MCU Package for STM32F3 Series version 1.9.1 .
Note that TrueSTUDIO® support for other STM32 families may be added with new versions of the STM32Cube MCU Packages for these families.
Several versions of the Motor Control SDK can be installed in parallel on the same PC.Version 5.0.1 of the Motor Control Workbench would install the Motor Control Firmware in the user’s STM32Cube repository in the MotorControl folder (typically in C:\Users\<username>\STM32Cube\Repository\MotorControl). With version 5.0.2 onwards, the firmware is installed in the MCSDK_vX.Y.Z\MotorControl subfolder of the user’s STM32Cube repository where X.Y.Z is the version of the SDK (for instance C:\Users\JohnDoe\STM32Cube\Repository\MCSDK_v5.0.2\MotorControl). This allows for keeping several versions of the SDK and so to keep on working on application projects developed with different versions of the SDK.
The version of the SDK used on a given project is that of the Motor Control Workbench used to generate that project. Put in other words, Motor Control Workbench generates projects for the SDK version it is delivered with.
The version of the SDK to use is not stated in the .stmcx file. It is in the .ioc file generated by the workbench. So, when a project has been generated with a given version of the workbench is sticks to it. Unless it is generated again or updated with another version of the Workbench. In that latter case, it is recommended to erase the MCSDK_vX.Y.Z folder from the previous version…
This software package is licensed by ST under ST license SLA0048, the "License"; You may not use this package except in compliance with the License. You may obtain a copy of the License at: