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.

Use quadrature encoder input for counting encoder pulses

Genius 5820 points
Other Parts Discussed in Thread: AM3358

Hi,

I try to use eQEP1A_in and eQEP1B_in of AM3358 CPU just to count incoming encoder pulses and to reset them from time to time. No interrupts/overflow/capture/whatever is needed beside of that. That's what I already have done to program QEP1:

QEPPinMux(); // set input pins to be used with QEP
HWREGH(SOC_EQEP_1_REGS+QEP_QDECCTL)=0x0800; //set Quadrature-count mode using QSRC
HWREGH(SOC_EQEP_1_REGS+QEP_QEPCTL) =0x1038; //position counter initialisation: writing a 1 to the QEPCTL[SWI] bit
HWREG(SOC_EQEP_1_REGS+QEP_QPOSMAX) =0xFFFFFFFF; // maximum value
HWREG(SOC_EQEP_1_REGS+QEP_QPOSINIT)=0x00000000; //initial value
HWREGH(SOC_EQEP_1_REGS+QEP_QCAPCTL)=0x0000; //disable all capturing functions
HWREGH(SOC_EQEP_1_REGS+QEP_QEPCTL) =0x10B8; //reset counter

SOC_EQEP_1_REGS is equal to (0x48302000+0x00000180) which should be correct base address of QEP1 registers. From what I understood from TRM this procedure should give me the possibility to read current encoder count out of register QEP_QPOSCNT and to reset the current value by writing 0x10B8 to register QEP_QEPCTL.

But as soon as I read from address (SOC_EQEP_1_REGS+QEP_QPOSCNT) the CPU stops completely, reading of the value fails.

So...anybody an idea what could be wrong? Is there a problem with my initislisation?