Unable to configure GPIO as interrupt in MPC5748G

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to configure GPIO as interrupt in MPC5748G

340 Views
Anilpatil_SasvaAuto
Contributor III

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.

0 Kudos
7 Replies

317 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @Anilpatil_SasvaAuto 

mentioned pins do not have EIRQ function. This is written in the reference manual:

lukaszadrapa_0-1718864805550.png

 In the signal description, no EIRQ is mentioned for these pads:

lukaszadrapa_1-1718865003990.png

You need to select pads which has EIRQ function. Like this:

lukaszadrapa_2-1718865035551.png

Regards,

Lukas

0 Kudos

303 Views
akilan78
Contributor I

@lukaszadrapa As discussed over the mail about EIRQ operation, I tried with different pin but I could not trigger the external interrupt.

I am attaching the code for your consideration

void initGPIO(void)
{
SIUL2.MSCR[PE6].B.SSS = 0;
SIUL2.MSCR[PE6].B.OBE = 0;
SIUL2.MSCR[PE6].B.IBE = 1;
SIUL2.IMCR[166].B.SSS = 1;
}

 

void Appl_SW1_Init (void)
{
 
    SIUL2.IMCR[678-512].R = 0x00000001UL;  
 
  
    SIUL2.IRER0.R = 0x00000001UL; 
 
    SIUL2.ISR0.R = 0x00000001UL;
 
    SIUL2.IRSR0.R = 0x00000000UL;
 
    SIUL2.IFEER0.R = 0x00400000UL; 
 
    SIUL2.IFER0.R = 0x00000001UL;
 
    INTC.PSR[245].B.PRC_SELN = 0x4UL;  
    INTC.PSR[245].B.PRIN = 15UL;
}
 
0 Kudos

240 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

attached is working example for PA14.

Regards,

Lukas

0 Kudos

224 Views
Anilpatil_SasvaAuto
Contributor III

Hello Lukas,

Thank you for your helpful solution. I am a bit concerned about your delayed response. Please reply soon.

I have configured PA14 (default pullup), PE6 (default pullup), and PE4 (default pulldown) GPIO pins as external interrupts. Individually, each one can trigger the interrupt. However, when I try to use multiple GPIOs simultaneously, they cannot trigger the interrupt i.e., No single interrupt is triggered. This feature is the highest priority as we use this feature for our production program. Please provide a solution as soon as possible.

We are using your MPC5748G microcontroller for one of our production programs.

0 Kudos

205 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @Anilpatil_SasvaAuto 

I would need more details, I can't see a reason for this.
The only common issue is that users sometimes use "bit access" to clear the interrupt flags like this:

SIUL2.ISR0.B.EIF4 = 1; //clear interrupt flag for EIRQ4

But this is wrong, this will clear all pending interrupts in the register. So, you may lost some interrupts.
Correct way is this one:

SIUL2.ISR0.R = 0x00000010UL; //clear interrupt flag for EIRQ4

Explanation can be found in this document, section "3.2 Status but clearing":
https://www.nxp.com/docs/en/engineering-bulletin/EB758.pdf

Regards,
Lukas

0 Kudos

192 Views
Anilpatil_SasvaAuto
Contributor III
Pullup GPIO is working properly but Pulldown GPIO is not working.
Could you please provide the details to configure the Interrupt for Pulldown GPIO?
0 Kudos

172 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

The only change is to select pull down:
SIUL2.MSCR[PA14].B.PUS = 0; //select pull down
And maybe you can select risign edge instead of falling edge. Or both. This depends on your needs, there's no releation between pull up/down and edge selection.
And the most important question - what is connected to the pin?

0 Kudos