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.

qep ElecTheta problem leading to current saturation

After optimizing current gains, I was unable to run sensored FOC as the PID outputs would saturate. After looking around I think this is because of the qep.ElecTheta parameter. If I output rg1.Out and qep. ElecTheta, ElecTheta should be lagging rg1.Out by just a little. On the scope, it appears that the phase difference between ElecTheta and rg1 continually increases, eventually causing them to be in phase and then once again the phase difference continually increases. The calibration angle is detected using the sequence in the HV sensored FOC (and manually altering it does not affect this phenomenon). 

I think this is why the motor can be run in sensorless mode (using the GUI and otherwise) but not in sensored mode. Qep module has been appropriately initialised (pole pairs, encoder lines etc.) Ideas on how to get to the bottom of this and fix it?

PS: The QEP macro is detecting the correct number of encoder lines for each revolution.

  • Motor Control Gurus:

     The following two screen shots are what I am seeing. I notice that the position compare flag in the QFLG register is set as soon as I start spinning the motor (lsw =1 in build level 4). I dont think that should be such a huge deal as occasionally a few counts may be missed when the motor is running. QEP macro continues to show 7999 in QEPCountIndex (encoder has 2000 lines). Any ideas will be appreciated, cause I am at a loss. I have run the motor under sensored conditions in the past, driver 8312 is okay (when board is powered fault LED DOES NOT light up).