AnsweredAssumed Answered

How can I enable the interrupt of GPIO Port 1?

Question asked by sudomona on Dec 7, 2018
Latest reply on Dec 13, 2018 by sudomona

Hi,
I am testing the Interrupt with LPC1114.
LPCOpen nxp_lpcxpresso_11c24_periph_pinint worked.
But GPIO Port1 any pin does not respond.

Is there anything I have to add something?

Thank you.

 

/* GPIO pin for GPIO pin interrupt */
#define GPIO_PININT_PORT 1 /* GPIO port number mapped to PININT */
#define GPIO_PININT 1 /* GPIO pin number mapped to PININT */
#define PININT_IRQ_HANDLER PIOINT0_IRQHandler /* GPIO interrupt IRQ function name */

 

void PININT_IRQ_HANDLER(void)
{
   /* Clear interrupt */
   Chip_GPIO_ClearInts(LPC_GPIO, GPIO_PININT_PORT, (1 << GPIO_PININT));
   Chip_GPIO_SetPinState(LPC_GPIO, 0, 7, true);
}

 

int main(void)
{
   SystemCoreClockUpdate();

   //LED
   Chip_GPIO_SetPinState(LPC_GPIO, 0, 7, false);
   Chip_GPIO_SetPinDIROutput(LPC_GPIO, 0, 7);

   /* Configure GPIO pin as input pin */
   Chip_GPIO_SetPinDIRInput(LPC_GPIO, GPIO_PININT_PORT, GPIO_PININT);

   /* Configure channel interrupt as edge sensitive and falling edge interrupt */
   Chip_GPIO_SetupPinInt(LPC_GPIO, GPIO_PININT_PORT, GPIO_PININT, GPIO_INT_BOTH_EDGES);

   /* Enable GPIO pin intrerrupt */
   Chip_GPIO_EnableInt(LPC_GPIO, GPIO_PININT_PORT, (1 << GPIO_PININT));

   /* Enable all clocks, even those turned off at wake power up */
   Chip_SYSCTL_SetWakeup(~(SYSCTL_SLPWAKE_IRCOUT_PD | SYSCTL_SLPWAKE_IRC_PD |
   SYSCTL_SLPWAKE_FLASH_PD | SYSCTL_SLPWAKE_SYSOSC_PD | SYSCTL_SLPWAKE_SYSOSC_PD |    SYSCTL_SLPWAKE_SYSPLL_PD));

   /* Enable interrupt in the NVIC */
   NVIC_EnableIRQ(EINT0_IRQn);

   
   while (1) {
      __WFI();
   }
   return 0;
}

Outcomes