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.

LAUNCHXL-F28069M: Quadrature PCM/PCR Setup Issues

Part Number: LAUNCHXL-F28069M


I am trying to setup the Quadrature input to trigger an interrupt when the count equals 16000 but it doesn't trigger the interrupt when the event happens. However, I did verify that this same code triggers the interrupt when I change the  EQep2Regs.QEINT enable bits to trigger on a different event. What do I need to do differently in order to generate the interrupt when I reach 16000?

void InitEQep2(void)
{

    InitEQep2Gpio();                    // pin 55 & pin 54

    EQep2Regs.QUPRD=900000;             // Unit Timer for 100Hz at 90 MHz SYSCLKOUT

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

    EQep2Regs.QEPCTL.bit.FREE_SOFT=2;

    EQep2Regs.QEPCTL.bit.PCRM=01;       // PCRM=01 mode - Position counter reset on the maximum position (QPOSMAX)
    EQep2Regs.QPOSMAX=16000;            // maximum position (QPOSMAX) is set to 16000 steps
    EQep2Regs.QPOSCMP=16000;           // set position compare to max position (QPOSMAX)

    EQep2Regs.QEPCTL.bit.UTE=1;         // Unit Timeout Enable
    EQep2Regs.QEPCTL.bit.QCLM=1;        // Latch on unit time out
//    EQep2Regs.QEPCTL.bit.UTE=0;         // Unit Timeout Disable
//    EQep2Regs.QEPCTL.bit.QCLM=0;        // Latch on CPU read

    EQep2Regs.QEPCTL.bit.QPEN=1;        // QEP enable

    EQep2Regs.QCAPCTL.bit.UPPS=0;       // 1/1 for unit position
//    EQep2Regs.QCAPCTL.bit.CCPS=5;       // 1/32 for CAP clock
    EQep2Regs.QCAPCTL.bit.CCPS=7;       // 1/128 for CAP clock
    EQep2Regs.QCAPCTL.bit.CEN=1;        // QEP Capture Enable

    EQep2Regs.QEINT.bit.IEL=0;          // Index event latch disabled
    EQep2Regs.QEINT.bit.PCM=1;          // eQEP compare match interrupt enabled
    EQep2Regs.QEINT.bit.PCR=1;          // Position-compare ready interrupt enabled
    EQep2Regs.QEINT.bit.PCO=0;          // Position counter overflow interrupt flag disabled
    EQep2Regs.QEINT.bit.PCU=0;          // Position counter underflow interrupt flag disabled
    EQep2Regs.QEINT.bit.QDC=0;          // Quadrature direction change interrupt disabled
}