Content originally posted in LPCWare by riscy00 on Sun Aug 03 11:33:48 MST 2014
The code is based on LPC11U68 PININT example which goes to my board using the same device.
I selected GPIO014 for test, I use screwdriver between GND and pin 014 which is pulled high (confirmed by scope).
I'm using LPCOpen 2 (most recent) on most recent LPCexpesso IDE).
The GPIO clock are enabled by previous code.
I have triple checked the code and could not see error any different from example code but interrupt did not pickup.
Have I missed something?
Your input is appreciated.
void Test_GPIO014(void)
{
uINT32 i=0;
Chip_Clock_SetIOCONFiltClockDiv(0, 64);
Chip_GPIO_SetPinDIRInput(LPC_GPIO, 0, 14);// Configure GPIO pin as input
// Configure pin as GPIO with pullup
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 14, (IOCON_FUNC0 | IOCON_MODE_PULLUP | IOCON_DIGMODE_EN| IOCON_CLKDIV(0) | IOCON_S_MODE(3)));
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_PINT);// Enable PININT clock// Disable filter clock not needed.
Chip_SYSCTL_SetPinInterrupt(PININTCH0, 0, 14);
Chip_PININT_ClearIntStatus(LPC_PININT, PININTCH0); // clear INT status
Chip_PININT_SetPinModeEdge(LPC_PININT, PININTCH0);// Level detects
Chip_PININT_EnableIntLow(LPC_PININT, PININTCH0);// Falling edge
//NVIC_SetPriority(PIN_INT0_IRQn,4);
NVIC_ClearPendingIRQ(PIN_INT0_IRQn);
NVIC_EnableIRQ(PIN_INT0_IRQn);
i++;
i++;
}
void PIN_INT0_IRQHandler(void)
{
uINT32 i;
NVIC_DisableIRQ(PIN_INT0_IRQn);
i = Chip_PININT_GetIntStatus(LPC_PININT);
//-----------------------------------------------------GPIO 0.14
if (i & PININTCH0) // match?
{
Chip_PININT_ClearIntStatus(LPC_PININT, PININTCH0);
return;
}
}