7 years, 9 months ago.

[LPC1114] How to wake up from deepsleep?

Hi, im trying an LPC1114 on breadboard, my goal is to wake up after deepsleep() call with an interrupt on a gpio state change. My code looks like this:

lpc1114 sleep example

#include "mbed.h"
 
InterruptIn button(dp24);
 
void wake() {
    //wake routine, do something before next sleep
}
 
int main() {
    button.fall(&wake);  // attach the address of the flip function to the rising edge
    while(1)
   {  
        deepsleep();
        //code here below never execute
   }
}

The MCU just doesnt catch the interrupt, if i remove the deepsleep call the interrupt is catched without probem. Do i miss something?

I'm using uVision5 IDE.

Regards, Michele

1 Answer

7 years, 5 months ago.

You need to enable wake up based on that GPIO interrupt by turning corresponding LPC_SYSCON->STARTERP0 bits to 1. Here's example using dp2 (PIO0_9)

https://gist.github.com/SatokiOgiso/1a8639734daef5235fe12eff8c587d6e