AnsweredAssumed Answered

EMIOS Initialization issues in MPC5604s

Question asked by Mohan Raj on May 28, 2017
Latest reply on Jun 13, 2017 by Petr Stancik

Hi All,

 

I am using MPC5604s controller. 

I am using EMIOS0 Channel 23 as Modulus Counter Buffered mode.To generate 125Hz frequency.

Below is my configurations:

 

/* Disable prescaler */
EMIOS_0.CH[CounterBus].CCR.B.UCPEN = 0;

/* Period = 8000(0-7999) clocks (8 msec) */
EMIOS_0.CH[23].CADR.R = 7999;

 

/* Modulus Counter Buffered (MCB) */
EMIOS_0.CH[23].CCR.B.MODE = 0x50;

/* Use internal counter as time base */
EMIOS_0.CH[23].CCR.B.BSL = 0x03;

 

/* Set channel prescaler to divide by 1 */
EMIOS_0.CH[23].CCR.B.UCPRE = 0x00;

 

/* Enable prescaler */
EMIOS_0.CH[23].CCR.B.UCPEN = 1;

 

/* Freeze channel counting when in debug mode */
EMIOS_0.CH[23].CCR.B.FREN =1;

 

I am using EMIOS0 Channel 21 in OPWMB mode.

Below line is used to disable the channel 21 in initialization function.

EMIOS_0.UCDIS.R |= (((uint32_t) 0x01 << 21));

 

The following line is used to set the PWM with 0% duty cycle.

 

EMIOS_0.CH[21].CADR.R = 7999;


EMIOS_0.CH[21].CBDR.R = 7999;

 

/*Enable  channel 21 */

EMIOS_0.UCDIS.R &= (~((uint32_t) 0x01 << 21));


/* Use Counter Bus A */
EMIOS_0.CH[21].CCR.B.BSL = 0x00;

/* Polarity-leading edge sets output/trailing clears */
EMIOS_0.CH[21].CCR.B.EDPOL = 0x01;

/* Mode is OPWM Buffered */
EMIOS_0.CH[21].CCR.B.MODE = 0x60;

 

/* Enable Output Update as it was disabled in pwm_init */
EMIOS_0.OUDR.R &= (~((uint32_t) 0x01 << 21));

 

The Channel 21 is connected to the LED.

The Issue is My LED is Blinks and OFF when i use the above configurations .

I want to Turn OFF my LED when i load below values to the both CADR and CBDR.

EMIOS_0.CH[21].CADR.R = 7999;
EMIOS_0.CH[21].CBDR.R = 7999;

 

Kindly help me to resolve the above issue.

 

Thanks in Advance.

 

Regards

Mohan raj.

Outcomes