Interrupt Service Routine for MPC56xx family in Codewarrior 5.9.0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Interrupt Service Routine for MPC56xx family in Codewarrior 5.9.0

1,536 Views
Cmux
Contributor II

Can someone give me a sample code for writing an ISR for MPC56xx family in Codewarrior 5.9.0? I want to write ISRs for the timer and ADC.

 

Thanks

Labels (1)
2 Replies

526 Views
stanish
NXP Employee
NXP Employee

Hi Cmux,

 

There are some ISR examples available directly in CodeWarrior for MPC55xx/56xx v2.9 (both HW/SW mode).

Please see the directory below:

 

<CW for MPC55xx and MPC56xx 2.9>\(CodeWarrior_Examples)\your_derivative\INTC-HWvector-VLE

<CW for MPC55xx and MPC56xx 2.9>\(CodeWarrior_Examples)\your_derivative\INTC-SWvector-VLE

 

 

The project generated by the project wizard initializes INTC controller into SW mode by default.

And uses specific routine to initialize vector table ( INTC_InstallINTCInterruptHandler() ) in contrast to the examples above.

 

Stanish

 

526 Views
Cmux
Contributor II

Hi Stanish,

 

Thanks for your reply. I picked up the example code (SW mode) and made changes to it to accommodate my code. I am able to run the PIT ISR but when I configure the ADC for interrupts I do not get any interrupts. I have added the ADC ISR function to the Interrupt Vector Table in IntclsrVectors.c and my ADC init function is the following

 

void initADC(void) {
    ADC.MCR.R = 0x00000000;      /* Initialize ADC one shot mode*/
    ADC.NCMR[0].R = 0x00000001;  /* Select ANP0 input for normal conversion */
    ADC.CTR[0].R = 0x00008606;   /* Conversion times for 32MHz ADClock */
    ADC.IMR.R = 0x00000002;      /* ADC End of Conversion interrupt enabled */
    ADC.CIMR[0].R = 0x00000001;  /* End of conversion interrupt enabled for channel 0 - Camera */
    INTC.PSR[62].R = 0x02;       /* ADC EOC interrupt vector with priority 2 */
}

 

I am using ANS0 as my ADC channel. Is there anything I am missing in the initialization?

 

--

Cmux

0 Kudos