Introduction to power debugging
Reasons for using power debugging
Long battery lifetime is a very important factor for many embedded systems in almost any market segment—medical, consumer electronics, home automation, etc. The power consumption in these systems does not only depend on the hardware design, but also on how the hardware is used. The system software controls how it is used.
For examples of when power debugging can be useful, see Optimizing your source code for power consumption.
Briefly about power debugging
Power debugging is based on the ability to sample the power consumption—more precisely, the power being consumed by the CPU and the peripheral units—and correlate each sample with the application’s instruction sequence and hence with the source code and various events in the program execution.
Traditionally, the main software design goal has been to use as little memory as possible. However, by correlating your application’s power consumption with its source code you can gain insight into how the software affects the power consumption, and thus how it can be minimized.
Measuring power consumption
The debug probe measures the voltage drop across a small resistor in series with the supply power to the device. The voltage drop is measured by a differential amplifier and then sampled by an AD converter.
The TI MSP-FET and TI XDS 110 debug probes use EnergyTrace(TM) Technology support to measure the power supplied to a target microcontroller. A software-controlled DC–DC converter generates the target power supply. The time density of the DC–DC converter charge pulses equals the power consumption of the target microcontroller. A built-in on-the-fly calibration circuit defines the energy equivalent of a single DC–DC charge pulse.
Power debugging using C-SPY
C-SPY provides an interface for configuring your power debugging and a set of windows for viewing the power values:
The Power Log Setup window is where you can specify a threshold and an action to be executed when the threshold is reached. This means that you can enable or disable the power measurement or you can stop the application’s execution and determine the cause of unexpected power values.
The Power Log window displays all logged power values. This window can be used for finding peaks in the power logging and because the values are correlated with the executed code, you can double-click on a value in the Power Log window to get the corresponding code. The precision depends on the frequency of the samples, but there is a good chance that you find the source code sequence that caused the peak.
The Power graph in the Timeline window displays power values on a time scale. This provides a convenient way of viewing the power consumption in relation to the other information displayed in the window. The Timeline window is correlated to both the Power Log window, the source code window, and the Disassembly window, which means you are just a double-click away from the source code that corresponds to the values you see on the timeline.
The Function Profiler window combines the function profiling with the power logging to display the power consumption per function—power profiling. You will get a list of values per function and also the average values together with max and min values. Thus, you will find the regions in the application that you should focus when optimizing for power consumption.
Requirements and restrictions for power debugging
To use the features in C-SPY for power debugging, you need one of these:
An I-jet or I-jet Trace in-circuit debugging probe. Note that power debugging is not possible when using I-jet Trace with ETM.
For more accurate power debugging, you can connect the I-scope probe between the I-jet/I-jet Trace probe and the target board. I-scope adds detailed current and voltage measurement capability.
A J-Link Ultra debug probe and a Cortex-M device with SWO.
A TI MSP-FET debug probe, featuring the EnergyTrace(TM) technology provided by Texas Instruments, and a TI MSP-FET device. The probe outputs voltage, current, and energy information.
An ST STLINK-V3PWR debug probe and a Cortex-M device with SWO. The target board should be powered via the probe.
A TI XDS110 debug probe, featuring the EnergyTrace(TM) technology provided by Texas Instruments, and a Texas Instruments device. The probe outputs voltage, current, and energy information.