You are viewing an older revision! See the latest version

Power Management

In the current technology used for CMOS integrated circuits, the primary source of power consumption occurs during switching:

Power = Capacitive load x Voltage2 x Clock Frequency

So to reduce power, you need to reduce one or more of these terms to reduce power.

Reducing Capacitive Load

Capacitive load is a function of both the gate technology and the number of transistors. An end user cannot change the gate technology, but they can power down unused hardware devices to lower the capacitive load. Many devices have hardware support to turn off various I/O hardware units by disabling their clock.

Reducing Voltage Levels

In recent years, voltage levels have been reduced on logic from 5V to 3.3V and internal devices in many processors use core voltages near 1V. Reduction below 1V is unlikely due to device physics. An end user can't change the processor design, but they can use new lower power 3.3V devices instead of 5V when possible to reduce the power used in a design.

Reducing Clock Frequency

Processors have been able to increase clock frequency to run faster as IC circuits have become smaller. A faster clock boosts performance, but unfortunately also increases power levels. So turning off the clock, or slowing down the clock whenever excess CPU time is available can be used to reduce power levels. Many processors have hardware support to vary the clock frequency or even turn off the clock(i.e., Sleep mode). Some reduced power levels will still be required even with the clock off to save the values in registers and volatile RAM memory, so that the device can wakeup without a full reboot. Interrupt hardware is used to wake a device from Sleep mode, so that hardware can't be turned off.

Reducing power is not only green, it saves money by saving power. Over the life of a computer system, the money spent to power and cool the device can cost as much as the device itself. So well engineered designs need to minimize power whenever practical. Devices running off of batteries such as cellphones need power management for long battery run times. A fully powered cellphone would run down the battery in just a few minutes without power management.

Code example reducing mbed power

Mbed was not designed for very low power levels, but it is still possible to save significant power with a little additional effort. The processor includes support to power down unused devices, vary the clock rate, and enter low power Sleep modes. Here is a simple code example showing how to get started on using the power management features to reduce the power levels on mbed. The code blinks the LEDs using a bit less than half of the normal power levels. The Ethernet controller is powered down by writing to a register that disables its clock. The mbed USB interface is powered down by sending it a special power down command supported in a new version of the firmware. To support this feature, power must be supplied using the mbed's Vin pin instead of the USB cable. Instead of using wait, Sleep is used. Sleep does not clock in new instructions, it turns off the clock on the processor core and waits for an interrupt. Ppwer reductions are stated in mW assuming a 5V supply is used. Recall that Power = V * I , so if you want to see the mA levels just divide by 5.

This code is based on some power control information in the forums at http://mbed.org/users/no2chem/notebook/mbed-power-controlconsumption/ and some new experimental firmware that allows the USB interface chip to reduce power levels at http://mbed.org/users/simon/notebook/interface-powerdown/. This is helpful when running mbed from limited power sources such as batteries. Information on how these power down functions are used to power down the devices can be found in Chapter 4 of LPC1768 User Manual and they are also discussed in Chapter 14 of the Cortex M3 textbook.

Blink_LED_with_Power_Manangement

#include "mbed.h"
#include "PowerControl/PowerControl.h"
#include "PowerControl/EthernetPowerControl.h"
// Need PowerControl *.h files from this URL
// http://mbed.org/users/no2chem/notebook/mbed-power-controlconsumption/

// Function to power down magic USB interface chip with new firmware
#define USR_POWERDOWN    (0x104)
int semihost_powerdown() {
    uint32_t arg;
    return __semihost(USR_POWERDOWN, &arg);
}

DigitalOut myled1(LED1);
DigitalOut myled2(LED2);
DigitalOut myled3(LED3);
DigitalOut myled4(LED4);

Ticker blinker;
int count=1;
void blink() {
    count = count << 1;
    if (count > 0x08) count = 0x01;
    myled1 = count & 0x01;
    myled2 = count & 0x02;
    myled3 = count & 0x04;
    myled4 = count & 0x08;
}
int main() {
    int result;
// Normal mbed power level is around 690mW
// assuming 5V used on Vin pin
// If you don't need networking...
// Power down Ethernet interface - saves around 175mW
// Also need to unplug network cable - just a cable sucks power
    PHY_PowerDown();
// If you don't need the PC host USB interface....
// Power down magic USB interface chip - saves around 150mW
// Needs new firmware (URL below) and USB cable not connected
// http://mbed.org/users/simon/notebook/interface-powerdown/
// Supply power to mbed using Vin pin
    result = semihost_powerdown();
// Power comsumption is now around half
//
// use Ticker interrupt and Sleep instead of a wait for time delay - saves up to 70mW
// Sleep halts and waits for an interrupt instead of executing instructions
// power is saved by not constantly fetching and decoding instructions
// Exact power level reduction depends on the amount of time spent in Sleep mode
    blinker.attach(&blink, 0.0625);
    while (1) {
        Sleep();
    }
}



It is also possible to vary the clock rate on mbed from 48MHz to 128MHz, but it gets a bit complex since I/O device clock rates will also change. Information on changing the clock rate can be found at http://mbed.org/users/no2chem/notebook/mbed-clock-control--benchmarks/


All wikipages