9 years, 7 months ago.

Newbie

Well Im a newbie to this, How do I wake it back up? say after 10 seconds?

Question relating to:

Enables lower power Sleep and power down modes for LPC11U24 systems than the mbed API supports directly. low power, LPC11U24, lpc11uxx, mBuino, Sleep

2 Answers

9 years, 7 months ago.

Ticker/Timer will indeed wake from sleep, but it is also fairly pointless imo: Sleep mode has very limitted power reduction. Sure it helps, but the real power reduction is in powerdown (deepsleep too, but powerdown is alot better than deepsleep with barely downsides).

But don't worry, there is a solution for timed wakup from deepsleep: http://mbed.org/users/Sissors/code/WakeUp/ (I think the mbuino is at least doubling the number of imports of that lib, simply because it is pretty much the first board which works great from battery without requiring a custom PCB).

There are two public programs using the lib (click on dependents), but easiest one is: http://mbed.org/users/wernert/code/mBuino_low_power_led_flasher/ (dunno why that WakeUp.h file was copied there, shouldn't be there). Although it is really straightforward to use the lib and shouldn't give you an issue. Combine it with Andy's lib and deepsleep powerconsumption should be around 3uA including the WakeUp part which stays active :)

Accepted Answer

Actually there was a minor issue. In my efforts to be paranoid about power consumption the watchdog timer was getting powered down which made it hard to wakeup on a watchdog afterwards. In order to give flexibility I've added two new power modes, DeepSleepWD and PowerDownWD, that keep the watchdog powered up.

posted by Andy A 28 Sep 2014

Ah yeah thats an issue. For example how I did it in the LPC1114 and LPC812 sleep codes is: http://mbed.org/users/mbed_official/code/mbed-src/file/098575c6d2c8/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/sleep.c and http://mbed.org/users/mbed_official/code/mbed-src/file/098575c6d2c8/targets/hal/TARGET_NXP/TARGET_LPC81X/sleep.c (according to the user manual the LPC1114 is a bit more demanding on what is done with the reserved bits, which is why the code is a bit different. And the LPC1114 has no powerdown, only deepsleep which is pretty much equal to powerdown in power consumption).

But there they keep the current run mode settings equal regarding both the watchdog oscillator and brownout detection. Although iirc by default brownout is enabled, and that uses a ton of current (relative to powerdown current). So disabling that in your lib might indeed be a good idea. But again iirc, the watchdog oscillator is by default enabled. So you could also have a look at similar to those sleep codes to automatically check if it is currently running, and if it is, to keep it running. But either way works, obviously this way you have more control as user, but also more options.

posted by Erik - 28 Sep 2014

The manual lists the watchdog power draw as 4uA. In deepsleep that's only a 1% increase but in power down that is a doubling of the power consumption. True 7uA is hardly going to suck a battery dry overnight but why waste power when you don't need to.

Since I have the number in front of me, brownout detect adds 51uA to the current draw, that a 15% increase in deep sleep or 1700% in power down.

posted by Andy A 29 Sep 2014

Yeah I saw that in the manual, however IIRC that is running the watchdog oscillator at a much higher frequency than I do. I don't know how much of its power consumption is static (so independent of frequency) and how much is dynamic. I am sure I have measured it, and I think it is alot less using the WakeUp lib. But I am not 100% sure. (I do know that on the LPC1114 I think the setup used around 2uA, with the same watchdog oscillator, but alot more complicated setup which should use more power).

posted by Erik - 29 Sep 2014
9 years, 7 months ago.

You know I've only ever used an external signal to wake the thing up. Any interrupt will work so a Timeout or Ticker should wake the system up.

I'm not entirely sure how the timers react in power down mode so start with sleep, get that to wake up and then try the other lower power modes. Let me know what you find and I'll update the documents. :-) Right now things are optimised for power saving, everything that can be turned off is. I may need to add an option to keep timers powered up to get clock based wakeups to work in deep sleep or power down.

If you get stuck or find something that doesn't work and you think it should let me know, I may have time to play around and try things out tomorrow afternoon.

As noted by Erik below, you need to use the watchdog to wake from DeepSleep or PowerDown. You also need to use the power modes I just added to the library that keep the watchdog timer switched on. The documentation is updated to reflect this change.

The code linked below is two examples in one, the top section uses the normal sleep mode and a Ticker, the lower block of code uses powerdown the watchdog. Both have the same end result other than the power draw and accuracy of the timers. http://mbed.org/users/AndyA/code/SleepyCounting/

posted by Andy A 28 Sep 2014