
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 Vector Control or either 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:
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:
Support for comparators usage in Over-Voltage Protection (OVP) mode:
Supported Devices:
Control Boards
STM32F0xxFamily:
STM32F1xx Family :
STM32F3xx Family:
STM32F4xx Family:
STM32F7xx Family:
STM32L4xx Family:
STM32G0xx Family:
STM32G4xx Family:
STM32H7xx Family:
Power Boards:
Inverter Boards
LCD screen on EVAL boards are not supported;
Ac6 System Workbench for STM32 (SW4STM32) toolchain is not supported.
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 version 5.Y.0 does 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 following new features:
The state machine that controls overall motor operation has been redesigned and simplified. See New Motor Control state machine
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. See Activating MISRA compliance below.
Added a 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 the following 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.
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:
Version 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:
Fixed a build issue that would occur when using a resistive brake in a motor control configuration
Changed the visibility of some Six Step parameters in STM32CubeMx. See Parameters visibility in STM32CubeMx below for detailed information.
Fixed an issue that prevented a master to connect to the Motor Control application with the Motor Control Protocol when its capabilities are smaller than that of the slave.
Datalog buffers are immediately sent when an error occurs, even if incomplete. This allows the user for getting the latest values of monitored signals when the error occurs.
Kp/Ki dividers values are now aligned and provided as a power of 2 (Set/Get APIs updated).
New 6Step example project provided for supporting STEVAL-PTOOL1V1 board.
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:
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
Removed support for the STM32F1 devices series.
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.
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.4 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: the firmware and some of the G4 examples in delivery 5.4.4 would not work when used with STM32G4 Cut 2.2. They have been updated to support this cut of the STM32G4 devices.
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.
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.
The Release Note will be modified as follows:
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.
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.
Introduced partial support for STM32H7xx devices. So far, only an example is provided with limited configurations capabilities.
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 Dual drive configurations on the STM32G4 family.
The following issues have been fixed:
_001HZPWM_FREQUENCY_SCALING parameter was incorrect in some cases 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
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 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.
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 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 family (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 the Start/Stop motor button;
Added support for IP initialization with LL libraries (except for STM32F1 family)
Bug fixes, among which:
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.
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: