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.

28035 Eqep Example Problem~



Hi,

I'm using  2803xEqep_pos_speed example to measure the AC motor speed  with a 2000ppr Incremental Encoder,but the final rpm value I got would be zero when the rpm  became higher  ,the frequency equal zero would be higher as well .My QEP control register initializations are as follows:


EQep1Regs.QUPRD=600000;                           // Unit Timer for 100Hz at 60 MHz SYSCLKOUT

EQep1Regs.QDECCTL.bit.QSRC=00;             // QEP quadrature count mode

EQep1Regs.QEPCTL.bit.FREE_SOFT=2;
EQep1Regs.QEPCTL.bit.PCRM=00;               // PCRM=00 mode - QPOSCNT reset on index event
EQep1Regs.QEPCTL.bit.IEI=10;
EQep1Regs.QEPCTL.bit.IEL=01;
EQep1Regs.QEPCTL.bit.UTE=1;                      // Unit Timeout Enable
EQep1Regs.QEPCTL.bit.QCLM=1;                  // Latch on unit time out
EQep1Regs.QPOSMAX=0x00001f3f;
EQep1Regs.QEPCTL.bit.QPEN=1;                   // QEP enable

EQep1Regs.QCAPCTL.bit.UPPS=5;               // 1/32 for unit position
EQep1Regs.QCAPCTL.bit.CCPS=6;              // 1/64 for CAP clock
EQep1Regs.QCAPCTL.bit.CEN=0;                 // QEP Capture DISable

void main(void)
{

InitSysCtrl();

InitEQep1Gpio();

DINT;

InitPieCtrl();

IER = 0x0000;
IFR = 0x0000;

InitPieVectTable();

qep_posspeed.init(&qep_posspeed);

for(;;)
{
qep_posspeed.calc(&qep_posspeed);
}

}

and in Example_posspeed.h file changed the mech_scaler value=8388(because used 2000 ppr encoder) and pole_pairs=4;

THE VALUE WILL HAVE PERIOD APPEAR,MORE HIGHER SPEED I GET AND THEN EQUAL ZERO FREQUENCY MORE HIGHER!

720 RPM!!!!

300RPM!!

Any suggestions?

Thanks in advance.  This has been very frustrating.

  • Hi MIAN,

    I interpreted that you arrived mech_scalar value 8388 by simply dividing 16778 (for 4000 counts) by 2 in _posspeed.h file for your required 2000 PPR.

    But the value 16778 is arrived by doing 0.9999/4000 which is equal to 0.000249975 and converted into Q26 fixed point format.

    So for your case, do 0.9999/2000 and convert it into Q26 fixed point format. The value will be 33551 for 2000 counts not as you provided (8388).

    See whether this solve your problem......

    Regards,
    Prakash
  • Hi Prakash
    In this TI example's note

    //! - QEP Encoder resolution is configured to 4000counts/revolution (mech_scaler)
    //! - which means: 4000/4 = 1000 line/revolution quadrature encoder (simulated by EPWM1)

    1000 line/revolution is used in this example!!!
    According to the same logic, I'm using 2000ppr Encoder so set the mech_scalar to 8388,[(0.9999/2000*4)*2^26].
    Another reason is the RPM value,which I have gotten from CCS,and the RPM value ,which was read from tacometer ,were almost the same when I have set the mech_scale to 8388

    Regrads,
    MIAN JIE