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.

f28m36 EQEP Strobe event initialization of position counter

I plan to use the EQEP in quadrature count mode. Currently, I am only interested in position, so, after initialization, I simply poll the QPOSCNT register as needed.

I want to use the strobe input to set QPOSCNT back to 0, but this mode doesn't seem to work.

The strobe signal does cause QPOSCNT to be latched into QPOSSLAT register, so I know that the strobe is being seen.

This is my setup:

    EQep1Regs.QDECCTL.bit.QIP = 1;          // Invert the Index Input
    EQep1Regs.QDECCTL.bit.QAP = 1;          // Invert the A Input
    EQep1Regs.QDECCTL.bit.QBP = 1;          // Invert the B Input

    EQep1Regs.QDECCTL.bit.QSRC = 00;        // QEP quadrature count mode

    EQep1Regs.QPOSINIT = 0x00000000;
    EQep1Regs.QPOSMAX = 0xffffffff;

    EQep1Regs.QEPCTL.bit.FREE_SOFT = 0x10;  // Emulation Control: Counters are unaffected by emulation suspend

    EQep1Regs.QEPCTL.bit.PCRM = 0x01;       // PCRM=00 mode - QPOSCNT reset on index event
                                            // PCRM=01 mode - QPOSCNT reset on maximum position
                                            // PCRM=10 mode - QPOSCNT reset on first index event
                                            // PCRM=11 mode - QPOSCNT reset on unit time out event

    EQep1Regs.QEPCTL.bit.SEI = 0x10;        // Init Position counter on rising edge strobe input
                                            // NOTE: This doesn't seem to work

    EQep1Regs.QEPCTL.bit.QPEN = 1;          // QEP position counter enable

  • Isaac,

    Pretty sure that you have some hex/binary issues. 

    For example, the eQEP's SEI bit take values from 0b00 to 0b11 (0x00 to 0x03).  Here you are writing 16 which will likely end up making the actual value you write to SEI in the above code 16 modulo 4 = 0 (which is likely not what you want).

    Hopefully this helps.


    Thank you,
    Brett