eTimer quadrature mode of MPC5744P problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

eTimer quadrature mode of MPC5744P problem

466 Views
nathan_
Contributor IV

I try to configure the eTimer quadrature mode of MPC5744P according to some examples of MPC5604.

My relevant configuration code is as follows:

//port config
SIUL2.MSCR[PA14].B.IBE = 1; /* PA14: Enable pad for input - eTimer1 ch4,QEPA*/
SIUL2.IMCR[69].B.SSS = 1; /* eTimer1 ch4: connected to pad PA14 */
SIUL2.MSCR[PA15].B.IBE = 1; /* PA15: Enable pad for input - eTimer1 ch5,QEPB*/
SIUL2.IMCR[70].B.SSS = 2; /* eTimer1 ch5: connected to pad PA15 */

//eTimer config

void eTimer_Init(void){
ETIMER_1.ENBL.R = 0x0; // disable Timer1 channels

ETIMER_1.CH[4].LOAD.R = 0;
ETIMER_1.CH[4].CNTR.R = 0;
ETIMER_1.CH[4].CTRL1.R = 0x8405;//Quadrature count mode,Primary Count Source:Counter #4 input pin,Count repeatedly,Continue counting to roll over,Secondary Count Source:Counter #5

ETIMER_1.ENBL.R = 0x30; // enable Timer1 channel 4,5
}

I have several problems:

1. Is my configuration correct?

2. Is the result of the quadrature count auto saved to the ETIMER_1.CH[4].CNTR.R ? Or is a interrupt needed to count?

3. If the result is auto saved to that register, does it mean that whenever I need the result, I just need to use the following code 

QEP_count = ETIMER_1.CH[4].CNTR.R;

And I can get the result. Is that correct?

Thanks in advance.

0 Kudos
0 Replies