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.

RM46L852 Hercules eQEP Module

Other Parts Discussed in Thread: HALCOGEN, RM46L852

I am new to TI Hercules, and I have a few questions, after trying all tutorials and reading the datasheets and technical user guide:

1. I am planning to use the eQEP module, while I was wondering why the example provided by HalcoGen is very slow(the loop), does this RM46L852 support 3600ppr(pulse per revolution) Quardature Encoder? If so, what pseudocode/solution would you recommend?

2. I tried playing around with the interrupt, but the function read interrupt flag only output 2 at all times, what is this mean?

3. Why is the value of the ReadPosnCounter goes to minus value, and why does it count very slow, and does not relevant to the direction of the encoder?

This is my code

/** @file sys_main.c
* @brief Application main file
* @date 25.April.2014
* @version 03.09.00
*
* This file contains an empty main function,
* which can be used for the application.
*/

/* (c) Texas Instruments 2009-2014, All rights reserved. */

/* Include Files */

#include "sys_common.h"

/* USER CODE BEGIN (1) */
#include "eqep.h"
#include "sys_core.h"
#include "stdio.h"
#include "stdlib.h"

/* USER CODE END */

/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/

void main(void)
{
/* USER CODE BEGIN (3) */
/* EQEP initialization based on GUI Configuration. */
QEPInit();

/* Enable Position Counter */

eqepEnableCounter(eqepREG1);

/* Enable Unit Timer. */

eqepEnableUnitTimer(eqepREG1);

/* Enable capture timer and capture period latch. */

eqepEnableCapture(eqepREG1);

eqepEnableInterrupt(eqepREG1,QEINT_Pce);
eqepEnableInterrupt(eqepREG1,QEINT_Qdc);
eqepForceInterrupt(eqepREG1,QEINT_Pce);

int i = 0;

while(1)
{
uint16 intpt = eqepReadInterruptFlag(eqepREG1,QEINT_Pce);
printf("interrupt : %d\n",intpt);

/* Status flag is set to indicate that a new value is latched in the QCPRD register. */
if((eqepREG1->QEPSTS & 0x80U) !=0U)
{
/* Elapsed time between unit position events */
//increment i to see how the if statement work
i++;

//read position counter
int count = eqepReadPosnCount (eqepREG1);

//get the period of the pulses
uint16 deltaT = eqepREG1->QCPRD;

//read position latch
int cnt = eqepReadPosnLatch (eqepREG1);

//read status register
int stat = eqepReadStatus(eqepREG1);

printf("count : %d %d %d \n",count,cnt,i);
printf("stat and deltat : %d %d \n",stat,deltaT);

//clear status flag
eqepREG1->QEPSTS |= 0x80U;
}
}
}
/* USER CODE END */

/* USER CODE BEGIN (4) */

I need your help urgently.

Thank you very much for responding,

Maria