Hello,
I have created a simple setup with the TRK-MPC5604P EVB to test the eTimer quadrature function. The quadrature encoder is a simple rotary encoder I'm rotating it by hand. The encoder quadrature signals are connected to the PA0/PA1 pins. Electrically I'm able to scope the quadrature signal, it looks OK. But the counter does not count.
Any hints what is wrong and/or missing?
Thank you in advance.
=================================================
Here is the code:
void initAndRunEtimer(void) {
SIU.PCR[0].R = 0x0103; // PA0, eTimer_0, ETC[0]
SIU.PCR[1].R = 0x0103; // PA1, eTimer_0, ETC[1]
ETIMER_0.CHANNEL[0].COMP1.R =0xFFFF;
ETIMER_0.CHANNEL[0].COMP2.R = 0x0000;
ETIMER_0.CHANNEL[0].LOAD.R = 0x0000;
ETIMER_0.CHANNEL[0].CNTR.R = 0x0000;
ETIMER_0.CHANNEL[0].CTRL.R = 0x8000;
ETIMER_0.CHANNEL[0].CTRL2.R = 0x0000;
ETIMER_0.CHANNEL[0].CTRL3.R = 0x0000;
ETIMER_0.CHANNEL[0].STS.R = 0x0000;
ETIMER_0.CHANNEL[0].INTDMA.R = 0x0000;
ETIMER_0.CHANNEL[0].CMPLD1.R = 0x0000;
ETIMER_0.CHANNEL[0].CMPLD2.R = 0x0000;
ETIMER_0.CHANNEL[0].CCCTRL.R = 0x0000;
ETIMER_0.CHANNEL[0].FILT.R = 0x0000;
ETIMER_0.DREQ[0].R = 0x0000;
ETIMER_0.DREQ[1].R = 0x0000;
ETIMER_0.DREQ[2].R = 0x0000;
ETIMER_0.DREQ[3].R = 0x0000;
ETIMER_0.DREQ[4].R = 0x0000;
ETIMER_0.WDTOH.R = 0xFFFF;
ETIMER_0.WDTOL.R = 0xFFFF;
ETIMER_0.ENBL.R = 0x0001;
}
As soon as I rotate the encoder I get the following ETIMER_0.CHANNEL[0].STS Bit Field Values:
Not Implemented bits[ 15:10 ] = 0
WDF bits[ 9:9 ] = 1 Event occurred
RCF bits[ 8:8 ] = 0 No event
ICF2 bits[ 7:7 ] = 0 No event
ICF1 bits[ 6:6 ] = 0 No event
IEHF bits[ 5:5 ] = 1 Event occurred
IELF bits[ 4:4 ] = 1 Event occurred
TOF bits[ 3:3 ] = 0 No event
TCF2 bits[ 2:2 ] = 0 No event
TCF1 bits[ 1:1 ] = 0 No event
TCF bits[ 0:0 ] = 0 No event
Solved! Go to Solution.
Hi,
you have to select also proper primary and secondary source in CTRL register.
So with ETIMER_0.CHANNEL[0].CTRL.R = 0x8001 setting it should work.
Regards,
Petr
Hi,
you have to select also proper primary and secondary source in CTRL register.
So with ETIMER_0.CHANNEL[0].CTRL.R = 0x8001 setting it should work.
Regards,
Petr
Thank you for the quick response, Petr! That solved it.