QCTMRLAT and QCPRDLAT register(or any other) don't have any value show up when reading quadrature signal in eQEP1A and eQEP1B.
I have enable eQEP Peripherals in PINMUX ,and have set EQEP1 Position Counter mode in QUADRATURE_COUNT, nothing work.
Main function:
void main(void)
{
/* USER CODE BEGIN (3) */
uint16 period, timer, status;
QEPInit();
eqepEnableCapture(eqepREG1);
eqepEnableCounter(eqepREG1);
eqepSetCaptureLatchMode(eqepREG1,QEPCTL_Qclm_Latch_on_CPU_Read);
eqepSetUnitPosnPrescale(eqepREG1,QCAPCTL_Upps_Div_2_Prescale); //QCAPCTL[UPPS] = 0010, Enable edge capture unit
eqepSetCapturePrescale(eqepREG1,QCAPCTL_Ccps_Capture_Div_128);
while(1)
{
timer = eqepReadCaptureTimerLatch(eqepREG1);
period = eqepReadCapturePeriodLatch(eqepREG1);
status = eqepReadStatus(eqepREG1);
eqepREG1->QEPSTS |= (1 << 7);
if((status >> 7) & 0x01 ) //QEPSTS:UPEVNT = 1, unit position event detected
{
eqepReadPosnCount(eqepREG1); //Latch value into QCTMRLAT and QCPRDLAT
eqepREG1->QEPSTS |= (1 << 7); //write 1 to clear QEPSTS:UPEVNT
}
}
/* USER CODE END */
}
