MCU tools help estimate and minimize power use
Software tools can lead engineers and programmers to peripherals or sections of code that use too much energy.
Josh Norem, an application engineer at Silicon Laboratories, gave me a demonstration of the company's Power Estimator tool available within the larger, free AppBuilder software. The Power Estimator tool now covers the SIM3L1XX Device, although Silicon Labs plans to add sleep-mode power conditions and other MCUs soon.
"Power Estimator gives you a top-level view of how your MCU will use power," said Norem. "Then you can dig into the details of smaller functional blocks. At the high level I might see how the battery supply drives three low drop-out regulators (LDOs) that feed power to analog, digital, and memory sections."
"A deeper look shows the LDOs waste a lot of power because they drop 3.3 volts to 1.8 volts," continued Norem. "You can look closely at the LDOs and use our Power Estimator tool to connect them to the MCU's internal DC-DC converter instead. That arrangement introduces a small loss from the converter, but it greatly decreases the loss in the LDOs. And a color-coded pie chart shows the proportion of power used by each device within the MCU. That's an example of how you can adjust power use as a project starts even though you don't have any hardware."
"You also can examine how code and its location--flash or RAM-- affects power. We have seen a 4-fold change in power depending on the code an ARM core runs," said Norem. “If you have a simple code loop that resides within the same line of flash memory, the processor will not use much power. But when code crosses memory boundaries and runs many I/O or math operations, power goes up.
Silicon Labs now has two code profiles for the Power Estimator: A NO-OP code loop and a "typical" code loop. These profiles let you see how code affects power use. The company's engineers will add profiles for maximum-power, control, and DSP operations.
Norem added, "Engineers and programmers should keep in mind that the Power Estimator tool provides a model, so its results don't always match reality 100 percent. Most of the time, though, engineers who use Power Estimator get better-than-expected results on their hardware.
Instead of simulating operations, engineers can measure current and relate it to their code operations on a development or prototype board. According to Raman Sharma, Energy Micro's vice president of sales for the Americas, the company's energyAware Profiler lets engineers and programmers monitor and "debug" energy consumption in an overall system.
"All our development kits provide an on-board Advanced Energy Monitoring function, or AEM," said Sharma. "Our free software gives people three views of power use. First, a graph shows power use in real time on a current vs. time plot. Second, we display the running application code, and third, an energy-profile shows function-by-function power use. For each function called in the application code, the eA Profiler reports the microjoules used and the function's proportion of overall power use."
Because Energy Micro boards include current-measuring components, engineers can use one of these boards to monitor power on other breadboards or prototypes. "Engineers and programmers still get the same eA Profiler functions and data at no extra cost," noted Sharma.
I have an Energy Micro Tiny Gecko Starter Kit in my lab and asked how this type of off-board monitoring works. Sharma explained, "We have a 20-pin ARM-compatible JTAG header on all our starter-kit boards, so you take the SWO and SWD signals on one of these boards and connect them to the comparable pins on your target board. You also run power through the starter-kit board. Of course, we hope people will use one of our EFM32 ARM MCUs on their target boards!"
Sharma also noted the eA Profiler includes a Battery Estimator engineers can use to get a projection of power use. "You start the eA Profiler and set up your system in a flow chart or state diagram," said Sharma. "In each state you note the peripherals you would have active, say, an ADC or an LCD driver. Then you choose the type of battery you plan to use and the Battery Estimator indicates how long the battery will last. It also estimates energy consumption of the overall system."
"When you look at microcontroller hardware one section at a time, power use isn't difficult to figure out," said Mats Pettersson, senior field applications engineer with IAR Systems. "When you start to integrate these sections for an application, though, it becomes difficult to figure out what combination provides the lowest power use."
"When engineers and programmers use one of our I-jet debug probes, it will sample power going to a board so our Power Debugging software can associate each sample with a time stamp and save that information." Current measurements have a resolution of about 200 ?A at 200 ksamples/second. The ARM Cortex-M MCUs include CoreSight, an on-chip debug-and-trace unit and a data-watchpoint-and-trace (DWT) unit. The DWT samples the program counter about 5000 times/second and triggers an instrumentation-trace macrocell (ITM) packet that includes this time stamp.
Power Debugging gives people several views of power use. "A timeline window provides an overview of all power consumption," explained Pettersson. "Each bar in the display shows one power sample. Double click any of these bars and you go right to the source code that corresponds to that power sample. Another trace displays as many as 32 variables, but it does not correlate these with power use."
"In practice it's more likely you want to see how a particular function affects power consumption rather than see current use statement by statement," said Pettersson. "The Function Profiler helps you find the functions in which the processor spends most of its time for a given stimulus. In this way, you can locate places in application code where you can save power."
On a Cortex-M3 device the debugger samples the program counter (PC) and the profiler finds the function that corresponds to the sampled PC value. Then to generate function profiling information, the profiler builds a data base that shows how often each function runs. And the debugger displays the profiling information for each function. "Power profiling combines the function profiles with the power samples so you will see how much power each function uses," said Pettersson. "Programmers can set power breakpoints, too. If the power goes above or below setpoints, the application can stop and you can look deeper into what caused power to go out of range."
When you create your prototype board, pin 19 on the standard I-jet JTAG connector will provide 400 mA of power for your circuits and also let the IAR software monitor power use.
Silicon Laboratories: www.silabs.com/products/mcu/Pages/32-bit-mcu-software.aspx.
Energy Micro: www.energymicro.com/software/simplicity-studio.
IAR Systems: www.iar.com/en/Products/IAR-Embedded-Workbench/Power-debugging/