AnsweredAssumed Answered

How to setup eMIOS QDEC function?

Question asked by Daniel Fernandes on May 22, 2019
Latest reply on May 27, 2019 by Petr Stancik

Hi, 

 

I would like to test the QDEC function of the eMIOS. I am working with MPC5777C on the evaluation board.

I am generating A/B 1khz 90° shift square signals on the EMIOS0/1 channels and I have configured the eMIOS this way : 

 

// IO Pin configuration

emios_configInpuQD = PA_PRIF | IBE;
//eMIOS 0 channel 0
SIU.PCR[179].R = emios_configInpuQD;
//eMIOS 0 channel 1
SIU.PCR[180].R = emios_configInpuQD;

 

//eMIOS configuration

eMIOS_0.MCR.B.GPRE= 63; /* Divide 64 MHz sysclk by 63+1 = 64 for 1MHz eMIOS clk*/
eMIOS_0.MCR.B.ETB = 1; /* External time base is disabled; Ch 23 drives ctr bus A */
eMIOS_0.MCR.B.FRZ = 1; /* Enable stopping channels when in debug mode */

eMIOS_0.UC[0].C.B.BSL = 3; // Use internal counters?
eMIOS_0.UC[1].C.B.BSL = 3; // Use internal counters
eMIOS_0.UC[1].C.B.MODE = 0x0D; /* Quadrature decode (for phase A and phase B encoders type) */

 

eMIOS_0.MCR.B.GPREN = 1; /* Enable eMIOS clock */
eMIOS_0.MCR.B.GTBE = 1; /* Enable global time base */

 

I am expecting the see the CNT register of UC(1) incrementing but nothing is happening, looks like I'm missing something very basic. Any clue?

 

Many thanks, 

Daniel

Outcomes