Main Site Documentation

More ways to conserve power


To lower power consumption in my Panda II I’d like to turn off several LPC2387 functions that are not needed by my application. Specifically, UART, SPI, CAN, AND I2C. From reading the manual it looks like I just need to set the corresponding bits to zero in register “PCONP - 0xE01FC0C4”.

Do any of you with more experience than I see any problems with this or could you suggest a few lines of code that I could use. The relevant page from the 2387 user manual is below.

As always thanks for any help.


Use something like this:

    //Diasble PWM1
    Register PCONP = new Register(0xE01FC0C4);


Once you are done, could you please post the results, i.e. power use before and after, just to see if it is worth doing ? :slight_smile:

To save many a milliamps more :wink: you can also shut down the onboard led, that are slightly lighted if not configured… (“high impedance output”).


Thanks for the tips. I’ll report back when I get the numbers.


You are welcome! ;D


Results I have.

Unless I’ve done something wrong in the code (posted below) it looks like using the power control register to disable UART0, UART1, PWM1, I2C0, & SPI only saves about 1.6 ma. Turning off the board led saves another 2.0 ma. Fairly small amounts compared to reducing the clock rate, but a milliamp here, a milliamp there, and pretty soon they start to add up.

In a different test I cut the clock rate from 72 MHz down to 24 MHz and the slower clock rate reduced the current draw by 25 ma (50 ma down to 25ma), so much bigger savings by cutting the clock rate. Even so, if you want to save power it makes sense to disable unused functions on the chip.

If anyone is interested here’s the code I used for the power control register. Architect, for some reason (probably my lack of experience), I couldn’t get “PCONP.ClearBits(1<<6);” to work so I used ClearBits and SetBits with a mask. Is this approach OK? Here’s the code.


using System;
using System.Threading;

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Hardware.LowLevel;

namespace turnoff
    public class Program
        public static void Main()
            // define the power control register PCONP
            Register PCONP = new Register(0xE01FC0C4);
            // turn off on board led
            bool ledstate = false;
            OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledstate);
            while (true)
                // print PCONP register initial state
                Debug.Print("register 0xE01FC0C4 = " + PCONP.Read().ToString() + "led is = " + ledstate.ToString());
                //Diasble UART0, UART1, PWM1, I2C0, & SPI 
                UInt32 mask = 472;
                Debug.Print("register 0xE01FC0C4 after 472 mask ClearBits = " + PCONP.Read().ToString());
                // sleep for 7 seconds while I measure current draw
                // Restoreclock/power to UART0, UART1, PWM1, I2C0, & SPI
                Debug.Print("register 0xE01FC0C4 after 472 mask SetBits = " + PCONP.Read().ToString());
                Debug.Print(" ");
                // pause to measure current again
                // toggle led state for next set of measurements
                ledstate = !ledstate;


Masks are fine. It was just an example. Thanks for the information on power consumption numbers!


Those numbers make sense. Maybe you can share what you found here?


Gus, I added a bit to the wiki on this subject. I wasn’t sure how to do an on page link so it wound up linking to a separate page. I left the text in both locations in case someone knows a quick way to link within the page.

Maybe it also makes an easier read if the four bullets for power saving (Reduce processor clock, Shutdown the processor when system is idle (keep peripherals and interrupts running), Shutdown specific peripherals, Hibernate the system) each have their own page?