Summary of Contents for NXP Semiconductors PMSMMCXN9XXEVK
Page 1
PMSMMCXN9XXEVK MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Rev. 0 — 5 December 2023 User guide Document information Information Content Keywords MCX-N9XX-EVK , PMSM, FOC, MCAT, MID, Motor control, Sensorless control, Speed control, Servo control, Position control...
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 1 Introduction SDK motor control example user guide describes the implementation of the motor-control software for 3-phase Permanent Magnet Synchronous Motors (PMSM) using following NXP platforms: •...
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 2 Hardware setup The following chapter describes the used hardware and the setup needed for proper example working 2.1 Linix 45ZWN24-40 motor The Linix 45ZWN24-40 motor is a low-voltage 3-phase permanent-magnet motor with hall sensor used in PMSM applications.
Page 4
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Table 3. Teknic M-2310P motor parameters ...continued Characteristic Symbol Value Units Rated torque 0.247 Rated power Continuous current Number of pole-pairs Figure 2. Teknic M-2310P permanent magnet synchronous motor For the sensorless control mode, you only need the power input wires.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Motor phases (Mating face shown) Encoder wires Color Signal Color Signal DRAIN x3 P DRAIN GRY/WHT COMM T-R 16AWG RED PHASE S ENC I 16AWG WHT...
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors FRDM-MC-LVPMSM Controler card FRDM-MC-LVPMSM Parts 24-48V 5.5V Controller Card Parts Power Supply 3.3V Polarity Power Supply Protection Open MOSFET 6xPWM JTAG Predriver MOSFET Target Ia, Ib, Ic...
Page 7
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors FRDM ecosystem shield modules and Mikroe click boards. The onboard MCU-Link debug probe is based on the LPC55S69 MCU. Table 4. MCXN9XX-EVK jumper settings Jumper Setting Jumper...
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 2.4.1 Hardware assembling 1. Connect the FRDM-MC-LVPMSM shield on top of the MCXN9XX-EVK board (there is only one possible option). 2. Connect the 3-phase motor wires to the screw terminals (J7) on the Freedom PMSM power stage.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 3 Processors features and peripheral settings This chapter describes the peripheral settings and application timing. 3.1 MCXN94x ® ® The MCX N94x is based on dual high-performance Arm...
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors • The eFlexPWM submodule SM0 generates trigger 0 (ADC Trigger) when the counter counts to a value equal to the VAL4 value. ADC Trigger is delayed of approximately Tdeatime/2. This delay ensures correct current sampling at the duty cycles close to 100 %.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors • The direction of counting is set in the M1_POSPE_ENC_DIRECTION macro. • The modulo counting and the modulus counting roll-over/under to increment/decrement revolution counter are enabled.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 4 Project file and IDE workspace structure All the necessary files are included in one package, which simplifies the distribution and decreases the size of the final package. The directory structure of this package is simple, easy to use, and organized logically. The folder structure used in the IDE differs from the structure of the PMSM package installation, but it uses the same files.
Page 13
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors you tailor the application for a different motor using the Motor Control Application Tuning (MCAT) tool, the tool generates this file at the end of the tuning process.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 5 Motor-control peripheral initialization The motor-control peripherals are initialized by calling the MCDRV_Init_M1() function during MCU startup and before the peripherals are used. All initialization functions are in the mc_periph_init.c source file and the mc_periph_init.h header file.
Page 15
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors – 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. • The available APIs for the PWM are: –...
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 6 User interface The application contains the demo mode to demonstrate motor rotation. You can operate it either using the user button, or using FreeMASTER. The NXP development boards include a user button associated with a port interrupt (generated whenever one of the buttons is pressed).
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 7 Remote control using FreeMASTER This section provides information about the tools and recommended procedures to control the sensor/ sensorless PMSM Field-Oriented Control (FOC) application using FreeMASTER. The application contains the embedded-side driver of the FreeMASTER real-time debug monitor and data visualization tool for communication with the PC.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Figure 13. FreeMASTER communication setup window 2. Ensure, that your computer is communicating with the plugged board. Unplug and then plug in the USB cable and reopen the FreeMASTER project.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Figure 14. Default symbol file 5. Click OK and restart the FreeMASTER communication. For more information, check FreeMASTER User Guide. 7.3 Motor Control Aplication Tuning interface (MCAT)
Page 20
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors tuning parameters to MCU's flash memory, m1_pmsm_appcofig.h must be saved, code recompiled, and downloaded to MCU. Note: Path to mX_pmsm_appcofig.h file also composed from Board ID value. Therefore, FreeMASTER must be connected to the target, and Board ID value read prior using Save/Load buttons.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors • Sensors: this page contains the encoder parameters and position observer parameters. • Sensorless: this page enables you to tune the parameters of the BEMF observer, tracking observer, and open-loop startup.
Page 22
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Table 8. Parameters tab inputs ...continued MCAT group MCAT name Equation name Description Unit use the electrical parameters identification and then fill manually. Stator quadrature inductance. Obtain from motor manufacturer...
Page 23
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Table 8. Parameters tab inputs ...continued MCAT group MCAT name Equation name Description Unit E block Eblock Blocked rotor detection. When BEMF voltage drops under E E block per...
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors • M1_UDCB_IIR_A1 = -(2 * pi * UdcbIIRf0 * currentLoopSampleTime - 2) / (2 + (2 * pi * UdcbIIRf0 * currentLoopSampleTime)) • M1_SCALAR_VHZ_FACTOR_GAIN = UphNom*k_factor/100/(Nnom*Pp/60) •...
Page 25
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Table 10. Speed loop tab input MCAT group MCAT name Equation name Description Unit Loop parameters Sample time speedLoopSampleTime Slow control loop period. This [sec] disabled value is read from...
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 7.3.1.5 Sensors Available at sensored (encoder) applications only. This tab enables setting the encoder properties and tuning encoder's tracking observer. MCAT group and MCAT name help to locate the parameter in MCAT layout.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 3. No pending fault. Check variable "M1 Fault Pending" in "Motor M1" project tree subblock. If there is some value, first remove the cause of the fault, or disable fault checking. (for example in variable "M1 Fault Enable Blocked Rotor")
Page 29
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors α_req d_req PMSM β_req αβ q_req θ Sensor θ init ω Frequency 2π Integrator Figure 17. Voltage - Open loop control For run motor in Voltage - Open loop control, follow these steps: 1.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 4. In variable "M1 Openloop Required Id" and "M1 Openloop Required Iq" set required values. 5. In variable "M1 Openloop Theta Electrical" set required initial position.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 2. Switch variable "M1 MCAT Control" on "SPEED_FOC". 3. Choose between sensored and sensorless control in variable "M1 MCAT POSPE Sensor". 4. In variable "M1 Speed Required" set the required speed. (i.e. 1000rpm). The motor automatically starts spinning.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Figure 23. Faults in variable watch located in "Motor M1" subblock 7.5.1 Variable "M1 Fault Pending" It shows actually persisting faults, which means that the fault indicated during fault conditions is accomplished.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 7.5.2 Variable "M1 Fault Captured" If any fault condition appears, the fault captured is indicated. Similar to fault pending, fault captured is shown in the BIN format, but every fault type has its own variable ("M1 Fault Captured Over Curent" and others). For example, if the undervoltage fault condition is accomplished, fault captured is indicated.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 7.6 Initial motor parameters and harware configuration Motor control examples contain two or more configuration files: m1_pmsm_appconfig.h, m2_pmsm_appconfig.h, and so on. Each contains constants tuned for the selected motor (Linix 45ZWN24-40 or Teknic M-2310P for the Freedom development platform and Mige 60CST-MO1330 for the High-voltage platform).
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Table 14. Fault limits ...continued Parameter Units Description Typical range U DCB under Trigger value at which 0 ~ U DCB Over the undervoltage fault is detected...
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Figure 26. MID FreeMASTER control 7.7.1 Switch between Spin and MID Users can switch between two modes of application: Spin and MID (Motor Identification). Spin mode is used...
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 7.7.2 Motor parameter identification using MID The whole MID is controlled via the FreeMASTER "Variable Watch". The Motor Identification (MID) subblock is shown in Figure 26. Following is the motor parameter identification workflow: 1.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Table 18. MID Start Result variable MID Start Result mask Description Troubleshooting b#00 0001 Error during initialization electrical Check whether inputs to the MCAA_ parameters measurement EstimRLInit_FLT are valid...
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 7.8.4 Number of pole-pair assistant The number of pole-pairs can only be measured with a position sensor. However, there is a simple assistant to determine the number of pole-pairs (PP_ASSIST). The number of the pp assistant performs one electrical revolution, stops for a few seconds, and then repeats.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Figure 27. PMSM identification tab 7.9 Electrical parameters measurement control This section describes how to control electrical parameters measurement, which contains measuring stator resistance R , direct inductance L , and quadrature inductance L .
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors • MID: Config El I DC positive max - Maximum positive DC current for the L dependency map measurement. Injected AC and DC currents are automatically derived from the MID: Config El I DC (estim Lq) and MID: Config El I DC positive max currents.
Page 43
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors (11) Where, = nominal voltage phnom = ratio within range 0-100% factor pp = number of pole-pairs = nominal revolutions Note: Changes V/Hz factor is not propagated to the m1_pmsm_appconfig.h.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 9. Enable the voltage FOC mode in the "M1 MCAT Control" variable while the main application switch "M1 Application Switch" is turned off. 10. Switch on the main application switch on and set a non-zero value in the “M1 MCAT Uq Required” variable.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Figure 31. Encoder direction—wrong direction 7.10.2 Alignment tuning For the alignment parameters, navigate to the "Parameters" MCAT tab. The alignment procedure sets the rotor to an accurate initial position and enables you to apply full startup torque to the motor. A correct initial position is needed mainly for high startup loads (compressors, washers, and so on).
Page 46
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Figure 32. Slow step response of the Id current controller • The loop bandwidth (300 Hz) is optimal and the response time of the Id current is sufficient (see Figure Figure 33. Optimal step response of the Id current controller...
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Figure 34. Fast step response of the Id current controller 7.10.4 Speed ramp tuning To tune speed ramp parameters, follow the steps below: 1. The speed command is applied to the speed controller through a speed ramp. The ramp function contains two increments (up and down) which express the motor acceleration and deceleration per second.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 7.10.5 Open loop startup To tune open loop startup parameters, follow the steps below: 1. The startup process can be tuned by a set of parameters located in the "Sensorless" tab. Two of them (ramp increment and current) are accessible in both tuning modes.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 1. Navigate to the "Sensorless" MCAT tab. 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.
Page 50
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Figure 37. Speed controller response—SL_Ki value is low, Speed Ramp is not achieved • The "SL_Kp" value is low, the "Speed Actual Filtered" greatly overshoots, and the long settling time is unwanted.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Figure 39. Speed controller response—speed loop response with a small overshoot 7.10.8 Position P controller tuning The position control loop can be tuned using the proportional gain "M1 Position Loop Kp Gain" variable. A proportional controller can be used to unpretend the position-control systems.
Page 52
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Figure 40. Position controller response—PL_Kp value is low, the actual position response is very slow The "PL_Kp" value is too high and the actual position overshoots the required position.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 8 Conclusion This application note describes the implementation of the sensor and sensorless field-oriented control of a 3- phase PMSM. The motor control software is implemented on NXP MCX-N9XX-EVK board with the FRDM- MC-LVPMSM NXP Freedom development platform.
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 9 Acronyms and abbreviations Table 19 lists the acronyms and abbreviations used in this document. Table 19. Acronyms and abbreviations Acronym Meaning Analog-to-Digital Converter ACIM Asynchronous Induction Motor...
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 10 References These references are available on www.nxp.com: • Sensorless PMSM Field-Oriented Control (document DRM148) • Motor Control Application Tuning (MCAT) Tool for 3-Phase PMSM (document AN4642) •...
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 11 Useful links • MCUXpresso SDK for Motor Control www.nxp.com/sdkmotorcontrol • Motor Control Application Tuning (MCAT) Tool • FRDM-MC-PMSM Freedome Development Platform • MCUXpresso IDE - Importing MCUXpresso SDK •...
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors 12 Revision history Section 12 summarizes the changes done to the document since the initial release. Table 20. Revision history Revision number Date Substantive changes 12/2023 Initial release PMSMMCXN9XXEVK All information provided in this document is subject to legal disclaimers.
NXP Semiconductors. In the event that customer uses the product for design-in and use in In no event shall NXP Semiconductors be liable for any indirect, incidental, automotive applications to automotive specifications and standards, punitive, special or consequential damages (including - without limitation - customer (a) shall use the product without NXP Semiconductors’...
Page 60
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Tables Tab. 1. Available example type, supported motors Tab. 11. Sensors tab input ..........26 and control methods ......... 2 Tab. 12. Sensorless tab input ........26 Tab.
Page 61
PMSMMCXN9XXEVK NXP Semiconductors MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC Motors Figures Fig. 1. Linix 45ZWN24-40 permanent magnet Fig. 24. Undervoltage fault is indicated (pending) ..33 synchronous motor ..........3 Fig. 25. Undervoltage fault is captured ......34 Fig.
Need help?
Do you have a question about the PMSMMCXN9XXEVK and is the answer not in the manual?
Questions and answers