Introduction
This document describes how to set up and generate a motor control firmware project enabling the position control feature to
drive a three-phase PMSM motor using the X-CUBE-MCSDK STM32Cube Expansion Package. It also explains how to tune the
system and develop a demonstration program using the available API (application programming interface).
The descriptions for X-CUBE-MCSDK in this document apply also entirely to the X-CUBE-MCSDK-FUL STM32Cube Expansion
Package.
Position control of a three-phase permanent magnet motor
using XCUBEMCSDK or XCUBEMCSDK-FUL
AN5464
Application note
AN5464 - Rev 1 - April 2020
For further information contact your local STMicroelectronics sales office.
www.st.com
1 Overview
The position control mode is available since the version v5.4.3 of the X-CUBE-MCSDK Expansion Package. It
allows the electric drive to move the motor to a specified target mechanical position (angle) in a settled time
(duration) following a programmed trajectory composed of three phases: acceleration, constant speed, and
deceleration. Following such defined trajectory is mandatory to reach the target position with zero angular speed
and therefore avoid oscillations around the settled position.
1.1 Main features
Position control mode available for all the control boards supported by X-CUBE-MCSDK
Compatible with:
Quadrature encoder (with index signal)
Magnetic sensor (with encoder interface)
Trajectory calculator
Constant jerk
Acceleration integration
Speed integration
Position integration
Current control for field orientation (FOC)
1.2 Hardware prerequisites
A control board supported by X-CUBE-MCSDK, featuring an STM32 microcontroller based on the Arm
®
Cortex
®
-M core
A power board or expansion board supported by X-CUBE-MCSDK (three-shunt current sensing is advised)
Optionally, a complete inverter supported by X-CUBE-MCSDK
The main power supply (according to the host board used)
A USB Type-A to Mini-B cable for programming and debugging (see the exact requirements of the board
used)
A PMSM motor with quadrature encoder (with index signal)
Note: Arm is a registered trademark of Arm Limited (or its subsidiaries) in the US and/or elsewhere.
All other trademarks are the property of their respective owners.
1.3 Software prerequisites
STSW-LINK009: ST-LINK USB driver
STSW-LINK004: STM32 ST-LINK Utility
STSW-LINK004 is needed only to update ST-LINK firmware to the latest version
A Windows
®
PC with the supported development toolchain:
IAR
– EWARM
Keil
®
- MDK-ARM
STMicroelectronics - STM32CubeIDE
X-CUBE-MCSDK version v5.4.3 or later
AN5464
Overview
AN5464 - Rev 1
page 2/22