Stefan Kraemer

MPC5643L Interrupt priority problems

Discussion created by Stefan Kraemer on Jul 11, 2011
Latest reply on Aug 22, 2012 by Matthew Manthey

Hi everybody,


I have some problems with the MPC5643 and the execution of interrupts.

All interrupts that I trigger are executed exactly once.

I found out that the current priority register is not set to the initial value (0) after exiting the ISR. It has still the priority of the ISR.

So the interrupt cannot be executed a second time.

When should the priority normally be reseted (by the hardware) during the interrupt handling process?

By calling rfi or by writing to INTC_IACKR?


Here the simple code I used to trigger a software interrupt, the project was generated by the wizard:


void enableIrq(void) {  INTC.CPR_PRC0.B.PRI = 0;/* Lower INTC PRC0's current priority */  asm(" wrteei 1");       /* and make sure external interrupts are enabled */   }void SwIrq4ISR(void) {  SWirq4Ctr++;           /* Increment interrupt counter */  INTC.SSCIR[4].R = 1;   /* Clear channel's flag        */}
void initINTC(void) {  
  INTC.MCR.B.HVEN_PRC0 = 0;   /* MPC551x PRC1: initialize for SW vector mode */
  INTC.MCR.B.VTES_PRC0 = 0;   /* MPC551x PRC1: default vector table 4B offsets*/
  INTC.IACKR_PRC0.R = (uint32_t) &INTCInterruptsHandlerTable_p0[0]; /* MPC551x: ISR table base */
}  void main(){...
INTC_InstallINTCInterruptHandler(SwIrq4ISR, 4, 2);  /* And let the interrupts through */  enableIrq(); /* Loop forever */  for (;;) {    i++;    if(i % 10 == 0)    {        INTC.SSCIR[4].R = 2;     }  }}

Do I have to set or to clear any aditional flag?

 I read that there is an error in CW 2.7 regarding interrupt initialisation. (I used CW 2.8)