Release Notes for ST Motor Control FW

STlogo

Copyright © 2022 STMicroelectronics

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.

Supported devices and boards

Known Limitations

Update History

V5.Y.4 / 18-January-2022

Main Changes

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:

Release 5.Y.4 also fixes the following issues found in earlier versions of the SDK:

New Motor Control state machine

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.

STM32CubeMx

The new state machine will be documented in details in further versions of the SDK.

Activating MISRA compliance

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.

CPU load measurement feature

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:

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.

STM32Cube Environment

Development Toolchains

V5.Y.3 / 14-Sep-2021

Main Changes

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:

V5.Y.2 / 22-July-2021

Main Changes

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:

Parameters visibility in STM32CubeMx

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).

STM32CubeMx

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.

V5.Y.1 / 3-May-2021

Main Changes

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:

V5.Y.0 / 23-Apr-2021

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:

Main Changes

In version 5.Y.0, the following changes are introduced:

For PMSM/BLDC Motors:

For Asynchronous Motors:

IMPORTANT WARNINGS

- 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

V5.4.6 / 15-Mar-2021

Main Changes

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

V5.4.5 / 18-Dec-2020

Main Changes

Version 5.4.4 is mainly a bug fix release of X-Cube-MCSDK v5.4.4. It also introduces a few new features.

IAR EWARM 7.x end of support

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:

  1. Remove the EWARM 8.x library from the generated project. It is located in the 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.
  2. Copy the EWARM 7.x library file needed for the project from the Middlewares/ST/MotorControl/lib folder found in the MCSDK installation location. In this folder, EWARM v7.x libraries are named libmc-iar7_M*.a.
  3. Rename the libmc-iar7_M*.a file into libmc-iar_M*.a.

V5.4.4 / 19-May-2020

Main Changes

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:

Injected ADC conversions issue on Cut 2.2 of STM32G4xx devices

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.

V5.4.3 / 18-Nov-2019

Main Changes

Using STM32CubeIDE with the Motor Control SDK

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.

 

V5.4.2 / 04-Nov-2019

Main Changes

Using the Position Control feature

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:

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.

Six-Step examples

The following Six-Step examples have been added:

Other motors than those listed above can be supported provided that Six-Step parameters are adjusted.

V5.4.1 / 05-July-2019

Main Changes

V5.4.0 / 27-May-2019

Main Changes

Speed Unit at API level

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.

Electrical angle estimation compensation

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:

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.

6-Step Examples

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.

6-Step Example Usage

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:

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:

6-Step Example Configuration

In its current state the configuration possibilities of the application are limited.

There are two ways to configure the example.

  1. 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 signals
      instead of the complementary PWM channels, as it is the case for the X-NUCLEO-IHM07M1 or X-NUCLEO-IHM16M1 power boards and more generally with gate drivers like ST's L6230 or STSPIN830.
  2. Other parameters, like motor parameters or PID factors for instance can be changed in the USER CODE sections of the 6step_conf_*.h files.

Working with STM32CubeIDE for Motor Control projects

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.

  1. In STM32 Motor Control Workbench, when generating or updating a project, choose either ST SW4 STM32 or ST TrueSTUDIO as the Target Toolchain. Note: STM32G4 based projects cannot be generated with TrueSTUDIO.
  2. Open STM32CubeIDE, go to the File menu and select the "Open Projects from File System..." item.
  3. In the dialog that opens, click the "Directory..." button on the "Import source" line. Navigate to the directory that contains the generated project and select it.
  4. The Dialog should now propose two projects for import. Select only the one that has the "Convert 'TrueSTUDIO..." or "Convert 'System Workbench...'" mention in the "Import as column". The other one must not be selected.
  5. the imported project should build and run as expected.

It is important to follow a few rules when working with such imported projects:

STM32Cube Environment

Development Toolchains

 

V5.3.3 / 18-Jan-2019

Main Changes

STM32Cube Environment

Development Toolchains

V5.3.2 / 21-Dec-2018

Main Changes

STM32Cube Environment

Development Toolchains

V5.3.1 / 10-Dec-2018

Main Changes

STM32Cube Environment

Development Toolchains

V5.2.0 / 03-Aug-2018

Main Changes

Regular Conversion Manager

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.

STM32Cube Environment

Development Toolchains

V5.1.3 / 10-Jul-2018

Version 5.1.3 is a bug fix release of X-Cube-MCSDK v5.1.

Main Changes

V5.1.2 / 06-Jul 2018

Version 5.1.2 is a bug fix release of X-Cube-MCSDK v5.1.

Main Changes

Development Toolchains

V5.1.1 / 07-Jun-2018

Version 5.1.1 is a bug fix release of X-Cube-MCSDK v5.1.

Main Changes

Development Toolchains

STM32Cube Environment

V5.1.0 / 05-Jun-2018

Main Changes

Power Factor Correction

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.

Development Toolchains

Warnings

STM32CubeMX Environment

V5.0.3 / 17-Apr-2018

Main Changes

Development Toolchains

STM32CubeMX Environment

V5.0.2 / 04-Apr-2018

Main Changes

V5.0.1 / 08-Mar-2018

Main Changes

License

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:

For a complete documentation on STM32 Microcontrollers, please visit us at http://www.st.com/STM32