The STM32Cube is an STMicroelectronics original initiative to ease developers’ life by reducing development efforts, time, and cost.

The STM32Cube covers the STM32 portfolio.

The STM32 microcontroller offers the performance of the industry-standard Cortex®-M core running either 6-step or field-oriented control (FOC) modes, widely used in the 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:

  • ST motor-control firmware library;
  • ST motor-control workbench and ST motor pilot software tools
  • ST motor profiler tool.

The ST MC FW library provides implementations of the field-oriented control FOC and the 6-step motor control techniques. This allows it for driving permanent-magnet synchronous motors (PMSM) and brushless DC motors (BLDC). FOC is more suited for PMSM while the 6-step technique is more meant for BLDC motors. The Firmware can drive both Internal Mounted PMSM and Surface Mounted PMSM.

The ST motor-control firmware library provides the following features:

Field-oriented control

  • SVPWM generation:
    • Configurable PWM frequency
    • Centered PWM pattern type.
  • Speed or Torque Control Mode: Motors can be controlled in speed or torque mode. Switching between modes is possible at any time (even when the motor is spinning)
  • Position-control mode. Position control is possible for motor-control applications using encoders for speed and position measurement (Build time feature. No switch to/from Torque or Speed Control modes is possible at run time when the position-control mode is enabled)
  • Programmable Speed and Torque ramps
  • Open or Closed Loop operation
    • Closed loop is default
    • Two open-loop modes:
      • Open-loop current: No control over rotor speed and position (rotation speed is arbitrary), current is regulated
      • Open-loop voltage: No control over rotor speed and position (rotation speed is arbitrary), No current regulation (voltage reference is set)
    • Switching between open and closed loop is possible at run time
  • Phases Current Sensing
    • Isolated Current Sensors (Hall effect sensors)
    • Single Shunt current sensing - common DC-link shunt resistor
    • Three Shunt resistors current sensing - three resistors placed at the bottom of each of the three inverter legs
  • Rotor Speed and Position feedback
    • Sensorless Back EMF State Observer coupled with a PLL for rotor speed and angle estimation;
    • Sensorless Back-EMF State Observer coupled with a CORDIC for rotor speed and angle estimation;
    • 60° or 120° displaced Hall sensors decoding (measurement);
    • Quadrature Encoder decoding (measurement);
    • Two of these above methods can be used simultaneously on any of the motors: Main and auxiliary. The main method is used in the control loop, while the other is the auxiliary.
  • Highly configurable rev-up control sequence for sensor-less configurations
  • On-the-Fly startup feature: The sensorless algorithm can detect if the motor is already spinning before startup, thus skipping the acceleration phase if needed (useful for an application)
  • Motor Brake strategies
    • Dissipative DC-link brake resistor handling;
    • Motor phases short-circuiting (with optional hardware over-current protection disabling);
    • Motor phases free-wheeling.
  • 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)
  • Discontinuous PWM (optional)
  • Overmodulation on Phase Voltage Generation (optional)
  • Real-time tuning of:
    • PI/PID regulators parameters;
    • Sensorless algorithms (Observers, Rev-up procedure);
    • Optional algorithms (Feed Forward, Flux Weakening, MTPA…);
    • Sensorless startup procedure.

6-step

  • Duty Cycle generation:
    • Configurable PWM frequency
    • Edge PWM pattern type.
  • Programmable Speed ramps
  • Closed Loop operation with the real-time tuning of PI/PID regulators parameters
  • Rotor Speed and Position feedback:
    • Sensor-less with back-EMF measurement and zero-crossing detection
    • Sensored with Hall sensors
  • Startup Control for sensor-less configurations
  • Back-EMF detection capability during PWM-ON time
  • Two-speed control modes:
    • Voltage mode (direct change of PWM duty cycle)
    • Current mode (output current clamping)

Usage of embedded analog peripherals for STM32 devices for which those peripherals are available

  • Support for Programmable Gain Amplifiers (PGA) usage for current sensing:
    • three-shunts and single shunt topologies;
    • internal or external gain;
  • Support for comparators usage in Over-Current Protection (OCP) mode:
    • three-shunts and single shunt topologies;
    • internal or external threshold;

sage-of-specific-hardware-accelerations-for-stm32-devices-for-which-those-hardware-ips-are-available

  • ADC queue of context (ST patented architecture);
  • CCM (core coupled memory) RAM;
  • Advanced Timer structures for single shunt topology (ST patented).
  • Adaptive real-time accelerator (ART Accelerator)
  • CORDIC (Coordinate rotation digital computer algorithm) HW accelerator (available on STM32G4xxx device family only)

Fault-management

  • Over-Current;
  • Over-Voltage;
  • Under-Voltage;
  • Over-Heating;
  • Speed feedback reliability error (FOC only);
  • Algorithm execution overrun.

Miscellaneous-features

  • Temperature Sensing
  • VBus Sensing
  • Debug and Introspection features

ST motor-profiler software tool

  • A PC software application to auto-measure electromechanical parameters of PMSM motors
  • Embedded One Touch Tuning is an algorithm that uses a single parameter to set up the speed controller according to the type of load. Together with the ST motor-profiler software tool, it can be enabled to achieve the setup and run an unknown motor from scratch (STM32G4, STM32F7, STM32F4, and STM32L4);
  • Measured motor parameters can be configured in the MC application, thanks to the ST motor-control workbench.

ST motor-control workbench software tool

  • Graphical User Interface (GUI) to configure a Motor Control application:
    • Features & Algorithms are configured graphically;
    • Boards are configured from provided ST database: Control board, Power Board, motor parameters;
    • Custom power board and motor can be specified
    • Generates *.IOC files to interface STM32CubeMX tool.
    • Wizard-like interface that guides users through configuration steps
    • Comprehensive checks to prevent the production of non-functional configurations
  • Easy parameters tuning:
    • Firmware Library;
    • MCU board;
    • Power board;
    • Motor.

STM32CubeMx
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 ST website.

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 needed for the MC application (e.g.GPIO pins).

1. Supported devices and boards

  • Supported Devices:
    • STM32G0xx Family:STM32G071RB, STM32G081RB
    • STM32G4xx Family:STM32G431RB, STM32G431CB, STM32G474RE
  • Control Boards
    • STM32G0xx Family:
      • NUCLEO-G071RB[1]
      • STM32G081B-EVAL[2]
    • STM32G4xx Family:
      • NUCLEO-G431RB[3]
      • STM32G474E-EVAL[4]
  • Power Boards:
    • STEVAL-IPM05F[5]
    • X-NUCLEO-IHM07M1[6]
    • X-NUCLEO-IHM08M1[7]
    • X-NUCLEO-IHM16M1[8]
  • Inverter Boards
    • B-G431B-ESC1[9]
  • Adapter Bridges

2. Known Limitations

  • The support of the STM32 series is currently limited to G0 and G4. The support for the F0, F3, F4, F7, L4, and H7 series will be reintroduced in future versions of the SDK.
  • Dual drive is no more supported at the moment. Support for this feature will be reintroduced in a future release of the SDK
  • The 6-step algorithm is limited to series G4xx for the moment. It will be extended to other series in a future release of the SDK.
  • Overcurrent protection relative to embedded OPAMP is not functional for the ESC-G4 board.
  • With STM32CubeMx 6.4.0:
    • Peripheral initialization code generation for STM32G0xx series with LL drivers has a limitation that causes variations of the rotation speed and sometimes “startup failure” errors. A SW workaround is available. It consists in calling function LL_RCC_SetTIMClockSource(LL_RCC_TIM1_CLKSOURCE_PLL) just after the call to MX_TIM1_Init() in the main()function in file main.c.

3. Update History

3.1. v6.0.0-30-mar-2022

Main changes"' This is the first version of the new Motor Control SDK 6 series (X-CUBE-MCDSK). As the first release of a new major version, MCSDK 6.0.0 marks a major milestone for ST motor-control SDK.

The most visible change introduced by ST MCSDK 6.0.0 is a brand new Workbench tool, featuring a modern UI with a fully reworked use flow. With this new UI, the user is fully guided through all the steps needed to configure a Motor Control application. Each feature is completely configured in one place, from the pure algorithmic parameters to the pinning of STM32 peripherals. There is no need to go through several distant and hidden panels to set all the details of a feature anymore.

In addition to easing the user experience, this new workbench is designed to support more products, new algorithms, new features, and new motor types that will be added in the future. An example of a new feature is the 6-step drive implementation that was only provided as a set of examples in the ST MCSDK 5.x series. Thanks to the new Workbench 6, it is now available as a first-class citizen in the SDK. Another example is the introduction of a new, flexible, board description format. Thanks to this new format, users will be able to design their own, custom boards and have them properly handled by the workbench. This will be made available in several steps: First, the format is being documented on ST's wiki. But the ultimate goal is to integrate, in a future release, a board designer UI in the Workbench that will allow users to design their own hardware motor control boards.

This new workbench is only one of the changes that the ST motor-control SDK 6 series is introducing. ST motor pilot, the new control and monitoring PC tool that replaces the Monitor of the Workbench 5, already published with ST MCSDK 5.Y.0 is another. Others will come in the coming releases of the Motor Control SDK 6 series.

Warning white.png Warning
The file format used by MCSDK 6 to store projects designed with the workbench (with the *.stwb6 extension) is new and there is no tool for converting from the legacy stmcx format to the stwb6 one.


Changes introduced in the ST motor-control firmware

  • Added full support for the 6-step control technique. It is now configurable from the workbench.
  • Added the possibility to switch between open and close loop at run time for FOC configurations
  • Fixed alignment issue with MDK-ARM Keil version 6 that may result in the embedded application crashing with a hard fault.
  • Fixed an issue where the firmware application may go to Speed mode even if Torque mode was selected as the default mode at startup through Workbench.
  • Added the possibility to configure the CPU load measurement and the open-loop features from CubeMx. As of now, these two features cannot be enabled from the Workbench.
  • The Power measurement API now returns a floating-point value
  • Fixed an issue with a wrong Id reference being set after the alignment procedure in position-control mode

Changes introduced in the ST motor pilot

A commented selection of these changes needs to be listed here:

  • Motor power reported in floating-point instead of U16
  • Renamed register FLAGS into FAULT_FLAGS
  • Added support for switching from open loop to closed loop at run time
  • Disabled the polling of registers related to unavailable features
  • The name of the boards used in the embedded application is now displayed
  • Improved support of 6-step
  • Improved Torque reference reporting in the Advanced Configuration panel
  • Fixed an issue with the usage of the slider used to set the speed reference.
  • Nominal current is now reported into S16 instead of U16.

Contents

Components Version License terms Release note
Utilities/PC_Software/STMotorProfiler 1.3.3 Binary image.[11] Motor profiler release note
Utilities/PC_Software/STMCWB 6.0.0 Binary image [11] MCWorkbench release note
Utilities/PC_Software/MotorPilot 1.0.0 Ultimate Liberty[12] MotorPilot release note
Middlewares/ST/MotorControl 6.0.0 Ultimate Liberty[12] MC firmware release note

STM32Cube Environment

  • STM32CubeMX v6.5.0
  • STM32Cube_FW_G0_V1.5.0
  • STM32Cube_FW_G4_V1.5.0

Development Toolchains

  • IAR Embedded Workbench for ARM (IAR Systems AB) v8.50.2
  • μVision® IDE for Arm® (Keil® MDK) v5.24.2
  • STM32CubeIDE v1.8.0[13]
  • STM32CubeProgrammer 2.6.0[14]

4. 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 complete documentation on STM32 Microcontrollers, please visit us at http://www.st.com/STM32

5. References


[[Category: Motor Control]]

No categories assignedEdit