Hi!
I've been stuck for several days and simply cannot solve the problem.
Here is initialization of ADC.
void initADC(void) {ADC.MCR.R = 0x00000000; /* Initialize ADC one shot mode*/ADC.NCMR[0].R = 0x00000007; /* Select ANP1:2 inputs for normal conversion */ADC.CTR[0].R = 0x00008606; /* Conversion times for 32MHz ADClock */}
init of interrupt
//initialization of interruptvoid init_ADC_int(void){ADC.IMR.B.MSKEOC = 1; /*Interrupt Mask bit End Of Conversion*/ ADC.CIMR[0].B.CIM0 = 1; /*Channel Interrupt Mask bit*/}
and in the main I call functions above plus
INTC_InstallINTCInterruptHandler(ADC_vect, 62, 1);
in forever loop I start single conversion
if(BUTTON2_PRESSED)// button 2 pressed receive command { ADC.MCR.B.NSTART=1; /* Trigger normal conversions for ADC0 */ while (ADC.MSR.B.NSTART == 1) {};}
However interrupt routine never performs
When I put this piece of code in main loop it works, but it's not an interrupt
if(ADC.ISR.B.EOC==1) /*Check for End Of Conversion Flag */ ADC_vect();/*ADC interrupt routine*/
Please point me to the right direction I have spent so much time and need to get this working.
And the last thing, from example it says:
ADC.NCMR[0].R = 0x00000007;
But how can I write 0x7; ->bit 0,1 and 2 to register(seems it's accessible from bit 16-31). If I want CH0 CH1 CH2 shouldn't I rather set bit 31, 30 and 29 according to bit table in 'MPC5604B/C Microcontroller Reference Manual' page 760? And thus
ADC.NCMR[0].R = 0xE0000000;
Thanks for reply
Hi earendil,
Have you enabled the external interrupts properly?
INTC.CPR.B.PRI = 0; /* Single Core: Lower INTC's current priority */asm(" wrteei 1"); /* Enable external interrupts */
Stanish
Hi Stanish,
I'm using function from example:
void enableIrq(void) { INTC.CPR.B.PRI = 0; /* Single Core: Lower INTC's current priority */ asm(" wrteei 1"); /* Enable external interrupts */}
Anyway, PIT interrupt and external interrupt work.
earendil
I am trying something similar with CTU connection. I face the same problem. Conversion is done but not getting interrupts.
I have configured interrupts for emios channels and they are working.
let me know if you found a solution for this problem
Ravi