LPC11U GPIO Interrupt

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

LPC11U GPIO Interrupt

763 Views
lydiaj5000
Contributor I

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?

Labels (1)
0 Kudos
2 Replies

609 Views
svensavic
Contributor III

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.

0 Kudos

609 Views
soledad
NXP Employee
NXP Employee

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

0 Kudos