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.

CCS/SPRC892: Problem with low speed measurement

Part Number: SPRC892
Other Parts Discussed in Thread: CONTROLSUITE

Tool/software: Code Composer Studio

I am using the following code to measure the low speed (it is basically the example "eqep_pos_speed" with minor modifications as indicated below)

// **********  LOW SPEED MEASUREMENT******************************

// SPEED_CONST = (2^UPPS / (N_total_pulses)) *(fclock/2^CPPS)*(2*pi); [rad/s]
SPEED_CONST = 9587.3799; // Calculated with UPPS=2 and CPPS=7; N_total_pulses=4096; fclock=2 MHz

int Spmax = 3000*2*pi/60; // rad/s
static float Nclspmax;
float Spaux, Speed_pr;

Nclspmax = SPEED_CONST / Spmax;

if(EQep1Regs.QEPSTS.bit.UPEVNT == 1)


if(EQep1Regs.QEPSTS.bit.COEF == 0) // No Capture overflow

           temp1=EQep1Regs.QCPRDLAT; // temp1=t2-t1

else // Capture overflow; saturate the result


Spaux = Nclspmax / temp1;

          if(Spaux > 1 )
                        Speed_pr = 1;
                        Speed_pr = Spaux;

         omega_m = Speed_pr*Spmax; //in rad/s

         EQep3Regs.QEPSTS.all = 0x88;    // clear unit position event flag and clear overflow error flag

//even if the last line is: EQep1Regs.QEPSTS.bit.COEF=1 the results do not change


// **********  END LOW SPEED MEASUREMENT******************************

The problem is: "EQep1Regs.QCPRDLAT" most of the time gives the highest value possible, i.e., 65535, with occasionally low values. "temp1" changes its value but does not reach its maximum. The measured speed "omega_m" often gives the imposed limit value 314 rad/s, although the motor is operating at constant speed 5.12 rad/s. 

Does anyone have an idea where the problem might be?

Thank you.