This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-F280049C: LAUNCHXL-F280049C: Sensored (Incremental Encoder) control of 3-Phase PMSM using BOOSTXL-DRV8320.

Part Number: LAUNCHXL-F280049C
Other Parts Discussed in Thread: C2000WARE-MOTORCONTROL-SDK, C2000WARE

I am using an incremental encoder for position feedback with LAUNCHXL-F280049C and BOOSTXL-DRV8320, the example code I am using is based on is03_hardware_test in  C2000WARE-MOTORCONTROL-SDK version 3.01.00.

However, when adding an offset so that the motor and encoder are aligned at electrical zero, the motor is spinning in reverse.

sensorhandle->qepsensor.RawTheta = EQEP_getPosition(qepBase) + sensorhandle->qepsensor.CalibratedAngle; // raw theta + offset

Where I have calculated sensorhandle->qepsensor.CalibratedAngle to be 580 for correct alignment.

Could this be caused by converting an int to float?



  • Luke,

    You need to implement an alignment process to force the rotor position to zero and reset the QEP as the following codes.

    EQEP_setPosition(obj->qepHandle, 0);

    EQEP_clearInterruptStatus(obj->qepHandle, EQEP_INT_INDEX_EVNT_LATCH);

    EQEP_setPositionInitMode(obj->qepHandle, EQEP_INIT_DO_NOTHING);

    And then wait the first index to set the initial value of the QEP as below

    EQEP_setInitialPosition(obj->qepHandle, EQEP_getPositionLatch(obj->qepHandle));

    EQEP_setPositionInitMode(obj->qepHandle, EQEP_INIT_RISING_INDEX);

    You might refer to the dual-axis example in the folder of motorControlSDK as below


  • This I have done and the QEP is reset to zero on an index pulse. The electrical angle (from QEP) follows the generated angle fine.

    However, when I use my encoder angle, the motor exhibits odd behaviour depending on the offset I add. This either speeds the motor up, stops it or spins in reverse?

  • It seems like the offset is not measured and set correctly in your project according to the encoder. You might try to use the example codes in the reference design mentioned above.