How to configure GPIO1,24 as interrupt pin

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

How to configure GPIO1,24 as interrupt pin

662 Views
anurag16doshi
Contributor II

Hi ,

I am using imx8M  NANO custom board for my project and m7 core is running on FREERTOS.i want to configure GPIO1,24 as input pin for hardware interrupt on m7 core. i have done following configurations to set the pin as input pin with falling edge triggered interrupt. i am not able to get the interrupt on this pin causing no entry in IRQHandler (GPIO1_Combined_16_31_IRQHandler).

Please guide me to configure this pin properly.

#define GPIO(port, pin) ((port - 1) << 5) | ((pin)
& 0x1F)
#define PORT(gpio) ((gpio) >> 5 )
#define PIN(gpio) ((gpio) & 0x1F)

void GPIO1_Combined_16_31_IRQHandler(void)
{
GPIO_ClearPinsInterruptFlags(GPIO1, 1 << 24);
SDK_ISR_EXIT_BARRIER;
}

init()

{

uint32_t gpio_irq = GPIO(1, 24);

irq = GPIO1_Combined_16_31_IRQn + ((PORT(gpio_irq) + 1 ) + PIN(gpio_irq)/16);

gpio_pin_config_t int_config = {kGPIO_DigitalInput, 0,kGPIO_IntFallingEdge};
GPIO_PinInit(GPIO1, 24, &int_config);
int i=EnableIRQ(irq);
PRINTF("EnableIRQ ret val=%d\r\n");
GPIO_PortDisableInterrupts(GPIO1, -1);
GPIO_PortClearInterruptFlags(GPIO1, -1);
GPIO_PortEnableInterrupts(GPIO1, 1 << 24);

}

 

Thanks in advance,

Anurag

0 Kudos
1 Reply

643 Views
igorpadykov
NXP Employee
NXP Employee

Hi anurag16doshi

 

for interrupt example one can look at  SDK_EVK-MIMX8MN  ../drivers/fsl_gpio.c

function GPIO_SetPinInterruptConfig

available on https://mcuxpresso.nxp.com/en/welcome

 

Best regards
igor

0 Kudos