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.

TMS320F28388D: TMS320F28388D - eQEP initialization by index

Part Number: TMS320F28388D

Hello,
We are having device emulating ABI interface connected to MCU TMS320F28388D.
MCU is using eQEP module configured to measure position.
We have problems with eQEP module initialization by Index input. Position is initialized with offset and offset is dependent on direction of movement during first index signal occurrence. During next rotation, offset seems to be constant as was initially set.

Do you have any proposals on how to configure TMS320F28388D to operate without this offset? Or at least how to configure it so offset is not dependent on direction of first movement?

eQEP module is now configured as follows:
QDECCTL[XCR] = 1
QDECCTL[SWAP] = 1
QDECCTL[QIDIRE] = 1
QEPCTL[FREE_SOFT] = 2
QPOSMAX = 8,192
QEPCTL[QPEN] = 1
Remaining eQEP registers are set to default values.
In attached pictures are captured ABI wave forms for both directions of movement during first index occurrences.direction_2.pngdirection_1.png

  • Hi, 

    Sorry for the delayed response.

    The behavior is consistent with the mode " POSITION COUNTER IS RESET ON FIRST INDEX". If the index event occurs during forward movement, then the position counter is reset to 0 on the next eQEP clock. If the index event occurs during the reverse movement, then the position counter is reset to the value in the QPOSMAX register on the next eQEP clock. Note that this is done only on the first occurrence and subsequently the position-counter value is not reset on an index event; rather, the position-counter value is reset based on the maximum position. If you want to reset position count on every index pulse, you should use "POSITION COUNTER IS RESET ON EVERY INDEX PULSE" Option. This would take care of the direction.

    From the waveform, it appears that you are not using quadrature encoder. If not, you also need to change QDECCTL[QSRC] to 0x01 (direction count mode).

    Can u change QDECCTL[QSRC]=0x01 since your application requires direction count mode? Please try once and let me know if this does not work. 

    Thanks,

    Divesh

  • Hi,
    I am not using mode "POSITION COUNTER IS RESET ON FIRST INDEX". I am using mode "POSITION COUNTER IS RESET ON EVERY INDEX PULSE" (QEPCTL[PCRM]=00, as per datasheet default value).

    Yes connected device is not directly quadrature encoder. It is another rotating position sensor which emulate quadrature encoder output in gated mode. Its output is not output in direction count mode.

    From attached picture (from reference manual, at description of POSITION COUNTER IS RESET ON EVERY INDEX PULSE mode) , I would expect that index event would be generated on raising/falling edge of index pulse, dependent on direction, but from measurement, it seems to me that first index is generated on falling edge, independently on movement direction.

  • Hi Martin,

    Are the waveforms (A and B) shifted by 90 degree with respect to each other? If not, is there any mechanism by which you are shifting it such that phase between them is 90 degree ? If the waveforms A and B are shifted by amount other than 90 degree, it may give wrong results.

    You can once try to check whether it is providing correct result for direction or not.

    Thanks,

    Divesh

  • Hello, what you mean by "shifted by 90 degree"? Exact distance between edges in measurement of A and B wave form edges is given by rotation speed. But their order is synchronized of course. Print screens I provided in first question are measured data by logic analyzer on input to the processor and values added as text are values read from memory/registers of the processor (blue one). Red vales are provided by sensors serial communication.

    I am also not sure what you mean by "try to check whether it is providing correct result for direction or not."

  • Hi Martin,

    I reason I told you to check whether it is providing correct result for direction or not is that I want to check whether it is able to detect direction correctly or not. The eqep module would work correctly only if the two signals ( A and B ) are shifted by 90 otherwise it is would not give correct results. 

    Exact distance between edges in measurement of A and B wave form edges is given by rotation speed? No, the phase difference between A and B signals is not dependent on the rotation of speed. It is dependent on the construction of the encoder. The direction is calculated using eQEP state machine which one can refer in TRM.

    Thanks,

    DIvesh