Tool/software: Code Composer Studio
Hi,
I am trying to use Delfino microcontroller for FOC control of a PMSM. I am at the beginning of using EQEP module for the incremental encoder. I have all the QA, QB, and index signals as inputs for the microcontroller. Here is the initialization for the EQEP module:
EQep1Regs.QDECCTL.bit.QSRC=00; // QEP quadrature count mode
EQep1Regs.QEPCTL.bit.FREE_SOFT=2;
EQep1Regs.QEPCTL.bit.PCRM=00; // PCRM=00 mode - QPOSCNT reset on index event
EQep1Regs.QEPCTL.bit.UTE=1; // Unit Timeout Enable
EQep1Regs.QEPCTL.bit.QCLM=1; // Latch on unit time out
EQep1Regs.QPOSMAX=15000;
EQep1Regs.QEPCTL.bit.QPEN=1; // QEP enable
EQep1Regs.QCAPCTL.bit.UPPS=5; // 1/32 for unit position
EQep1Regs.QCAPCTL.bit.CCPS=2; // 1/128 for CAP clock
EQep1Regs.QCAPCTL.bit.CEN=1; // QEP Capture Enable
When trying to measure the speed, the regsiter "EQep1Regs.QPOSCNT" sometimes does not reset when an index occurs. And sometimes, it gets zero. I have configured the EQEP module to reset at the index point whenever an index occurs and I expect it to reset at index point. However, for example in one test, it resets, but in the next test, it does not reset. Does anyone have a similar problem? Can yoy please help me?
Thanks