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.

TMS320F28377S: tms320f28377s eQEP QEPCTL.PCRM question

Part Number: TMS320F28377S

Hi, 

i'm coding a homing routine where i would like to find the exact index pulse on a quadrature encoder. 

I would like to use "reset on first index marker" option i found in the datasheet. For this i set the EQepsRegs.QEPCTL.PCRM = 2; but this doesn't do a thing...

I can get the position to reset on the index marker by setting bits QEPCTL.IEI to 1, or .PCRM to 0 but this resets the encoder everytime.

Is there something else i have to do to get PCRM = 2 to work ?

Thanks

Jan

  • Hi Jan,

    Can you explain more in detail, what happens when your set PCRM=2? When you say it does not do a thing do you mean that Position counter is not getting reset? 

    Here is description on what you should expect when PCRM=2:

    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, it is reset based on maximum position.

    Regards,

    Nirav

  • Hi Nirav,
    indeed... the position counter isn't resetting.
    In the mean time i found out that it IS resetting, but only the first time after power up... So not even after a restart during debugging. So propably the first index detected has left a bit set somewhere. I don't know if there is a way to reset this ?

    Thanks,
    Jan
  • Hi Jan,

    Restarting the code execution will not reset eQEP register, you will need to do the CPU reset to clear any set bits without having to do the power down. Idea behind using PRCM=2 is to remember the First Index Event and reset the Position counter only once, without having to do it on any subsequent Indexes, hence there is no register bit that will clear the First Index event, it is inbuilt into the hardware, which should only gets reset with a CPU Reset or a Power Down.

    Regards,

    Nirav

  • Hi Nirav,

    thanks for the reply. 

    My idea of this aproach is: first i home a ballscrew driven axis to an unprecise home switch (i encounter multiple index events while doing this). Then i search for the next index event as my accurate home position (and i can use the index event marker as a flag to indicate this has occured). 

    But there are offcourse other solutions so i will work around this then.

    Regards,

    Jan