Keil Logo

Power Measurement Setup

After ULINKplus is selected as target debug adapter in the µVision project you can configure the ULINKplus for power measurement. This can be done in three different ways:

Configuring power measurement in ULINKplus window

In the debug mode, open the ULINKplus dialog from menu View - Analysis Windows - ULINKplus.

Power Dialog The Power section shows these values:

  • Shunt R - external shunt resistor in Ohms (see Note below)
  • Voltage - measured voltage in Volts
  • Current - measured current in Amperes
  • Power - calculated power in Watts
  • Average Current - measured average current in Amperes
  • Charge (Q) consumed - measured total charge in mAs
  • Time measured - total time measured in Seconds
  • Current offset - calibration current in Amperes (refer to Offset calibration for current)
  • Enable - enable or disable power measurement capture.

Note:

  • Shunt R shows the value of the external shunt. If no external shunt is specified (the default), a value of '0' will be shown.

ULINKplus comes with a set of six boards for external shunts. Please refer to the following table for the resistor values:

Current range (mA) External shunt in (Ω) ULINK_SHUNT value
2.5 N/A 0
5 100 100
10 33.2 33.2
25 11 11
50 5.23 5.23
100 2.55 2.55
250 1 1

Configuring power measurement using command window

µVision has a set of Virtual Simulation Registers (VTREGs) for power measurement settings and values. These VTREGs can be accessed at run-time during debug session from µVision Command Window. For example:

Command window

Power measurement VTREGS

The table below describes the ULINKplus power measurement Virtual Simulation Registers (VTREGs):

VTREG Type Description
ULINK_PM integer Enable or disable power measurement capture. 1=Enable, 0=Disable
ULINK_SHUNT float Set or return the external shunt resistor value in Ohm
ULINK_U float Return the last measured voltage value in Volt (V)
ULINK_I float Return the last measured current value in Ampere (A)
ULINK_I_OFFSET float Set or return the offset value in Ampere (A) used as zero point reference for the current measurement. The default value is 0.
ULINK_I_AVG float Return average current in Ampere (A) drawn during program execution.
ULINK_Q float Return total charge in Ampere Seconds (As) consumed during program execution.
ULINK_I_TIME float Return program execution time that was used for the calculation of ULINK_I_AVG and ULINK_Q.

See µVision documentation for additional details on Virtual Simulation Registers (VTREGs).

Configuring power measurement using debug script

The µVision debugger allows you to construct and execute a sequence of debugger commands using an initialization script.

For ULINKplus configuration the Debug_UlinkPlus.ini initialization file can be used as a template for such script. It is located at [MDK installation_path]\ARM\ULINK\Template\ and best should be copied in the project directory for editing. The default [MDK installation_path] is C:\Keil_V5.

The path to such *.ini file should be provided in the debug configuration dialog:

Debug Initialization File

In this script, you can assign target values to the ULINKplus VTREGs and hence get the ULINKplus automatically configured right before the debug session start or prior to energy measurement without debug.

The file is already annotated with Configuration Wizard support, enabling GUI-like configuration for enabling power measurement and selecting the external shunt values.

Debug Initialization File

The Debug_UlinkPlus.ini template also annotates I/O pin configuration and provides function examples.

For more information on debug scripts, see Command input from file.

Offset calibration for current

For a precise measurement of very small currents, the bias offset of ULINKplus needs calibration. This offset differs, based on the shunt resistors. The VTREG ULINK_I_OFFSET contains the offset adjustment after calibration.

Capture the current offset

The following steps describe how to adjust the current offset:

  1. Disconnect the target hardware from the shunt resistor.
  2. Enter the Energy measurement without debug mode and run the program.
  3. In the System Analyzer window, right-click into the Current line and select Zero Point Adjustment (from visible area) to set the offset automatically. Note the number that is shown in the menu entry as this needs to be used in consecutive runs:

    Zero Point Adjustment

  4. Leave the energy measurement session and open the Debug_UlinkPlus.ini file. In the following section, enter the value that you have just determined:
    /*------- Zero point reference for ULINKplus I/O current measurement-----------*/
    /* Example: for a 3.5 uA offset, specify -3.5e-006                             */
    ULINK_I_OFFSET = -3.4602e-006;
    

When starting a new energy measurement or debug session, the offset value will be taken into account.

Note:

To remove the offset, specify a negative number.

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.