Other Parts Discussed in Thread: C2000WARE, SYSBIOS
//-----------------------------------------
// ======== InitEQep2 ========
//-----------------------------------------
void InitEQep2(void)
{
InitEQep2Gpio();
EQep2Regs.QUPRD=800000; // Unit Timer for 100Hz at 80 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=4000; // maximum position (QPOSMAX) is set to 4000 steps
EQep2Regs.QEPCTL.bit.UTE=1; // Unit Timeout Enable
EQep2Regs.QEPCTL.bit.QCLM=1; // Latch on unit time out
EQep2Regs.QEPCTL.bit.QPEN=1; // QEP enable
EQep2Regs.QCAPCTL.bit.UPPS=5; // 1/32 for unit position
EQep2Regs.QCAPCTL.bit.CCPS=6; // 1/64 for CAP clock
EQep2Regs.QCAPCTL.bit.CEN=1; // QEP Capture Enable
}
//-----------------------------------------
// ======== EncoderMeasurementHWI ========
//-----------------------------------------
Void EncoderMeasurementHWI()
{
unsigned long Measurement[2] = {0,0};
DirectionQep++;
// DirectionQep = EQep2Regs.QEPSTS.bit.QDF;
CounterQep = (unsigned int)EQep2Regs.QPOSCNT;
Measurement[0] = DirectionQep;
Measurement[1] = CounterQep;
Mailbox_post(EncoderMeasurement, &Measurement, BIOS_NO_WAIT);
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;
EPwm1Regs.ETCLR.bit.INT=1;
}
I am generating the quadrature signals with ePWM1 using GPIO0 and GPIO1 and connecting them to GPIO24 and GPIO25 of the eQep2. I verified that ePWM1 is working but I am unable to get eQep2 to register the quadrature signals in software. I am using a RTOS system and configured the eQep2 interrupts as follows.


