10 years, 1 month ago.

LPC11U35 doesnt wake up from deepsleep()

Hi all,

I am working on a battery powered LPC11U35 project. So I need to get it into deepsleep mode to reduce power consumption.. The deepsleep() command seems to work, because while its working in normal run mode (48Mhz) the complete board (with some sensors one lcd display etc..) sinks 29mA and when deepsleep() mode activated it reduces to 15mA . However after that I cannot wake it up via pin interrupt. I tried that code example,

  1. include "mbed.h"
  2. include "TextLCD.h"

TextLCD lcd(P0_2, P1_19, P0_1, P0_19, P0_18, P0_17, TextLCD::LCD16x2); rs, e, d4-d7

InterruptIn wakeup(P0_23);

int i = 0;

void count() { lcd.locate (0,1); lcd.printf("%d",i); i++; wait(0.5); }

int main () { wakeup.rise(NULL); Setup rising edge interrupt (no handler function needed)

lcd.printf("Hello World!");

deepsleep(); Deep sleep until external interrupt count(); We've come out of sleep due to interrupt, so count!

}

And also that code:

  1. include "mbed.h"

InterruptIn wakeup(p14); DigitalOut led(LED1);

Pulled from mbed SDK sources but removed mbed_interface_disconnect() call since that would cause halt when it tried to disable the interface chip which isn't powered up when I am powering the device from VB. void deepsleep(void) { PCON[PD] set to deepsleep LPC_PMU->PCON = 0x1;

SRC[SLEEPDEEP] set to 1 = deep sleep SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;

Power up everything after powerdown LPC_SYSCON->PDAWAKECFG &= 0xFFFFF800;

wait for interrupt WFI(); }

int main () { wakeup.rise(NULL); Setup rising edge interrupt (no handler function needed)

led = 1; while (1) { deepsleep(); Deep sleep until external interrupt led = !led; } }

But never waked..

What do you think about my problem? May you give a hand to me pls?

2 Answers

10 years, 1 month ago.

Where did you find that code? I have seen it before, and it is outdated :)

wakeup.rise(NULL) actually disables any rising edge interrupts on that pin. You need to connect it to a handler function, even if that function doesn't actually do anything. Then it should work fine.

Accepted Answer
10 years, 1 month ago.

Thanks again Erik,

I added static void dummyHandler(void) { return; }

and revised wakeup with;

wakeup.fall(dummyHandler);

And it seems working now.. :))

Everything is so mixed and I dont know where to find it..

Thanks again..