1. Overview
This article provides an introduction to motor tuning techniques and processes, using NXP MCX_A series MCUs in conjunction with the Freemaster interface for practical demonstrations. It briefly explains the BLDC motor FOC control architecture, enabling users to quickly understand motor control structures. By following the tuning process, users can accelerate their learning of motor tuning techniques, adapt to different motors, and identify issues for parameter adjustments rather than making blind changes. This section focuses on motor tuning principles, as well as related hardware and software setups. For more details, please refer to the WPG Dada Tong blog post “Getting Started with MCXA153 EVB Motor Development”. Due to the extensive content, the article is divided into two parts.
2. BLDC / PMSM Motor FOC Control Architecture
The diagram below illustrates the BLDC / PMSM FOC control architecture. If flux weakening control is not required, controlling Id is unnecessary. It is essential to first verify the accuracy of feedback signals and angle estimation algorithms, followed by current loop control parameters, and finally, speed loop adjustments.

3. BLDC / PMSM Motor Tuning Process
This section and the next will sequentially introduce the steps and content of the tuning process. Please follow the process to gradually verify and tune the motor, completing the motor controller parameter adjustments.
- Motor Parameters
- Feedback Current Sampling
- Sensorless Positioning & Open-Loop Parameter Tuning
- Angle Loop Tuning and Verification
- Current Loop Tuning and Verification
- Speed Loop Tuning and Verification
- Position Loop Tuning and Verification
For detailed hardware and software setup, please refer to the WPG Dada Tong blog post “Getting Started with MCXA153 EVB Motor Development”.
4.1 Software Requirements
Mcuxpresso SDK
Freemaster Version 3.2
SDK_2_16_000_FRDM-MCXA153
4.2 Hardware Requirements
FRDM-MCXA153
FRDM-MC-LVPMSM
24V adapter
5. Motor Parameters
The first step in motor tuning is obtaining accurate motor parameter data. The MCX_A tuning software (Freemaster) generates initial controller parameters based on the motor parameters you provide. These parameters can be derived using pole-zero design, root locus, phase design, maximum overshoot, etc. Providing accurate motor parameters helps reduce tuning time. If motor parameters are unavailable, they can be measured manually. Measurement methods are also provided here for reference.
5.1 Motor Rated Speed, Voltage, Current, and Pole Pairs
First, confirm the motor's rated voltage, current, and speed specifications. These can be found based on the motor model, by searching for related specifications, or by consulting the motor manufacturer. The number of pole pairs can be determined by counting the number of sine waves generated when manually rotating the motor one full turn.
5.2 Motor Resistance and Inductance Measurement
Apply a DC power source to the motor. The voltage should be approximately 5% of the rated voltage or within the current protection limit. Excessive or prolonged DC voltage can cause the motor to overheat, so caution is required. The stator resistance Rs can be calculated based on the voltage and current. To measure inductance, observe the current rise to approximately 68% of the steady-state current using a current clamp meter. The time constant T = Ls / Rs can be used for estimation. Alternatively, an LCR meter can be used for more precise measurements.
5.3 Back-EMF Measurement
Manually rotate the motor and connect two of the UVW wires to observe the back-EMF waveform. For more precise measurements, use three cement resistors to simulate a neutral point.
Ke = Vms / Krpm
{ ( Vpeak to peak )* P ( pole pairs ) * 1000 } / { 2*√2 * Hz ( waveform frequency ) * 60 }

5.4 Motor Parameter Input
For basic software operations, refer to the WPG Dada Tong blog post “Getting Started with MCXA153 EVB Motor Development”. Open the NXP PMSM Freemaster file and select "Parameters" as shown below.

The interface on the right will display "MOTOR PARAMETERS," where you can input the parameters of the motor you wish to control.


5.5 Motor Protection Parameters
Based on the motor's rated speed, voltage, and current, configure the protection trigger values. The minimum motor speed is the limit after entering closed-loop control. Input the values as shown below.

6. Current Sampling
Before motor tuning, ensure that current sampling is reasonable and assess the impact of noise. Select appropriate shunt resistor values and OP amplifier gains based on the motor's rated and peak currents to ensure accurate current feedback to the controller. Also, verify that the current offset matches the software. This is the first step in motor tuning. If current feedback is not functioning correctly, subsequent tuning will not proceed smoothly. Additionally, avoid excessive filtering that could cause signal delay when addressing noise issues.
6.1 OP & Shunt Resistors
The diagram below shows the OP amplifier circuit. Ensure that the shunt resistor value is not too small, as unclear current signals are more susceptible to noise. Additionally, calculate whether the shunt resistor can handle the operating power: P = I * V. Adjust the OP amplifier gain to ensure clear feedback signals and that the controller's operating range does not exceed the VCC limit.

6.2 Offset
Since motor current feedback includes negative signals, an offset is required to bring the signal within the MCU's acceptable range. For example, in a 3.3V system, design the offset to be approximately 1.65V. Conversely, in a 5V system, design the offset to be approximately 2.5V.

7. Sensorless Positioning & Open-Loop Tuning
Based on the motor's rated current, initially set the positioning force to one-third of the rated current or 5% of the rated voltage. The actual value depends on the motor's characteristics and the load during startup. Adjust the positioning current and time to ensure successful positioning and minimize vibrations.
7.1 Positioning Parameter Configuration
Initially configure 24 * 5 / 100 = 1.2 (5%), set 1V, and adjust the positioning time.
Test multiple times to ensure the motor can start successfully from any position.
7.2 Open-Loop Startup Parameters
Adjust the open-loop parameters as shown below. Modify the current to determine the startup torque, configure the open-loop speed, and set the ramp-up. Soft-start is generally used to avoid excessive startup current. When switching from open-loop to closed-loop, verify the actual speed and speed command error. Configure the error limit; if the error is too large, the motor control will shut down.
Adjust the motor startup parameters as shown below.


7.3 Open-Loop Tuning
Write a simple open-loop program to test the approximate Iq required to start the motor. Use the tested Iq value during the sensorless open-loop operation. Open-loop tuning can also verify whether the motor's three-phase current readings are correct and whether the angle calculation function operates normally.
The diagram below shows the Openloop Control interface.

To use current mode in open-loop, input "1" in the red box below after powering on but before switching modes.

Configure the parameters for current open-loop operation as shown below.

Configure the parameters for voltage open-loop operation as shown below.

7.4 Actual Waveform
Measure the actual motor current to observe the positioning and open-loop states. Verify whether the calculated speed matches the expected speed.

8. MCX_A BLDC Motor Tuning Process (Part 2)
The next section explains PID principles and tuning techniques, continuing with the overall motor tuning process.
Angle Loop Tuning and Verification -> Current Loop Tuning and Verification -> Speed Loop Tuning and Verification
