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.

TMS320F28031:eQEP index event resets QPOSCNT at non-origin position

Part Number: TMS320F28031


Tool/software:

Hello,

I am using the eQEP module on F28031, and I have a question about how QPOSCNT behaves when an index event (Z-phase) occurs.

  • According to the TRM, at every index event the position-counter value is latched into QPOSILAT and QPOSCNT should be either 0 or QPOSMAX.

  • If the latched value is not equal to 0 or QPOSMAX, then QEPSTS[PCEF] and QFLG[PCE] are set.

My concern is the following:

  1. If an index pulse (Z) occurs at a non-origin position (for example, due to noise on the Z signal), will QPOSCNT still be reset to 0?

    • In my tests, I cannot see index events on the oscilloscope, but I suspect that noise may be triggering false Z pulses.

    • This could cause QPOSCNT to reset unexpectedly and shift the origin.

  2. If this happens, how should we handle it in software?

    • Can we rely on QEPSTS[PCEF] and QFLG[PCE] to detect and ignore such invalid index events?

    • What is the recommended way to keep QPOSCNT aligned to the correct mechanical position when a false index occurs?

Additional details:

  • The motor mechanical range is only 95° (it never makes a full 360° rotation).

  • Current configuration:

    EQep1Regs.QEPCTL.bit.FREE_SOFT = 2;
    EQep1Regs.QEPCTL.bit.PCRM = 0; // 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 = 0xFFFFFFFF;
    EQep1Regs.QEPCTL.bit.QPEN = 1; // QEP enable

Because the motor never reaches a full rotation, Z-phase should not normally appear in the operating range.
That’s why I suspect noise is creating false Z events that reset QPOSCNT.

Point right What is the recommended way to robustly avoid false origin shifts in this kind of limited-rotation application?

Thank you in advance.

  • Hi E.T.,

    If an index pulse (Z) occurs at a non-origin position (for example, due to noise on the Z signal), will QPOSCNT still be reset to 0?

    Yes, if a noise-induced index pulse occurs at a non-origin position, QPOSCNT will still be reset to 0 when PCRM = 0 (position counter reset on index event) is configured. This is because the eQEP hardware doesn't inherently distinguish between valid and noise-induced index pulses.

    If this happens, how should we handle it in software?

    1. GPIO Input Qualification:

    • You can use GPIO input qualification for the Z-index signal to filter out short noise pulses.Yes you can.

    2. Software Protection:

    • Can we rely on QEPSTS[PCEF] and QFLG[PCE] to detect and ignore such invalid index events?

    • Yes, monitor QEPSTS[PCEF] and QFLG[PCE] flags which will be set if the position counter is reset at an unexpected position

    3. Using ECAP

    • You can also have eCAP to capture the index pulse to ensure no random edges are occurring.

    Best regards,

    Ryan Ma