I'm trying to get a GPIO edge interrupt to work on Port 0 Pin 20 of an LPC11U24, but I can't figure it out. My code is as follows:
InitInterrupt()
{
NVIC_DisableIRQ(FLEX_INT0_IRQn);
LPC_SYSCON->SYSAHBCLKCTRL |= 0x01 << 19;
LPC_SYSCON->SYSAHBCLKCTRL |= 0x01 << 23;
LPC_GPIO->DIR[0] &= ~(ANX_INTP);
LPC_SYSCON->PINTSEL[0] = 20;
LPC_GPIO_PIN_INT->ISEL &= ~0x01;
LPC_GPIO_PIN_INT->IENR |= 0x01;
LPC_GPIO_PIN_INT->SIENR |= 0x01;
NVIC_EnableIRQ(FLEX_INT0_IRQn);
}
The interrupt:
void FLEX_INT0_IRQHandler(void)
{
uint32_t intStat = 0;
intStat = LPC_GPIO_PIN_INT->IST;
LPC_GPIO_PIN_INT->IST = intStat;
NVIC_ClearPendingIRQ(FLEX_INT0_IRQn);
}
Can anyone tell me what I am doing wrong?
I dont see where you have set: (it might be different name in your header, but GPIOnIS register...
LPC_GPIO->IS[0] |= (1<<20); //that should enable interrupt sense register for pin 20.
Hi,
I suggest to use as reference the nxp_lpcxpresso_11u14_periph_pinint LPCOpen example code.
You can download LPCOpen from the following link:
LPCOpen Software for LPC11XX | NXP
Regards
Soledad