AnsweredAssumed Answered

MPC5674F PIT not trigerring interrupt

Question asked by Vincent Bergeron on Apr 30, 2015
Latest reply on May 6, 2015 by Petr Stancik

Hello,

 

I am trying to configure the PIT timer in order to trig an interrupt.  I am using the InctInterrupt.h and InctInterrupt.c from the Code Warrior 10.6.  Here is a sniplet of code to init pit and add a function to the interrupt vector:

 

initPit(){

     PIT.MCR.R = 0x00000001;               // Enable pit and freeze during debug

     PIT.CH[1].LDVAL = 40000000;        // 1 second interrupt for 40 MHz clock

     PIT.CH[1].TCRL.R = 0x00000003;  // Start timer

}

 

INTCInterruptFn pitIntFnct(){

     SIU.GDPO[PIN_NUMBER].R = !SIU.GDPO[PIN_NUMBER].R;  // Toggle pin

     PIT.CH[1].TFLG.B.TIF = 1;  // Reset interrupt flag

}

 

int main(){

     initPIT();

     INTC_InitINTCInterrupts();

     INTC_InstallINTCInterruptHandler(pitIntFnct(), 302, 1);    // PIT[1] is on vector number 302.  Priority 1.

     while(1){

    

     }

}

 

For some reason, the funtion is not trigerred when the PIT[1] flag is set to 1.  Do you have any idea why???

 

Regards

Outcomes