RT685 GPIO Interrupt Handler not executing

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

RT685 GPIO Interrupt Handler not executing

455 Views
mrichardson23
Contributor IV

So, I am trying to build out functionality and understand how everything fits together and I am having some trouble with a simple problem.  I have put together a handler for systick that is functional, but when I try to add an interrupt for switch 2 on the rt685-aud-evk, the handler never executes when the switch is toggled.  I have the following code:

 

	if (EnableIRQ(SW_IRQ))
	{
		PRINTF("Failed to enable interrupt\r\n");
	}
	else
	{
		PRINTF("Interupt enabled\r\n");
	}

	GPIO_SetPinInterruptConfig(GPIO, SW_PORT, SW_PIN, &config);
	GPIO_PinEnableInterrupt(GPIO, SW_PORT, SW_PIN, kGPIO_InterruptA);

 

where SW_IRQ is GPIO_INTA_IRQn and the config is for a trigger on a rising or falling edge.  My interrupt handler looks like:

 

void SW_GPIO_INTA_IRQHandler(void)
{
    GPIO_PinClearInterruptFlag(GPIO, SW_PORT, SW_PIN, 0);
    gpioIntSignal = true;
    SDK_ISR_EXIT_BARRIER;
}

 

where SW_GPIO_INTA_IRQHandler is defined as GPIO_INTA_IRQHandler.  I can see the switch toggling, but it seems that I am missing something with regards to actually using the handler.  Any thoughts?

Labels (1)
Tags (3)
0 Kudos
1 Reply

404 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @mrichardson23 ,

   I think your main issue is related to the configuration, please refer to this SDK demo:

SDK_2_14_0_EVK-MIMXRT685\boards\evkmimxrt685\driver_examples\gpio\input_interrupt

  It is also using GPIO_INTA_IRQn, GPIO_INTA_DriverIRQHandler.

  Please refer to that code and try it.

#define APP_GPIO_INTA_IRQHandler GPIO_INTA_DriverIRQHandler
#define APP_SW_IRQ GPIO_INTA_IRQn

 

You still need the GPIO configuration:

GPIO_PortInit(GPIO, APP_SW_PORT);
GPIO_PinInit(GPIO, APP_SW_PORT, APP_SW_PIN, &sw_config);

Anyway, refer to the SDK, based on the SDK do the pin modification.

 

Wish it helps you!

Best Regards,

Kerry

 

0 Kudos