Hello Team,
I have set up the PD10, PH8, and PF11 GPIO pins as input switches and configured them to work as external interrupts with MPC5748 EVB.
1. Configured the PD10 (Default Active Low), PH8 (Default Active High), and PF11 (Default Active High) GPIO pins as input switches as below.
/* User Push Button IGN Stat PD10 */
SIUL2.MSCR[PD10].B.SSS = 0; /* Pin functionality as GPIO */
SIUL2.MSCR[PD10].B.OBE = 0; /* Output Buffer Enable off */
SIUL2.MSCR[PD10].B.IBE = 1; /* Input Buffer Enable on */
/* User Push Button CAR DOOR UNLOCK PH8 */
SIUL2.MSCR[PH8].B.SSS = 0; /* Pin functionality as GPIO */
SIUL2.MSCR[PH8].B.OBE = 0; /* Output Buffer Enable off */
SIUL2.MSCR[PH8].B.IBE = 1; /* Input Buffer Enable on */
/* User Push Button PF11 */
SIUL2.MSCR[47].B.SSS = 0; /* Pin functionality as GPIO */
SIUL2.MSCR[47].B.OBE = 0; /* Output Buffer Enable off */
SIUL2.MSCR[47].B.IBE = 1; /* Input Buffer Enable on */
2. I have configured GPIO as external interrupt as below. Please find the Interrupt Vector table file (intc_SW_mode_isr_vectors_MPC5748G.c) as attached.
void Appl_Ign_SW_Init (void)
{
/*Pin function set to EIRQ11*/
SIUL2.IMCR[656-512].R = 0x1;
/*Enable external interrupt in SUIL*/
SIUL2.IRER0.R = 0x00000001;
/*Interrupt on rising edge - pin is pulled down*/
SIUL2.IREER0.R = 0x00000001;
/*enable Filter */
SIUL2.IFER0.R = 0x00000001;
INTC.PSR[243].B.PRC_SELN = 0x8; /* IRQ sent to Core 0 */
INTC.PSR[243].B.PRIN =8; /* IRQ priority = 10 (15 = highest) */
}
Please find the ISR as below:
void SW1_ISR(void)
{
LED_DS8 = ~LED_DS8 ; //Toggle LED
/*Clear EIRQ0 flag*/
SIUL2.ISR0.R = 0x00000001;
}
Issue: After pressing the switches, the respective interrupts are not triggered and not hitting the ISR. Please provide an example code for configuring GPIO as input and use as external interrupts.
Issue: After pressing the switches, the ISR is not hitting or respective interrupts are not triggering.
Kindly provide the solution and example code to configure GPIO as input and external interrupt.