AnsweredAssumed Answered

MPC5744P PIT Interrupt problem

Question asked by Administrator Employee on Feb 29, 2016
Latest reply on Oct 10, 2017 by Martin Kovar

Original Content posted by David Chung.


I'm writing a simple project for Panther that uses the PIT0 ISR to to toggle a GPIO pin. I use the 160MHz PLL as the clock source, initialize PIT0, enable PIT0 interrupts in the NVIC, add the PIT0_ISR address to the interrupt table. In the ISR, I clear the interrupt flag and toggle the GPIO pin.  The problem is for some reason the program only enters the ISR around 2 to 4 times before never entering again.  I can see that PIT_0.TFLG0 is set so an interrupt is called by PIT0, but it's not being handled. The PIT0 init code is shown:


void PIT0_init(uint32_t LDVAL) {

  volatile uint32_t dummy = 0;

  PIT_0.TIMER[0].LDVAL.R = LDVAL; /* Load # PIT clocks to count */

  PIT_0.TIMER[0].TCTRL.B.TIE = 1; /* Enable interrupt */

  INTC_0.PSR[226].B.PRIN = 10; /* IRQ priority = 10 (31 highest) */

  dummy = INTC_0.PSR[226].R;

  PIT_0.TIMER[0].TCTRL.B.TEN = 1; /* enable channel */



The ISR is as follows:

void PIT0_isr(void) {

  LED1 = ~LED1;             /* Toggle LED1 port */

   PIT_0.TIMER[0].TFLG.R |= 1;  /* Clear interrupt flag. w1c */



Anyone know the cause of this issue?