Measure Power with ULINKplus

An Arm Keil ULINKplus debug adapter offers serial-wire debug capabilities, measures the CPU core clock directly, and adds power measurement. Together with Event Statistics, this can be used to create power profiles for code sections.


For details on how to connect the ULINKplus to your board, refer to the documentation .

Configure ULINKplus with an Initialization File

You can configure the ULINKplus adapter with a set of debug commands that you can capture in a debug script. These scripts are executed when debug mode is entered. A debug script template is available in your tool installation: C:\Keil_v5\ARM\ULINK\Templates\Debug_UlinkPlus.ini as a reference.

  1. Copy this file into your project directory (where the *.uvprojx file is located).
  2. Go to Image Alt Text:Options for Target Project - Options for Target… (Alt+F7) and switch to the Debug tab.
  3. Click on in the Initialization File: box, and add the file:
    Image Alt Text:Debug_UlinkPlus.ini added to the target options
  4. Click Edit… to open the file.
  5. Click OK to close the target options window and return to the main μVision window.
  6. Click on the Configuration Wizard tab at the bottom of Debug_UlinkPlus.ini window.
  7. Enable ULINK Power Measurement and select the value of your shunt resistor (in this case 2.55 Ohm/100 mA):
    Image Alt Text:Debug_UlinkPlus.ini configuration
  8. Go to Image Alt Text:Save All File - Save All.

ULINKplus is now configured and ready to use.

Measure Power in System Analyzer

  1. Image Alt Text:Build Start a Debug Session (Ctrl+F5) to enter the µVision debugger.
  2. Image Alt Text:Run Run (F5) the application.
  3. If the window is not already open, go to View - Analysis Windows and select Image Alt Text:System Analyzer Window System Analyzer.
  4. Click the Image Alt Text:Lock lock symbol to stop the data collection.
  5. Zoom in or out with or your mouse wheel. First, click in the waveform to set an anchor point.
  6. You will have a window similar to the one below: Image Alt Text:System Analyzer with Power Consumption

The Current and Voltage waveforms are shown in the Consumption section.

  • If Current has negative values, reverse the shunt wires.
  • The Voltage and Current Y axis numbers are adaptive and will change dynamically to suit the values displayed.

Power Consumption in the Event Statistics Window

  1. Go to View - Analysis Windows and select Image Alt Text:Event Statistics Event Statistics to open the window:
    Image Alt Text:Event Statistics with Power Consumption

The various statistics are displayed and updated in real-time. Timings, voltage, current and charges consumed are recorded according to Groups and Slots. These are created by the EventStartX() and EventStopX() function calls in the application code.

Energy Measurement without Debug

The CoreSight debug components consume some amount of power. This will be reflected in the System Analyzer window. To be able to measure the real-life power without a debug connection, a specific debug mode is available. In this more, you will not be able to relate the waveforms with your code. The effects will be most pronounced during processor Sleep and WAIT states when the current drops to very low values.

  1. Stop a Debug Session (Ctrl+F5) to leave the µVision debugger.
  2. Go to Image Alt Text:Energy Measurement Debug - Energy Measurement without Debug.
  3. The debug session starts and you can Image Alt Text:Run Run (F5) the application as usual.
  4. System Analyzer will display the waveform as shown below:
    Image Alt Text:Energy Measurement without Debug

Any features needing CoreSight will not be available.