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.
Hi Mohan,
Not sure of the issue.
Assuming the EDPOL=1 then setting
EMIOS_0.CH[21].CADR.R = 7999;
EMIOS_0.CH[21].CBDR.R = 7999;
will produce 0% duty. Output is set low.
If you set
EMIOS_0.CH[21].CADR.R = 0;
EMIOS_0.CH[21].CBDR.R = 7999;
100% duty is generated. Output is set high.
Check if the eMIOS channel is configured properly using a debugger. Also try to do not use UCDIS register within an initialization.
BR, Petr
Hi Petr,
Thanks for the support.
I have checked eMIOS configuration by using debugger,it is configured properly.
Also not used UCDIS register within an initialization.
But the Issue is LED is Blinks and OFF still.
Can you send me example code for initialization of eMIOS Channels.
Thanks in Advance.
Regards
Mohan raj.
Hi Mohan,
The AN2865 (http://cache.freescale.com/files/32bit/doc/app_note/AN2865.pdf) shows eMIOS OPWMB setting.
This demo code is also located in CodeWarrior 2.x installation, see it in [CW_installation]\(CodeWarrior_Examples)\560xS-CW\eMIOS-OPWM\. It works well.
BR, Petr
Hi Petr,
I have checked the Sample code and also the referred the AN2865 document.
I am still getting the issue,
I will once again explain the issue,
I am using EMIOS0 Channel 23 as Modulus Counter Buffered mode.To generate 125Hz frequency.
The EMIOS0 Channel 21 use EMIOS0 Channel 23 (Use Counter Bus A).
The EMIOS0 Channel 21 is used as OPWMB Mode connected to the LED.
When i load the any value(example:10,100,200) for the first time to the CADR register, the eMIOS gives the spike output.
The LED blinks for the first time and OFF.
When i load the any value or same as above value (first time loaded value) for the second time to the CADR register, the eMIOS gives the constant output.
The LED is ON constantly.
The issue is eMIOS gives the spike output when we load the value for the first time.
This scenario happens for all the eMIOS0 and eMIOS1 channels
Kindly support me to solve the issue.
Thanks in Advance
With Regards
Mohanraj
Hi Petr,
Please support to resolve the above mentioned issue.
Thanks in Advance
With Regards
Mohanraj