The direction of the motor spinning is set by using pUserInputRegs->periphCfg1.b.dirInput. FOC application provides two methods below to set the direction:
- A software configuration is applied by setting dirInput as 1h (clockwise) or 2h (counterclockwise).
- When dirInput is set as 1h, FOC application drives the clockwise rotation: OUTA-OUTB-OUTC
- When dirInput is set as 2h, FOC application drives the counterclockwise rotation: OUTA-OUTC-OUTB
- A hardware input pin (DIR) is configured to set the motor spinning direction by setting dirInput as 0h or 3h.
- DIR input HIGH, FOC application drives the clockwise rotation: OUTA-OUTB-OUTC
- DIR input LOW, FOC application drives the counterclockwise rotation: OUTA-OUTC-OUTB
Using pUserInputRegs->periphCfg1.b.dirChangeMode to determine the FOC application response to the change of motor spinning direction:
- When dirChangeMode is set as 0b, FOC application follows motor stop options and ISD routine on motor direction change.
- When dirChangeMode is set as 1b, FOC application changes the direction through Reverse Drive (Section 7.7.2.7.2) while continuously driving the motor.