lpcware

GPIO Interrupt Won't Cause Sleep Mode to Exit

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by keegan on Fri Mar 09 14:01:15 MST 2012
I've looked at the ext-int example provided for the LPC1343. I switched the pin corresponding to the interrupt to port 0.6 from the original, and verified that it still works. (LED changes when toggling the voltage on the pin 0.6).

From everything that I've heard about sleep mode, when you call __WFI(); the processor should go into sleep mode and then wake up whenever an enabled interrupt happens.

However, when I add __WFI(); inside the infinite loop in the extint example, it stops there and not even the interrupt handler gets called for P0.6.

Why is this happening? How do I properly enter sleep mode and have my code continue where it left off when there is an interrupt on P0.6?

Note, I'm not talking about "deep sleep mode", just regular old SLEEP Mode

int main (void)
{
  /* Basic chip initialization is taken care of in SystemInit() called
   * from the startup code. SystemInit() and chip settings are defined
   * in the CMSIS system_<part family>.c file.
   */

  /* Initialize GPIO (sets up clock) */
  GPIOInit();

   /* use port2_1 as input event, interrupt test. */
  GPIOSetDir( PORT0, 6, 0 );
  /* port0_1, single edge trigger, active high. */
  GPIOSetInterrupt( PORT0, 6, 0, 0, 0 );
  GPIOIntEnable( PORT0, 6 );

  /* Set LED port line to output */
  GPIOSetDir( LED_PORT, LED_BIT, 1 );
  /* Turn LED on */
  GPIOSetValue( LED_PORT, LED_BIT, LED_ON );

  while( 1 ) {
  __WFI(); // STOPS HERE, NOTHING EVER HAPPENS AGAIN.
  }
}

Outcomes