AnsweredAssumed Answered

MPC5777C external interrupt not working

Question asked by Vrushali Taklikar on Sep 14, 2017
Latest reply on Sep 15, 2017 by David Tosenovjan

Hi,

 

I have configured below 4 external interrupts irq1, irq2, irq3, irq4

Below is the cofiguration

 

void EIRQ_Init(void)
{
SIU.PCR[451].B.PA=0;
SIU.PCR[451].B.IBE =1;
SIU.PCR[452].B.PA =0;
SIU.PCR[452].B.IBE =1;
SIU.PCR[453].B.PA =0;
SIU.PCR[453].B.IBE =1;
SIU.PCR[454].B.PA =0;
SIU.PCR[454].B.IBE =1;

SIU.IMUX3.B.MUXSEL1= 1; //Selects input from "ETPUC10_IRQ1_SENT5_B_GPIO451" pad (PCR: 451).
SIU.IMUX3.B.MUXSEL2= 1; //Selects input from "ETPUC11_IRQ2_GPIO452" pad (PCR: 452).
SIU.IMUX3.B.MUXSEL3= 1; //Selects input from "ETPUC12_IRQ3_MCANTX1_GPIO453" pad (PCR: 453).
SIU.IMUX3.B.MUXSEL4= 1; //Selects input from "ETPUC13_IRQ4_SDOUT0_PSI5A_RCH0_C_GPIO454" pad (PCR: 454).

//SIU_DIRSR selects between DMA and interrupt requests for events on the IRQ[0]-IRQ[3]
SIU.DIRSR.R =0;
//SIU_EIISR selects the source for the external interrupt
SIU.EIISR.B.ESEL1 =0;
SIU.EIISR.B.ESEL2 =0;
SIU.EIISR.B.ESEL3 =0;
SIU.EIISR.B.ESEL4 =0;

// SIU_DIRER enables external signals on selected pins to generate interrupt
SIU.DIRER.B.EIRE1 =1;
SIU.DIRER.B.EIRE2 =1;
SIU.DIRER.B.EIRE3 =1;
SIU.DIRER.B.EIRE4 =1;
//The SIU_IFEER enables falling edge-triggered events on IRQ[n].
//The SIU_IREER enables rising edge-triggered events on IRQ[n].
//SIU.IFEER.B.IFEEN1 = 1;
SIU.IREER.B.IREE1 = 1;
SIU.IFEER.B.IFEEN2 = 0;
SIU.IREER.B.IREE2 = 1;
SIU.IFEER.B.IFEEN3 = 0;
SIU.IREER.B.IREE3 = 1;
SIU.IFEER.B.IFEEN4 = 0;
SIU.IREER.B.IREE4 = 1;
INTC.PSR[47].R = PRC_SEL_CPU0 | PRC_PRI(10);

}

 

void ext_isr()
{
int i=0;
if(SIU.EISR.B.EIF1 == 1)
{
for(i=0;i<3;i++){
Read_SPI_error(0x1a,0,1);
SIU.EISR.B.EIF1 = 0x1;
}

 

}
if(SIU.EISR.B.EIF2 == 1)
{
Read_SPI_error(0x1b,0,1);
SIU.EISR.B.EIF2 = 1;
}
if(SIU.EISR.B.EIF3 == 1)
{
Read_SPI_error(0x1c,0,1);
SIU.EISR.B.EIF3 = 1;
}
if(SIU.EISR.B.EIF4 == 1)
{
Read_SPI_error(0x1d,0,1);
SIU.EISR.B.EIF4 = 1;
}


}

Outcomes