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.

TMS320F28377D: eQEP direction change under index

Part Number: TMS320F28377D

Hi there!

I need to count index events together with its direction.

I have no issue with code as it works excluded special case explained below.

Clockwise reached index increments the counter and counter-clockwise decrements it.

It should allow to determine if there is exactly one index within full turn of encoder. Full turn is detected by over/underload of counter, what happens where the encoder stays after power cycle (random place).

If there are more indexes counted during one turn, the system know that there is a noise in signal and index is not more reliable.
My motor is mainly used for positioning. Rotation direction can change at any possition also nearly or under index.
I have noticed, when direction changes under or maybe very close to index the above mentioned index counter goes wrong.

Any idea how can I overcome below ilustrated case "C"?

  • Hi,

    How close the direction change happens when the index event occurs? Is it within SYSCLK period?

    Also, which mode is eQEP configured to?

    Best Regards,

    Nirav

  • Index signal is 3 quadrature pulses long, gated. Direction changes just when index is high, as ilustrated.

    Basic configuration is coded as follows.

    GPIO_setPadConfig( pin_A_number, GPIO_PIN_TYPE_STD ); //6
    GPIO_setPadConfig( pin_B_number, GPIO_PIN_TYPE_STD ); //7
    GPIO_setPadConfig( pin_I_number, GPIO_PIN_TYPE_STD ); //9
    
    GPIO_setPinConfig( GPIO_6_EQEP3A );
    GPIO_setPinConfig( GPIO_7_EQEP3B );
    GPIO_setPinConfig( GPIO_9_EQEP3I ); //index
    
    EQEP_setDecoderConfig(EQEP3_BASE, (EQEP_CONFIG_2X_RESOLUTION | EQEP_CONFIG_QUADRATURE | EQEP_CONFIG_NO_SWAP | EQEP_QDECCTL_IGATE));
    EQEP_setEmulationMode(EQEP3_BASE, EQEP_EMULATIONMODE_RUNFREE);
    EQEP_setPositionCounterConfig(EQEP3_BASE, EQEP_POSITION_RESET_MAX_POS, 8999);
    EQEP_setLatchMode( EQEP3_BASE, EQEP_LATCH_SW_INDEX_MARKER );
    EQEP_enableInterrupt (EQEP3_BASE, EQEP_INT_INDEX_EVNT_LATCH | EQEP_INT_PHASE_ERROR | EQEP_INT_OVERFLOW | EQEP_INT_UNDERFLOW);
    EQEP_enableModule(EQEP3_BASE);
    EQEP_disableInterrupt( EQEP3_BASE, EQEP_INT_DIR_CHANGE );
    EQEP_setPosition(EQEP3_BASE, 0);

    Errata datasheet SPRZ272L is known, we do not make conter reset at index.

  • Hi,

    If direction changes close to the edge of index pulse then it is possible that direction change may not be latched internally. It needs to be SYSCLK period apart.

    In SW can you check for Direction flag and also track the QPOSCNT by latching on index event. If the QPOSCNT increments instead of decrementing by checking the direction flag than you can correct that in SW.

    Best Regards,

    Nirav