10. Switch the main application switch on and set a non-zero value in the “M1 MCAT Uq Required” variable. The FOC
algorithm uses the estimated position to run the motor.
8.9 Encoder sensor setting
The encoder sensor settings are in the “Sensors” tab. The encoder sensor enables you to compute speed and position for the
sensored speed. For a proper encoder counting, set the number of encoder pulses per one revolution and the proper counting
direction. The number of encoder pulses is based on information about the encoder from its manufacturer. If the encoder sensor
has more pulses per revolution, the speed and position computing is more accurate. The counting direction is provided by
connecting the encoder signals to the NXP Freedom board and also by connecting the motor phases. The direction of rotation can
be determined as follows:
1. Navigate to the “Scalar & Voltage Control” tab in the project tree and select "SCALAR_CONTROL" in the "M1 MCAT
Control" variable.
2. Turn the application switch on. The application state changes to “RUN”.
3. Set the required frequency value in the “M1 Scalar Freq Required” variable; for example 15 Hz. The motor starts running.
4. Check the encoder direction. Select the “Encoder Direction Scope” from the “Scalar & Voltage Control” project tree. If the
encoder direction is right, the estimated speed is equal to the measured mechanical speed. If the measured mechanical
speed is opposite to the estimated speed, the direction must be changed. The first way is change "M1 Encoder Direction"
variable - 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
NXP Semiconductors
Remote control using FreeMASTER
MCUXpresso SDK Field-Oriented Control (FOC) of 3-Phase PMSM and BLDC motors, Rev. 0, 01/2022
User Guide
35 / 50