[Tinyos-help] RE: Mote Low Power Modes
polastre at cs.berkeley.edu
Sun Jan 4 21:45:57 PST 2004
I've gotten this question numerous times so I'm cc'ing to tinyos-help so
that it is archived. Seems there is a lot of interest in the community
about how HPLPowerManagement works so I'd finally like to answer it once and
The whole point of using HPLPowerManagement is that you don't actually *use*
it. You call HPLPowerManagement.enable() and then the mote will
automatically sleep when the following conditions are met:
* the radio is off
* all high speed clock output compare interrupts are disabled
* spi interrupt disabled
* task queue is empty
There is no code to "use" power management, instead each service (Timer,
Radio, SpiByteFifo, etc) calls HPLPowerManagement.adjustPower() when the
component has shut down to notify the PowerManagement component that it
should check the state of the above items again and reset the sleep
register. Thus applications need not worry about explicitly telling the
mote to go to sleep (THIS is the main difference between HPLPowerManagement
and the *deprecated* Snooze).
The main advantage of this approach is it allows services to clean up, save
state, and shut down before the cpu is halted. In snooze, the cpu is stolen
out from under running services without any notification to those services.
For HPLPowerManagement to work, an application must call
CC1000RadioC.StdControl.stop(). After this call, HPLPowerManagement takes
over (once the radio is done shutting down), and sets the appropriate
registers to put the mote to sleep after the task queue empties. Note that
if using a low power radio listening state (such as
CC1000RadioIntM.setListeningMode(i)), the CC1000 radio module will take care
of notifying HPLPowerManagement to say it is okay to halt the CPU.
The mote will wake up on the next 32kHz Timer interrupt.
The long winded answer to your question, Mark, is that *only* services need
to call adjustPower() when they have finished shutting down or starting up.
It is invalid semantics for an application to call adjustPower(), however
you are not penalized by it in the current implementation. Thus, your
application should call HPLPowerManagement.enable() in its
StdControl.init(). Power Management is disabled by default.
I believe HPLPowerManagement is documented somewhere in the TOS 1.1 release.
GDI and TASK/TinyDB both enable HPLPowerManagement. The GDI code is in
contrib/ucb/apps/TestLabApp. GDI uses low power radio sampling (part of the
default CC1000 radio stack) and achieves 30uA sleep state. TinyDB uses its
own TDMA scheme for low power communications and also achieves the same low
From: Mark Hempstead [mailto:mhempste at eecs.harvard.edu]
Sent: Sunday, January 04, 2004 9:22 AM
To: polastre at cs.berkeley.edu
Cc: Matt Welsh
Subject: Mote Low Power Modes
I'm a grad student working with Matt Welsh. I'm currently developing
code that puts the mote (mica2) and the CPU into the six different sleep
modes specified in the Atmega128 manual. We want to be able to
the CPU power consumption. Using code similar to the snooze
code I was able to bring measure the current at 110 uA for Power_save
mode. However reading emails between yourself and Matt and postings on
the tinyos site I realized I should be able to bring the current down to
30uA or so.
Now I'm trying to work with the HPLPowerManagement interface that you
proposed. Do I need to do anything more than:
> call CC1000RadioIntM.StdControl.stop()
> call HPLPowerManagement.adjustPower()
To put the mote in powersave mode? How do I use this interface to specify
the power mode I want? Also the copy of TestLabApp that I have (tinyOS
1.1) does not use HPLPowerManagement but uses snooze. Could you point me
to some simple example code that uses HPLPowerManagement?
Thanks again for your help,
mhempste at eecs.harvard.edu
More information about the Tinyos-help