NXP Semiconductors MCUXpresso User manual

MCUXpresso SDK Field-Oriented Control
(FOC) of 3-Phase PMSM and BLDC motors
NXP Semiconductors Document identifier: PMSMRT1170
User Guide Rev. 0, 01/2022

Contents
Chapter 1 Introduction........................................................................................... 3
Chapter 2 Hardware setup.....................................................................................4
Chapter 3 RT crossover processors features and peripheral settings.................11
Chapter 4 Project file and IDE workspace structure............................................ 15
Chapter 5 Tools................................................................................................... 17
Chapter 6 Motor-control peripheral initialization.................................................. 18
Chapter 7 User interface......................................................................................20
Chapter 8 Remote control using FreeMASTER...................................................21
Chapter 9 Conclusion.......................................................................................... 45
Chapter 10 Acronyms and abbreviations.............................................................46
Chapter 11 References........................................................................................47
Chapter 12 Useful links........................................................................................48
Chapter 13 Revision history.................................................................................49
NXP Semiconductors
MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022
User Guide 2 / 50

Chapter 1
Introduction
This user's guide describes the implementation of the sensorless motor-control software for 3-phase Permanent Magnet
Synchronous Motors (PMSM), including the motor parameters identification algorithm, on the NXP i.MX RT series crossover
processors. The sensorless control software and the PMSM control theory in general are described in design reference manual
DRM148
Sensorless PMSM Field-Oriented Control (FOC)
. The NXP Freedom (FRDM-MC-LVPMSM) is used as the hardware
platform for the PMSM control reference solution. The hardware-dependent part of the sensorless and sensored control software,
including a detailed peripheral setup and the Motor Control (MC) peripheral drivers, are addressed as well. The motor parameters
identification theory and algorithms are presented in this document. The last part of the document introduces and explains the
user interface represented by the Motor Control Application Tuning (MCAT) page based on the FreeMASTER run-time debugging
tool. These tools provide a simple and user-friendly way for the motor parameter identification, algorithm tuning, software control,
debugging, and diagnostics.
This document describes how to run and control the Permanent Magnet Synchronous Motor (PMSM) project using i.MX RT
Series Crossover Processors with the Freedom development board. The software provides sensorless/sensored field-oriented
vector position, speed, torque, and scalar control. You can control the application using the board buttons or via FreeMASTER.
The motor identification and application tuning is done using the MCAT tool integrated in the FreeMASTER page. The required
software, hardware setup, jumper settings, project arrangement, and user interface are described in the following sections. For
more information, visit www.nxp.com/motorcontrol_pmsm.
Table 1. Supported devices and control methodes
Possible control methods in SDK example
Device Default motor Scal
ar
Volt
age
Current FOC
(Torque)
Sensorless
Speed FOC
Sensored
Speed FOC
Sensored Position
FOC (Servo)
MIMXRT1170-EVK Teknic M-2310P
motor (with ENC) ✓ ✓ ✓ ✓ ✓ ✓
NXP Semiconductors
MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022
User Guide 3 / 50

Chapter 2
Hardware setup
The PMSM Field-Oriented Control (FOC) application runs on the FRDM-MC-LVPMSM development platform with the i.MX
RT1170-EVK development tools in combination with the Teknic M-2310P-LN permanent magnet synchronous motor or with the
i.MX RT1010-EVK development tool in combination with the Linix 45ZWN24-40 permanent magnet synchronous motor.
2.1 FRDM-MC-LVPMSM
This evaluation board, in a shield form factor, effectively turns an NXP Freedom development board or an evaluation board into
a complete motor-control reference design, compatible with existing NXP Freedom development boards and evaluation boards.
The Freedom motor-control headers are compatible with the Arduino™ R3 pin layout.
The FRDM-MC-LVPMSM low-voltage, 3-phase Permanent Magnet Synchronous Motor (PMSM) Freedom development platform
board has the power supply input voltage of 24-48 VDC with a reverse polarity protection circuitry. The auxiliary power supply
of 5.5 VDC is created to supply the FRDM MCU boards. The output current is up to 5 A RMS. The inverter itself is realized by a
3-phase bridge inverter (six MOSFETs) and a 3-phase MOSFET gate driver. The analog quantities (such as the 3-phase motor
currents, DC-bus voltage, and DC-bus current) are sensed on this board. There is also an interface for speed and position sensors
(encoder, hall). The block diagram of this complete NXP motor-control development kit is shown in Figure 1.
Figure 1. Motor-control development platform block diagram
NXP Semiconductors
MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022
User Guide 4 / 50

Figure 2. FRDM-MC-LVPMSM
The FRDM-MC-LVPMSM board does not require a complicated setup. For more information about the Freedom development
platform, see www.nxp.com.
2.2 Teknic M-2310P motor
The Teknic M-2310P-LN-04K motor is a low-voltage 3-phase permanent-magnet motor used in PMSM applications. The motor
has two feedback sensors (hall and encoder). For information on the wiring of feedback sensors, see the datasheet on the
manufacturer web page. The motor parameters are listed in Table 2.
Table 2. Teknic M-2310P motor parameters
Characteristic Symbol Value Units
Rated voltage Vt 40 V
Rated speed - 6000 RPM
Rated torque T 0.247 Nm
Rated power P 170 W
Continuous current Ics 7.1 A
Number of pole-pairs pp 4 -
NXP Semiconductors
Hardware setup
MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022
User Guide 5 / 50

Figure 3. Teknic M-2310P permanent magnet synchronous motor
For the sensorless control mode, you need only the power input wires. If used with the hall or encoder sensors, connect also the
sensor wires to the NXP Freedom power stage.
Figure 4. Teknic motor connector type 1
NXP Semiconductors
Hardware setup
MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022
User Guide 6 / 50

Figure 5. Teknic motor connector type 2
2.3 i.MX RT1160/1170 Evaluation Kit
The MIMXRT1160-EVK and MIMXRT1170-EVK are two-layer low-cost through-hole USB-powered PCBs. At its heart lies the
i.MX RT11xx crossover MCU. The dual core i.MX RT1160 runs on the Cortex-M7 core at 600 MHz and Arm Cortex-M4 at 240 MHz
and i.MX RT1170 runs on the Cortex-M7 core at 1 GHz and Arm Cortex-M4 at 400 MHz, while providing best-in-class security.
Table 3. MIMXRT1160-EVK and MIMXRT1170-EVK jumper settings
Jumper Setting Jumper Setting Jumper Setting
J5 1-2 J31 1-2 J59 1-2
J6 1-2 J32 1-2 J60 1-2
J7 1-2 J38 5-6 J61 1-2
J8 1-2 J41 1-2 J62 1-2
J21 1-2 J53 1-2
J27 2-3 J56 2-3
All others jumpers are open.
NXP Semiconductors
Hardware setup
MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022
User Guide 7 / 50

Figure 6. MIMXRT1170-EVK board with highlighted jumper settings (valid also for MIMXRT1160-EVK)
For a correct connection, the motor-control application requires remove and solder some resistors. Please, solder resistor R1841
and R1842 for encoder and remove resistors R188 and R193 for right ADC measuring. These resistors are located on the top of
the EVK board. For more details, see the schematic.
NXP Semiconductors
Hardware setup
MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022
User Guide 8 / 50

Figure 7. Resistor needed for proper operation on the top side of the EVK board
For more information about the MIMXRT1160-EVK or MIMXRT1170-EVK hardware (processor, peripherals, and so on), see the
MIMXRT1160 EVK Board Hardware User’s Guide or MIMXRT1170 EVK Board Hardware User’s Guide.
Hardware assembling
1. Connect the FRDM-MC-LVPMSM shield on top of the MIMXRT1160-EVK or MIMXRT1170-EVK board (there is only one
possible option).
Watch out for unwanted connections between bottom of FRDM-MC-PMSM and jumpers on top of MIMXRT11xx-
EVK.
NOTE
2. Connect the 3-phase motor wires to the screw terminals (J7) on the Freedom PMSM power stage.
3. On the top of FRDM-MC-PMSM shield connect by wires following pins:
Table 4. MIMXRT1170-EVK pin assignment
FRDM-MC-LVPMSM Connection On the MIMXRT1160/1170-EVK is pin
connected to
CUR_A J2, 1 <-> J4, 2 GPIO_AD_10
CUR_B J2, 3 <-> J4, 6 GPIO_AD_12
CUR_C J2, 5 <-> J4, 8 GPIO_AD_13
VOLT_DCB J2, 7 <-> J4, 4 GPIO_AD_11
CUR_DCB J2, 9 <-> J2, 8 GPIO_AD_30
4. Plug the USB cable from the USB host to the Debug USB connector (J11) on the EVK board.
5. Plug the 24-V DC power supply to the DC power connector on the Freedom PMSM power stage.
NXP Semiconductors
Hardware setup
MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022
User Guide 9 / 50

Figure 8. Assembled Freedome system
NXP Semiconductors
Hardware setup
MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022
User Guide 10 / 50
Table of contents

















