EnergyTrace for MSP432

From Texas Instruments Wiki
(Redirected from Energy Trace for MSP432)
Jump to: navigation, search

Introduction

EnergyTrace™ technology for MSP430 and MSP432 microcontrollers is an energy-based code analysis tool that measures and displays the application’s energy profile and helps to optimize it for ultra-low-power consumption.

This page describes the Energy Trace features for MSP432 devices. For details about MSP430, please check this page.

Features

  • Supports three modes of operation:
    • ET: Energy profiling only
    • ET+: Energy profiling + Program Counter trace
    • ET++: Energy profiling + Program Counter trace + Peripheral state (not supported in MSP432)
  • EnergyTrace measurements exported via a USB bulk endpoint - i.e., independent on having an active CCS debug session or connection to the device core.
  • Electrical specifications:
    • Accuracy: ± 2% ± 500nA, Condition: I < 25mA, VBUS = 5V constant during and after calibration
    • Accuracy: ± 5% ± 500nA Condition: I > 25mA & I < 75mA, VBUS = 5V constant during and after calibration
    • Maximum current: 100mA
    • Fixed voltage for energy and power calculations: 3.3V


How does it work?

MSP432 allows the debugger to control the power transitions of the device and read the power status using bits in the Debug Access Port (DAP) CTRL/STAT register.

CCS has 3 modes in which the core can be run:

  1. Run : Run with debug control for active debugging. In this mode power transitions are disallowed by the debugger and it sets the CSYSPWRUPREQ bit.
  2. Free run : Run without debug control. In this mode the debugger clears the CSYSPWRUPREQ bit. But JTAG is still active in this mode as DAP is still connected.
  3. Low power run : Run with debug control and allow core to transition power levels. In this mode the debugger clear the CSYSPWRUPREQ bit and JTAG is still active.


ET+ mode and Code profiling:
To be able to obtain code profile, the Program Counter is sampled by reading the PCSR (PC Sampling Register). The PCSR is a memory mapped register in the DWT debug module of Cortex M cores and can be accessed via the AHB AP. When MSP432 is allowed to enter low power state (during CCS Free Run and Low Power run), the AHB AP is powered down by the MSP432 PCM and accessing it hangs the bus. This makes polling for the PCSR an unsafe operation in the Free run and LP Run modes. As a result the only information returned during a Free/LP run is the device status as active or low power. Code profiling is not performed. For code profiling the regular run option must be selected from CCS.

Difference between MSP430 and MSP432.
In MSP430 devices since the MSP430 is the only core, on a Free Run, JTAG is disabled. In the MSP432 device, the Cortex M core sits under a DAP. So even though Free Run is issued from the core, the DAP is still connected and so JTAG cannot be disabled. For obtaining true power measurements MSP430 used the Free Run mode. As this is not possible for MSP432, a new mode was created called ET-only mode. In this mode ET is launched without a debug session and allows true power measurements. More details can be found in the EnergyTrace ET-Only Mode section below.



Requirements

  • CCSv6.1.x or newer
  • XDS110 JTAG debugger.
  • (optional) this page references a test project available here


Using EnergyTrace

As mentioned before, EnergyTrace can be invoked during a CCS active debug session (ET on a debug session, where both ET and ET+ modes are available), or by itself (ET-only mode, where only ET mode is available).

EnergyTrace (ET and ET+) on a Debug Session

Two modes are available when ET is invoked during a debug session: ET and ET+.

1. Open CCS, select a workspace and, before anything, make sure that EnergyTrace is enabled and the selected connection is XDS110. For that, go to menu Window --> Preferences, navigate to the EnergyTrace settings and check the settings as shown below (click to expand):

Energy Trace main options.PNG



2. Launch a debug session and load the code to the target device.

before launching a debug session, a target configuration file for the MSP432 Launchpad has to be created using the target configuration editor. Make sure to select the following options:
Texas Instruments XDS110 USB Debug Probe for the Connection field
MSP432P401R for the Device or Board field
Note: for details on how to create this file, check this reference.


3. The EnergyTrace view should show up with three tabs:
Main tab
Power tab
Energy tab

4. Resume the code execution (F8). After 10 seconds (configurable via the stopwatch icon ET Stopwatch icon.PNG), the EnergyTrace view should show up with the measurements and graphs as shown below - the actual measurements depend on your code:
Measurements
Power graph
Energy graph

Note: Click on the small floppy disk icon ET Save icon.PNG if you desire to save the data for future comparison.


5. To see the device actually going to the deep sleep, suspend the core (Alt+F8), Restart (menu Run --> Restart) and issue a Free run (menu Run --> Free Run). The results shown below demonstrate this scenario where the minimum current is a fraction of the value obtained previously:
Measurements
Power graph
Energy graph

6. If needed, the results can be compared with the previous run by clicking on the small folder icon ET load icon.PNG and browse to the previously saved file. The differences are showcased in the three tabs as shown below:
Measurements
Power graph
Energy graph

7. To verify the device actually going to the power transition, EnergyTrace plus (ET+) is required. Click on the ET+ switch icon ET plus icon.PNG, which will show an extra tab called States.

8. Click on the tab EnergyTrace+™ profile, Suspend the target, Restart and Free Run. After 10 seconds the ET+ views will be updated showing the CPU states:
Measurements
Power graph
Energy graph
States graph


EnergyTrace ET-Only Mode

As seen in the previous section, despite free running and entering the deep sleep mode, the device's JTAG circuitry still consumes some extra power. To prevent this, a debug session cannot be used and therefore ET-only mode will yield the most accurate power consumption measurement.

1. Make sure the device is running free, then terminate the debug session (Ctrl+F2).

2. Click on the small EnergyTrace icon ET only icon.PNG on the top toolbar and, after CCS switches to the CCS perspective, the EnergyTrace ET-only mode view will be shown.

3. Click on the small Play icon ET only play icon.PNG and wait until the 10 seconds are finished. The display will show the measurements without the JTAG circuitry involved.
Measurements
Power graph
Energy graph

4. Notice the much smaller power measurements obtained this time. These results can also be compared with the previously saved results.


One More Look at ET+

One additional aspect of EnergyTrace+ is its capability to show the power consumed by each function in a system.

1. With the EnergyTrace project open, select the FP_run build configuration: right-click on the project, select Build Configurations --> Set Active.

2. Launch a debug session and the Energy Trace view should open. Click on the ET+ switch icon ET plus icon.PNG and set the total run time to 30s by clicking on the small arrow near the stopwatch icon ET Stopwatch icon.PNG.

3. Put the target to resume (F8) and wait until the 30s have passed. You should get the energy details separated by function as shown below:
ET plus fxn profile.PNG



Quick tip video

A quick tip video about Power state profile usage is located here.