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.

RM57LX how to setup eQEP edge capture unit

Other Parts Discussed in Thread: HALCOGEN

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 */
}

 

  • Hi BoonShen,
    Can you tell me the register value of the PINMMR81[25:24] and PINMMR82[1:0]?
  • Hi Charles,

    Thanks for the reply,

    PINMMR81[25] = 0, PINMMR81[24] = 1 (I have force PINMMR81 to 0x01020202U)
    PINMMR82[1] = 0, PINMMR82[0] = 1 (forced PINMMR82 to 0x02020201U)


    Regards,

    BoonShen
  • Hi BoonShen,

    Can you change to below and try again?

    PINMMR81[25] = 1, PINMMR81[24] = 0
    PINMMR82[1] = 1, PINMMR82[0] = 0
  • Hi Charles, 

    I have already try it, both configuration won't work, and I found another issue . It seems like QCAPCTL and QPOSCTL register doesn't behave correctly in RTOS generate by Halcogen. And if I use the normal system(without RTOS) it can behave well, but the capture period and timer latch always empty no matter how fast(or slow) the encoder rotate.

    Another note for PINMUX configuration, from the RM57Lx schematic I can confirm that EQEP1A is in terminal V9 , and EQEP1B is in terminal W9 (if the schematic is correct). But the Halcogen generate pinmux.c in wrong configuration.Look like there is a lot of problems in tools TI provided .

  • Hi BoonShen,

     First, if you click on the refresh button toward the right on the register browser, do you see the QCAPCTL updated?

     Second, can you read the position counter before you read the QCTMRLAT? In the TRM for the QCTMRLAT register description it says:

    The eQEP capture timer value can be latched into this register on two events viz., unit timeout event, reading the eQEP position counter.