Recent Posts

Freescale/NXP MPC5606B: eMIOS0 ADC0 External Interrupt Program



In this example,
- We will be testing all the module simultaneously we have learnt till now.
- All the modules we have learnt till now, are the most common and widely used for any application.
- I was using these module and developing the code for BLDC motor control, So, some terms / Nomenclature used in the code is related to BLDC application.
- This is not the final BLDC Motor control Program. (I cant public that code due to some reasons)
- This code will give you brief idea about how a real life application can be implemented using DSP.




Problem Statement:
- 3 External Interrupts at PC[2](IRQ5), PC[3](IRQ6) & PA[5](IRQ7) 
  are enabled for both Rising and Falling Edge

20KHz PWM at  
A_top: eMIOS0_1 => PA[1], A_bot: eMIOS0_2 => PA[2],  
B_top: eMIOS0_3 => PA[3], B_bot: eMIOS0_4 => PA[4],  
C_top: eMIOS0_5 => PA[5], C_bot: eMIOS0_6 => PA[6]. 


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]. 
 
   
Rising Edge  @ PC[2](IRQ5) => LED1 ON     
Falling Edge @ PC[2](IRQ5) => LED1 OFF  

Rising Edge  @ PC[3](IRQ6) => LED2 ON 
Falling Edge @ PC[3](IRQ6) => LED2 OFF  

Rising Edge  @ PC[5](IRQ7) => LED3 ON 
Falling Edge @ PC[5](IRQ7) => LED3 OFF  

Rising Edge  @ PC[14](IRQ8) => LED4 ON 
Falling Edge @ PC[14](IRQ8) => LED4 OFF 

IRQ5,6,7 Priority = 1 (Max = 15, Min = 0) 
IRQ5,6,7 Priority = 1 (Max = 15, Min = 0) 
IRQ8 Priority = 2 (Max = 15, Min = 0)

Connections:
Connect External Interrupt at PC[2],PC[3] & PC[5] 

PC[2]   => PCR[34] => PIN 117 => IRQ5 
PC[3]   => PCR[35] => PIN 116 => IRQ6 
PC[5]   => PCR[37] => PIN 130 => IRQ7 
PC[14]  => PCR[46] => PIN 3   => IRQ8

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)

NOTE:
IRQ_SET0: IRQ 0 to 7    =>  VectorNum = 41 :(IRQ 0 to 7 have same Priority) 
IRQ_SET1: IRQ 8 to 15   =>  VectorNum = 42 :(IRQ 8 to 15 have same Priority)
IRQ_SET2: IRQ 16 to 23  =>  VectorNum = 43 :(IRQ 16 to 23 have same Priority)  

> 11/5/16: Nested Interrupt Enabled   
> When 1 interrupt is executing, another interrupt doesn't get triggered. 
> Program by by Akshay P Daga

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:
eMIOS0_ADC0_ExtIntrpt_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