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.

CCS/TMS320F28335: Question regarding the EQEP module of F28335

Part Number: TMS320F28335

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

  • Ehsan,

    With PCRM = 00, the position counter will reset on an index event. depending on the direction it will either reset to 0 or reset to the value set in QPOSMAX on the next eQEP clock. You say that sometimes the counter is not reset, can you confirm that it is not being set to QPOSMAX?

    Thanks,
    Mark
  • Hi Mark,

    Thanks for your response.

    I do the test always for the sam direction. As I mentioned, sometimes the position counter resets to zero and starts again counting from zero until the next index event. But, sometimes, it does not reset at the index event, which seems weird to me. For this situation, the position counter keeps counting after the index until QPOSMAX (with PCRM=0), whereas it should have been reset at the index event. So when it reaches QPOSMAX, it resets to zero.

  • Ehsan,

    Are you able to observe the A, B, and I signals on an oscilloscope?
    Does the behavior change if the motor is rotating at different rates? - start from slow speeds, try incrementally increasing the speed to see if the missed event is due to the pulse being too short.
    Does the behavior occur regardless of motor speed?

    -Mark
  • Also, what are the synchronization settings of the GPIOs that the EQEP signals use? Ensure that the GPIOs are set up as asynchronous. This is documented in the Errata document for the device: http://www.ti.com/lit/sprz272

    -Mark
  • Ehsan,

    I haven’t heard from you for a few weeks, so I’m assuming you were able to resolve your issue. If this isn’t the case, please reject this resolution and reply to this thread. If this thread locks, please click the "Ask a related question" button and in the new thread describe the current status of your issue and any additional details you may have to assist us in helping to solve your issues.

    Regards,
    Mark
  • Hi Mark,

    Thanks you so much for your follow up and sorry for the late response. 

    Actually, I decided to use another mode for counting the EQEP counter. For resetting, I am using the mode "EQep1Regs.QEPCTL.bit.PCRM=01;" which resets the counter at the maximum value, which equals 4 times total number of encoder lines. So, I did not follow up to fix the issue with index event resetting.  Thanks anyway for your help.

    For GPIO settings, I do not configure the GPxQSELn registers , so I assume the GPIOs go into synchronization to sysclkout by default. In the pdf that you attached, I see that the configuration should be anything except the asynchronous, but I see that you recommend me to ensure that they are in asynchronous mode. Shouldn't the EQEP pins of GPIO be in any mode other than asynchronous?

    Thanks,

  • Ehsan,

    Good catch! Yes, I meant to say "Synchronous" . never Asynchronous.

    I'm glad you were able to continue your project. I am going to close this post out. If you have any new questions please create a new thread.

    Thanks!
    Mark