Going to sleep

Once again, I am thinking about embedded software and low power design, as I have discussed before. I still find it interesting that a characteristic of electronic devices, which until only recently would have been considered purely a hardware issue, is now very much on the agenda for software developers.

The challenge now is to keep up with the capabilities provided by the chip makers …

There are broadly two contexts in which a device’s power consumption may be considered: when it is in use and when it is idle.

During use, there are a couple of measures that software can take to keep power consumption to a minimum:

  1. Switch off peripherals that are not in use.
  2. Adjust the frequency and voltage of the CPU according to the current performance requirements [this is “Dynamic Voltage and Frequency Scaling” – DVFS].

Although this functionality may be implemented in application code, this is cumbersome and not very logical. It makes much more sense for the operating system to include a power management framework, as the correct operation of drivers, in particular, may be drastically affected by power saving measures and the OS can readily manage this. This is how power management with Nucleus has been implemented.

When a device is not in use, it may be switched off entirely. This requires little in the way of software support, though some devices might need some status information saved on power down. The only problem is that a fully powered down device may take some time to start up. Even with a lightweight RTOS, modern large applications can take many seconds to boot. The alternative to power down is some kind of sleep mode.

We are all familiar with the 2 sleep modes used by most laptops:

  • Standby – The CPU and peripherals are shut down, but power is maintained to RAM. This mode has the advantage that wake-up is very fast, but the downside is that power continues to be drawn, so there is a limit on how long a device can be in standby.
  • Hibernate – Data is written out to [disk] storage and the system shut down. This mode has the advantage that there is no ongoing power drain, so the hibernated state can be sustained indefinitely. However, wake-up takes longer, as data needs to be copied back into RAM, but this is still much faster than a cold boot.

Increasingly, embedded processors are having similar sleep modes incorporated. Of course, this needs OS support. Recently, Mentor Embedded announced standby and hibernate support for Nucleus.

Want to stay up to date on news from Siemens Digital Industries Software? Click here to choose content that's right for you

Leave a Reply

This article first appeared on the Siemens Digital Industries Software blog at https://blogs.sw.siemens.com/embedded-software/2012/07/23/going-to-sleep/