•CPU – power on but CPU clock off (the CPU's power saving mode)
•Master system clocks – power on
•Low level firmware – power on
•RAM – power on but inactive
•Flash memory – power on but inactive
•CC2420 radio – power on
•AT91 peripherals – power on
Because power is maintained to all the devices the Sun SPOT continues to react to external events such as the arrival of radio data. The Sun SPOT also resumes from shallow sleep without any latency. That is, as soon as any thread becomes ready to run, the Sun SPOT wakes and carries on.
Deep Sleep
The Sun SPOT can be programming to use a deeper
•CPU – power off
•Master system clocks – power off
•Low level firmware – power on
•RAM – main power off, RAM contents preserved by low power standby supply
•Flash memory – power off
•CC2420 radio – power off
•AT91 peripherals – power off
The Java thread scheduler decides when to deep sleep. It takes some time to wake from deep sleep, so the scheduler may choose to shallow sleep if the sleep duration will be too short to make deep sleep worthwhile. Because deep sleep involves switching off the power to peripherals that may be active it is necessary to interact with the device drivers to determine if deep sleep is appropriate. If a deep sleep cannot be performed safely the scheduler will perform a shallow sleep instead.
Activating deep sleep mode
Deep sleep is enabled by default. You can disable deep sleep mode using the SleepManager:
ISleepManager sleepManager = Spot.getInstance().getSleepManager(); sleepManager.disableDeepSleep();
If deep sleep is disabled the Sun SPOT will only ever use shallow sleep. Once deep sleep is enabled, the Sun SPOT may choose to deep sleep if appropriate.
The minimum idle time for which deep sleeping is allowed can be found from the SleepManager. For example, the following code can only ever trigger a shallow sleep:
Thread.sleep(sleepManager.getMinimumDeepSleepTime() – 1);
The following code may deep sleep, but only if a number of preconditions (detailed later) are met:
Thread.sleep(sleepManager.getMinimumDeepSleepTime());
The minimum deep sleep time includes a time allowance for reinitializing the hardware on wake up so that user code resumes at the correct time. Any part of the allowance that is not needed is made up using a shallow sleep.
38