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?
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