Other Parts Discussed in Thread: CONTROLSUITE
Hi, I’m using Concerto f28m35x. I use parts of the following example to read with QEP-Module from a Speed/Position Encoder:
C:\ti\controlSUITE\device_support\f28m35x\v206\F28M35x_examples_Control\eqep_pos_speed
This works well so fare. But now I noticed that the values in the registers get updated every 10 ms.
I need new speed values every sampling cycle (50us).
I’m struggling to configure the eQEP module according to my needs.
void POSSPEED_Init(void)
{
EALLOW;
// --------- Incremental Sensor interface ------------
GpioCtrlRegs.GPAMUX2.bit.GPIO20 = 1; // Configure GPIO24 as EQEP2A
GpioCtrlRegs.GPAMUX2.bit.GPIO21 = 1; // Configure GPIO25 as EQEP2B
GpioCtrlRegs.GPAMUX2.bit.GPIO22 = 1; // Configure GPIO26 as EQEP2S
GpioCtrlRegs.GPAMUX2.bit.GPIO23 = 1; // Configure GPIO27 as EQEP2I
EDIS;
EQep1Regs.QUPRD=1500000; // Unit Timer for 100Hz at 150 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=10000; // MB 22.04.2015 0xffffffff;
EQep1Regs.QEPCTL.bit.QPEN=1; // QEP enable
EQep1Regs.QCAPCTL.bit.UPPS=5; // 1/32 for unit position
EQep1Regs.QCAPCTL.bit.CCPS=7; // 1/128 for CAP clock
EQep1Regs.QCAPCTL.bit.CEN=1; // QEP Capture Enable
}
In main.c I do:
qep_posspeed.init(&qep_posspeed); // Geber Init
qep_posspeed.BaseRpm = 6000; // Maximaldrehzahl des Motors
qep_posspeed.mech_scaler = 6710; // Inkremente Pro Umdrehnung in Q26 ! Q0
//1/10000*2^26 = 6710,8864
If I change the registers QCAPCTL.bit.UPPS and QCAPCTL.bit.CCPS (according to sprung05a.pdf) it has no effect.
And if I change QUPRD (according to sprung05a.pdf S.26) I get a smaler update time but less resolution.
Is there a way to configure the eQep Module according to my needs?
Tank you in advance for your fast and competent help.