Other Parts Discussed in Thread: BOOSTXL-DRV8320RS, LVSERVOMTR
I'd like to use the example project servo_drive_with_can_f28004x to see how to properly use an incremental encoder for sensored foc. I'm following the Lab Projects User's guide and am using the LAUNCHXL-F280049C, BOOSTXL-DRV8320RS, and LVSERVOMTR (Teknic M-2310P-LN-04K) as suggested by the guide.
When I get to part 3.2, I observe that everything seems to work fine, motor spins, I can change its speed and see step response, etc. But if I pinch the rotor a bit, the motor stops spinning (and won't resume until I reset everything or turn the shaft again manually). After looking around a bit I find that the eQEP1 peripheral registers are all zero, and also qepHandle_sensor->qepsensor->lsw = ENC_WAIT_FOR_INDEX, even while the motor is spinning. Looking further I find that this is because the macro _EQEP_EN_ is not defined (the build configuration includes the predefined symbol EQEP_ENABLE, not sure why there's another macro for this...).
Ok, should be a simple fix. I define _EQEP_EN_ in hal_obj.h, rebuild, and try again. Now when I set motorVars.flagEnableSys = 1 and motorVars.flagRunIdentAndOnLine = 1, what I observe is that the motor will twitch very briefly, then stop. After that I can see in the expressions window that qepHandle_sensor->qepsensor->lsw = ENC_CALIBRATION_DONE. I'm guessing it rotated as normal until it saw an index pulse. No fault flags have tripped in motorvars. I probe the hardware and find that there's several amps DC being pushed through the motor. It doesn't seem like a hardware fault though. None of the electronics heat up significantly, and if I rebuild after disabling _EQEP_EN_, its behavior reverts to what I saw before. I checked the encoder waveforms manually with a scope, all three signals seem to function normally.
I'm not familiar enough with the SDK to determine why the controller locks up when the encoder is enabled. Based on the user guide, I thought that code was supposed to use the encoder for speed feedback. Is there some other way I should have enabled the eQEP1? Is there something else I'm missing
Regards,
Mike