Advertisement

Quick Links

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

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the MCUXpresso and is the answer not in the manual?

Questions and answers

Summary of Contents for NXP Semiconductors MCUXpresso

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

    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 MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 2 / 50...
  • Page 3: Chapter 1 Introduction

    Default motor (Torque) Speed FOC Speed FOC FOC (Servo) Teknic M-2310P MIMXRT1170-EVK ✓ ✓ ✓ ✓ ✓ ✓ motor (with ENC) MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 3 / 50...
  • Page 4: Chapter 2 Hardware Setup

    (encoder, hall). The block diagram of this complete NXP motor-control development kit is shown in Figure Figure 1. Motor-control development platform block diagram MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 4 / 50...
  • Page 5 Table 2. Teknic M-2310P motor parameters Characteristic Symbol Value Units Rated voltage Rated speed 6000 Rated torque 0.247 Rated power Continuous current Number of pole-pairs MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 5 / 50...
  • Page 6 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 MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 6 / 50...
  • Page 7 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 All others jumpers are open. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 7 / 50...
  • Page 8 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. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide...
  • Page 9 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. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide...
  • Page 10 NXP Semiconductors Hardware setup Figure 8. Assembled Freedome system MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 10 / 50...
  • Page 11: Chapter 3 Rt Crossover Processors Features And Peripheral Settings

    • When the ADC conversion is completed, the ADC_ETC ISR (ADC_ETC interrupt) is entered. The FOC calculation is done in this interrupt. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 11 / 50...
  • Page 12 • The FLEXPWM2_PWM1_OUT_TRIG0_1 output trigger (generated by submodule 0) is connected to ADC_ETC_XBAR0_TRIG0. pinmux.c . • The encoder signal Phase A and Phase B are configured in MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 12 / 50...
  • Page 13 • The other settings are set to default. 3.2 RT family - CPU load and memory usage The following information apply to the application built using the MCUXpresso IDE in the debug and release configurations. The .map linker file, including the 4-KB tables below show the memory usage and CPU load.
  • Page 14 RTCESL_cfg.h header file by using macros RAM_OPTIM_HIGH, RAM_OPTIM_MEDIUM or RAM_OPTIM_LOW. NOTE Memory usage and maximum CPU load can differ depending on the used IDEs and settings. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 14 / 50...
  • Page 15: Chapter 4 Project File And Ide Workspace Structure

    —for the IAR Embedded Workbench IDE. • armgcc —for the GNU Arm IDE. • MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 15 / 50...
  • Page 16 —contains the software routines that are executed when the application is in a particular state or • state transition. state_machine —contains the state machine functions for the FAULT, INITIALIZATION, STOP, and RUN states. • MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 16 / 50...
  • Page 17: Chapter 5 Tools

    • 6314 - No section matches pattern xxx.o (yy). By default, there are no other warnings shown during the compiling process. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 17 / 50...
  • Page 18: Chapter 6 Motor-Control Peripheral Initialization

    M1_MCDRV_CURR_3PH_CALIB() calls. — void M1_MCDRV_ADC_GET(mcdrv_adc_t*) —this function reads and calculates the actual values of the 3-phase currents, DC-bus voltage, and auxiliary quantity. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 18 / 50...
  • Page 19 M1_MCDRV_QD_SET_DIRECTION(mcdrv_qd_enc_t*) —this function sets the direction of the — quadrature encoder. — void M1_MCDRV_QD_CLEAR(mcdrv_qd_enc_t*) —this function clears the internal variables and decoder counter. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 19 / 50...
  • Page 20: Chapter 7 User Interface

    If you are using your own motor (different from the default motors), make sure to identify all motor parameters. The automated parameter identification is described in the following sections. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide...
  • Page 21: Chapter 8 Remote Control Using Freemaster

    1. Go to the “Project -> Options -> Comm” tab and make sure that the correct COM port is selected and the communication speed is set to 19200 bps. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide...
  • Page 22 F5 to reload the MCAT HTML page. MCAT may require internet connection. If no internet connection is available, CSS and icons may not be properly loaded. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide...
  • Page 23 The application can be controlled through the FreeMASTER variables watch which correspond to the control structure selected in FreeMASTER project tree. This is useful for application tuning and debugging. Required control structure must be selected in the MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide...
  • Page 24 By changing the polarity of the current "M1 MCAT Iq Required", the motor changes the direction of rotation. Supposing that the BEMF observer is tuned correctly, the current PI controllers can be tuned using the current FOC control structure. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide...
  • Page 25 (in the “Speed loop” menu tab) because the voltage on the DC-bus can rise when braking the quickly spinning shaft. It may cause the overvoltage fault. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide...
  • Page 26 This section shows how to identify user motor parameters using MID. MID is written in floating-point arithmetics. Each MID algorithm is described in detail in algorithms. MID is controlled via the FreeMASTER "Motor Identification" page shown in Figure MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 26 / 50...
  • Page 27 NXP Semiconductors Remote control using FreeMASTER Figure 20. MID FreeMASTER control MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 27 / 50...
  • Page 28 MID: Start Result variable. measurement and not set manually, the MID is not started and an error is reported via the MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 28 / 50...
  • Page 29 . The estimated inductances can be observed in the "Ld" or "Lq" scopes. The following parameters can be changed during the runtime: MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 29 / 50...
  • Page 30 J and the viscous friction B can be identified using a test with the known generated torque T and the The moment of inertia loading torque load MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 30 / 50...
  • Page 31 , the speed control loop bandwidth , and 0,Current 0,Speed the mechanical parameters measurement torque must be set. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 31 / 50...
  • Page 32 [V.sec/rad] BEMF constant 0.001-1 [kg.m System inertia 0.00001-0.1 Iph nom Motor nominal phase current 0.5-8 Table continues on the next page... MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 32 / 50...
  • Page 33 The shape of the motor currents should be close to a sinusoidal shape (Figure 22). Use the following equation for calculation V/Hz factor: MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 33 / 50...
  • Page 34 9. Enable the voltage FOC mode in the "M1 MCAT Control" variable while the main application switch "M1 Application Switch" is turned off. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 34 / 50...
  • Page 35 - only 0 or 1 values is allowed. The second way is invert the encoder wires—phase A and phase B (or the other way round). Figure 24. Encoder direction—right direction MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 35 / 50...
  • Page 36 • The loop bandwidth is low (110 Hz) and the settling time of the Id current is long (Figure 26). MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 36 / 50...
  • Page 37 • The loop bandwidth is high (700 Hz) and the response time of the Id current is very fast, but with oscillation and overshoot (see Figure 28). MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 37 / 50...
  • Page 38 3. The start-up ramp increment is in the “Sensorless” tab and its value is usually higher than that of the speed loop ramp. Figure 29. Speed profile MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide...
  • Page 39 2. Set the required bandwidth and attenuation of the BEMF observer—the bandwidth is typically set to a value close to the current loop bandwidth. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide...
  • Page 40 • The “SL_Ki” value is low and the “Speed Actual Filtered” does not achieve the “Speed Ramp” (see Figure 31). MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 40 / 50...
  • Page 41 • The speed loop response has a small overshoot and the “Speed Actual Filtered” settling time is sufficient. Such response can be considered optimal (see Figure 33). MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 41 / 50...
  • Page 42 3. Repeat the previous steps until you achieve the required position response. The “PL_Kp” value is low and the actual position response on the required position is very slow. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide...
  • Page 43 Figure 35. Position controller response—PL_Kp value is too high and the actual position overshoots The “PL_Kp” value and the actual position response are optimal. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide...
  • Page 44 NXP Semiconductors Remote control using FreeMASTER Figure 36. Position controller response—the actual position response is good MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 44 / 50...
  • Page 45: Chapter 9 Conclusion

    The motor user interface and remote control using FreeMASTER are as follows. The motor parameters identification theory and the identification algorithms are described in Identifying parameters of user motor. MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 45 / 50...
  • Page 46: Chapter 10 Acronyms And Abbreviations

    Proportional Integral controller Phase-Locked Loop PMSM Permanent Magnet Synchronous Machine Pulse-Width Modulation Quadrature Decoder Quad Timer Universal Serial Bus XBAR Inter-Peripheral Crossbar Switch MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 46 / 50...
  • Page 47: Chapter 11 References

    Motor Control Application Tuning (MCAT) Tool for 3-Phase PMSM (document AN4642) PMSM Field-Oriented Control on MIMXRT10xx EVK User's Guide (document PMSMFOCRT10xxUG) PMSM Field-Oriented Control on MIMXRT10xx EVK (document AN12214) MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 47 / 50...
  • Page 48: Chapter 12 Useful Links

    FRDM-MC-PMSM Freedome Development Platform MCUXpresso IDE - Importing MCUXpresso SDK MCUXpresso Config Tool 11. MCUXpresso SDK Builder (SDK examples in several IDEs) https://mcuxpresso.nxp.com/en/welcome MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 48 / 50...
  • Page 49: Chapter 13 Revision History

    Table 13. Revision history Revision number Date Substantive changes 01/2022 Initial release MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022 User Guide 49 / 50...
  • Page 50 How To Reach Us Information in this document is provided solely to enable system and software implementers to use NXP products. There are no express or implied copyright licenses granted hereunder Home Page: to design or fabricate any integrated circuits based on the information in this document. NXP nxp.com reserves the right to make changes without further notice to any products herein.

Table of Contents