Problem with interrupts in MPC5643L (Leopard)

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Problem with interrupts in MPC5643L (Leopard)

跳至解决方案
1,702 次查看
fraqui
Contributor I

Hi everyone:

 

I'm a newbie with Leopard and I'm trying to generate an interrupt with a falling edge of an external signal. This is the code I have:

 

void initINTC(void){ INTC.BCR.B.HVEN_PRC0=0; //0:SW vector mode, 1: HW vector mode (processor 0) INTC.CPR.B.PRI=0;// Lower INTC's current priority}void initPin(void){ SIU.PCR[0].R=0x0100; //configured as input SIU.IFEER.B.IFEE0=1; //Interrupt Falling-Edge Enable for this pin SIU.IRER.B.EIRE0=1; //Interrupt Request Enable }void INTERRUPT_FALLING_EDGE_0(void){ sendRS232Data(0xFF00FF00); SIU.ISR.B.EIF0=1;}int main(void) {  volatile int i = 0;    initModesAndClks();      /* Initialize mode entries */  initPeriClkGen();        /* Initialize peripheral clock generation for LINFlex */  disableWatchdog();       /* Disable watchdog */  initLINFlex_0();         /* Initialize serial port */  initINTC();              /* Initialize Interrupt Controller */  initPin();               /* Initialize interrupt pin */  INTC_InstallINTCInterruptHandler(INTERRUPT_FALLING_EDGE_0,0,1);  /* Loop forever */  for (;;) {    i++;     }}

 

The interrupt is correctly generated because the interrupt flag in the ISR register is set when the falling edge occurs, but the problem is that the interrupt service routine is never executed.

I've used the  INTC_InstallINTCInterruptHandler instruction to activate the routine, but I don't know what else I need to do.

Somebody could help me?

Thanks and regards.

  

0 项奖励
1 解答
789 次查看
Tatay
Contributor II

Hi!

 

my problem is solved! i use CW 2.7, the problem went from a wrong initialization of IVOR table. it is a bug in CW 2.7 for MPC5643L.

在原帖中查看解决方案

0 项奖励
4 回复数
789 次查看
almarto
Contributor IV

Hi fraqui and Tatay,

If you could post or send me the complete project I would try to debug it and see what happens. Which CW version and which HW board are you using?

Best regards!

0 项奖励
790 次查看
Tatay
Contributor II

Hi!

 

my problem is solved! i use CW 2.7, the problem went from a wrong initialization of IVOR table. it is a bug in CW 2.7 for MPC5643L.

0 项奖励
789 次查看
Tatay
Contributor II

Hi everybody,

 

I have the same problem like fraqui!

I try to generate interrupt from the PIT, channel 0. I use INTC_InstallINTCInterruptHandler(compteurISR,59,1); where compteurISR is my subroutine. The subroutine is never executed but why? I set the bit that enables interrupts from PIT, and when the counter has finished, the bit PIT.CH[0].TFLG.B.TIF is correctly set.

I also add the function enableIrq that sometimes causes a reset.

 

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 Setup_Timer()
{  
 PIT.PITMCR.R &=0xFFFFFFFC; //periph actif
    PIT.CH[0].LDVAL.B.TSV=0x005AF07F;//load value
    PIT.TCTRL0.B.TIE=1;//enable interrupt
}

 

int main(void) {
  volatile int i = 0;
  int debut=1;
   
  InitHW();

  Setup_Timer();
  INTC_InstallINTCInterruptHandler(compteurISR,59,1);
  enableIrq();
  PIT.TCTRL0.B.TEN=1;

  for (;:smileywink: {
    i++;

  }

}

 

void compteurISR(void)
{
      //INTC.SSCIR[4].R = 2;
     SIU.GPDO52.B.PDO=~SIU.GPDO52.B.PDO;
     PIT.CH[0].TFLG.B.TIF=1;

}

0 项奖励
789 次查看
gernot
Contributor I

can you tell us which version of CW are you using?

 

 

0 项奖励