Recent Posts

Freescale/NXP MPC5606B: eMIOS0 Testing Program (PWM)


In this example,

- We will be testing eMIOS by generating 6 PWM output simultaneously and will be changing its duty cycle in run time using switch inputs.



Program Outcome:
20KHz PWM at 
 eMIOS0_1 => PA[1],   eMIOS0_2 => PA[2], 
 eMIOS0_3 => PA[3],   eMIOS0_4 => PA[4], 
 eMIOS0_5 => PA[5],   eMIOS0_6 => PA[6]. 
 
 Initial Duty_Cycle = 10%
 Press Switch1   ->   Duty_Cycle = 20%
 Press Switch2   ->   Duty_Cycle = 40%
 Press Switch3   ->   Duty_Cycle = 60%
 Press Switch4   ->   Duty_Cycle = 80%



Changelog:
26/03/2016: Bug:Phase lag of 1uSec is present between (eMIOS0_1,2,3) and (eMIOS0_4,5,6)
01/04/2016: Phase lag removed. [clear the GTBE bit at beginning of eMIOS_Init() and set it at the end of the eMIOS_Init().]

Connections:
SWITCH No. => Port No. => Pad No. => Pin No.(144-pin LQFP package)
SWITCH1    => PE[0]    => PCR[64] => PIN 10
SWITCH2    => PE[1]    => PCR[65] => PIN 12
SWITCH3    => PE[2]    => PCR[66] => PIN 128
SWITCH4    => PE[3]    => PCR[67] => PIN 129

eMIOS No.  => Port No. => Pad No. => Pin No.(144-pin LQFP package)
eMIOS0_1   => PA[1]   =>  PCR[1]  => PIN 11
eMIOS0_2   => PA[2]   =>  PCR[2]  => PIN 9
eMIOS0_3   => PA[3]   =>  PCR[3]  => PIN 90
eMIOS0_4   => PA[4]   =>  PCR[4]  => PIN 43
eMIOS0_5   => PA[5]   =>  PCR[5]  => PIN 118
eMIOS0_6   => PA[6]   =>  PCR[6]  => PIN 119

Calculations:
Frequency Calculation of PWM:     
         For "x" Hz Frequency, B_VAL = 1/[(x)*10^-6]  
Duty Cycle Calculation of PWM:    
         For "y" % Duty Cycle, A_VAL = (y)*100/(x)

Testing:- Output PWM waveform can be observed on DSO.

Exercise:
Make the connections shown below:
- Connect DSO probe +ve terminal to eMIOS0_1 PA[1] and DSO prob gnd to the gnd of the TRK-MPC5606B board.
- Similarly, Connect remaining eMIOS0 and test it.

Downloads:
eMIOS_Testing_TRK-MPC5606B_APDaga

Click here to see more codes for Freescale/NXP MPC56xx Family.

Feel free to ask doubts in the comment section. I will try my best to solve it.
If you find this helpful by any mean like, comment and share the post.
This is the simplest way to encourage me to keep doing such work.

Thanks and Regards,
-Akshay P. Daga

No comments