LPC11U GPIO Interrupt

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC11U GPIO Interrupt

1,399件の閲覧回数
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?

ラベル(1)
0 件の賞賛
返信
2 返答(返信)

1,245件の閲覧回数
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 件の賞賛
返信

1,245件の閲覧回数
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 件の賞賛
返信