Introduction to Motor Control with STM32

This page contains application examples, document references, tips and tricks and so on related to STM32 motor control.

1. What is the STM32 motor control ecosystem?

From hardware tools and embedded software to training resources and documentation, the STM32 Motor Control Ecosystem offers many tools to ease the development of motor control applications. STM32 MCUs are particularly suitable for the development of applications using permanent-magnet synchronous motors (PMSMs), brushless DC motors (BLDCs), and stepper motors.

Motor Control


2. STM32s compliant with motor-control applications

The STM32 portfolio includes devices based on Arm® Cortex®-M cores (M0, M0+, M3, M33, M4, and M7). Thanks to the MCUs' shared ecosystem, developers benefit from enhanced flexibility to move forward with their motor-control design.

Each STM32 Series MCU offers a different set of peripherals matching different motor-control application requirements:

STM32
Series
ARM
core
More
CPU
frequency
Flash
range
Analog
integration
level
MC
timer
STM32G0xx Cortex-M0+ 64 MHz 16-512 Kbyte + 1x (128 MHz)
STM32F303 Cortex-M4 (DSP/FPU) 72 MHz 32-512 Kbyte ++++ 3x (144 MHz)
STM32F302 Cortex-M4 (DSP/FPU) 72 MHz 32-512 Kbyte +++ 1x (144 MHz)
STM32F301 Cortex-M4 (DSP/FPU) 72 MHz 16-64 Kbyte ++ 1x (144 MHz)
STM32G431 Cortex-M4 (DSP/FPU) 170 MHz 32-128 Kbyte +++ 2x (170 MHz)
STM32G474 Cortex-M4 (DSP/FPU) 170 MHz 32-128 Kbyte ++++ 3x (170 MHz)
STM32F4xx Cortex-M4 (DSP/FPU) 180 MHz 256-1024 Kbyte ++ 2x (180 MHz)
STM32F7xx Cortex-M7 216 MHz 64-2048 Kbyte ++ 2x (216 MHz)
STM32H7xx Cortex-M7 + M4 (option) 480 MHz 128-2018 Kbyte ++ 2x (240 MHz)

The STM32G4 Series combines a 32-bit Arm® Cortex®-M4 core (with FPU and DSP instructions) running at 170 MHz, combined with three different hardware accelerators, rich analog peripherals and advanced motor control timers to meet all motor control application requirements. These product Series are ideal for motor control applications.

3. STM32 motor-control specific tools

Motor Control



ST-MC-SUITE is an online solution finder that offers easy access to all STM32 and STM8 MCU resources available for motor control applications, such as application notes, brochures, presentations, and magazine articles. A software wizard is included to help developers select relevant materials, add them to their bundle, and download them in one click.

ST Motor Profiler is a software tool that automatically measures the electrical parameters of PMSM and BLDC motors. It can be used to run an unknown motor from scratch in only few minutes. ST Motor Profiler is included in the X-CUBE-MCSDK software development kit for STM32 device.

STM32Cube is a free set of tools and embedded software bricks for STM32 microcontrollers and microprocessors addressing all the needs of a complete project development cycle. It includes the STM32CubeMX configuration tool, which enables the generation of C initialization code for Cortex-M cores. Motor Control Workbench (available in the X-CUBE-MCSDK) is linked with STM32CubeMX. Developers can open STM32CubeMX through Motor Control Workbench during their motor-control development to change the STM32 configuration.

4. Getting started with STM32 and motor control

Getting started with MCSDK and P-NUCLEO kits:

pc videol.png

Getting started with STM32 Motor control SDK5.0

pc videol.png

Getting started with the STM32 Motor Control Nucleo Pack (P-Nucleo-IHM001)

pc videol.png

Getting starting with P-NUCLEO-IHM03

Getting started with ST MC SUITE:

pc videol.png

Product overview: ST-MC-SUITE

5. STMicroelectronics resources

Links to ST.com dedicated web page:

Doc Number Title
UM2374 Getting started with STM32 motor control SDK v5.0
UM2392 STM32 motor control SDK5.x - Firmware
UM2380 STM32 motor control SDK v5.2 tools
AN5143 How to migrate motor control application software from SDK v4.3 to SDK v5.x
AN5166 Guidelines for control and customization of power boards with STM32 MC SDK v5.0

More motor control related resources can be found at ST-MC-SUITE .

6. MCSDK feature set and examples

The Motor Control Library included in X-CUBE-MCSDK (today available for PMSM/BLDC motors) enables the features listed below. Full integration/configuration in MC Workbench tools:

STM32 Series F0 F1 F3 F4 F7 L4 G0 G4
1 shunt x x x x x x x x
3 shunt x x x x x x x x
Hall sensors x x x x x x x x
ICS x x x x x x x x
Flux weakening x x x x x x x x
MTPA x x x x x x x x
Sensorless (PLL/ Cordic) x x x x x x x x
Feed forward x x x x x x x x
Single FOC x x x x x x x x
Dual FOC - x x x - - - x
Position control - x x x x x - x

List of examples available in MCSDK version 5.4.3:

Example name Type Control ST board/ kit
P-NUCLEO-IHM001 kit, 3Shunt, Sensorless Single FOC P-NUCLEO-IHM001
Speed-ramp with potentiometer on P-NUCLEO-IHM001 kit Single FOC P-NUCLEO-IHM001
Nucleo-F303RE + IHM07M1+ Bulllrunning motor, 3-shunt, sensorless Single FOC Nucleo-F303RE
Nucleo-F303RE + IHM08M1+ Bulllrunning motor, 3-shunt, sensorless Single FOC Nucleo-F303RE
Gimbal motor Single FOC Nucleo-F303RE
Sawtooth speed ramp Single FOC Nucleo-F303RE
Speed ramp and CCMRAM Single FOC Nucleo-F303RE
Dual Drive and CCMRAM Dual FOC STM32303E-EVAL
Power factor correction Single FOC STEVAL-IHM034V2
STEVAL-IHM042V inverter+ 2 Shinano motors Dual FOC STEVAL-IHM042V
STM32G081 based, single-shunt configuration using HAL Single FOC STM32G081B-EVAL
STM32G081 based, single-shunt configuration using HAL Single FOC STM32G081B-EVAL
FreeRTOS on P-NUCLEO-IHM001 kit Single FOC P-NUCLEO-IHM001
Speed ramp with potentiometer on P-NUCLEO-IHM03 kit Single FOC P-NUCLEO-IHM03
Speed ramp with potentiometer on P-NUCLEO-IHM001 kit-- advanced Single FOC P-NUCLEO-IHM001
B-G431B-ESC1 electronic speed control Single FOC B-G431B-ESC1
STEVAL-ESC001V1 electronic speed control Single FOC STEVAL-ESC001V1
Six-step drive with P-NUCLEO-IHM03 kit Single Six-step P-NUCLEO-IHM03
Six-step drive with NUCLEO-G431RB, IHM07M1 and BullRunning motor Single Six-step NUCLEO-G431RB
Six-step drive with NUCLEO-G431RB, IHM08M1 and Shinano motor Single Six-step NUCLEO-G431RB
Six-step drive with NUCLEO-G431RB, IHM16M1 and BullRunning motor Single Six-step NUCLEO-G431RB
Six-step drive with NUCLEO-F401RE, IHM07M1 and BullRunning motor Single Six-step NUCLEO-F401RE
Six-step drive with STSPIN3204 Single Six-step STEVAL-STSPIN3204
STEVAL-HKI001v2 with STGAP1AS Single FOC STEVAL-HKI001v2
PositionControl on NucleoF303 with Maxon motor Single FOC Nucleo-F303RE
NUCLEO-H745ZI- CortexM4 motor-control application example Single FOC NUCLEO-H745ZI