Tool/software: Code Composer Studio
Hello,
I am using a 1024 ppr rotary enconder with LAUNCHXL-F28377S via QEP_A pins. I am also using the serial communication port to send that to the computer to plot the speed x time graph. The problem is that when the motor is about 750 rpm the values comes with error. see the picture belllow.
//Part of the code from Example_posspeed.h
#define POSSPEED_DEFAULTS {0x0, 0x0,0x0,0x0,0x0,16382,2,0,0x0,\
50,0,6000,0,\
0,0,0,\
(void (*)(long))POSSPEED_Init,\
(void (*)(long))POSSPEED_Calc }
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Part from Example_posspeed.c
void POSSPEED_Init(void)
{
EQep1Regs.QUPRD = 2000000; // Unit Timer for 100Hz at 200 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.UTE = 1; // Unit Timeout Enable
EQep1Regs.QEPCTL.bit.QCLM = 1; // Latch on unit time out
EQep1Regs.QPOSMAX = 0xffffffff;
EQep1Regs.QEPCTL.bit.QPEN = 1; // QEP enable
EQep1Regs.QCAPCTL.bit.UPPS = 3; //
EQep1Regs.QCAPCTL.bit.CCPS = 6; //
EQep1Regs.QCAPCTL.bit.CEN = 1; // QEP Capture Enable
}
Does anyone have any idea how to solve this problem?