Keil Logo

Enable 4-Pin Trace (ETM)

To enable CoreSight ETM tracing on NXP LPC17xx devices:

  • Connect ULINKpro to the board's Cortex Debug+ETM connector and to the host computer.
  • Enable the Trace Port Interface as described in the LPC17xx User Manual chapter LPC17xx Pin Connect Block.
  • Configure µVision to capture ETM trace data.

Enable the Trace Port Interface

  1. Create a text file, for example conf_LPC17xx.ini, and enter the following code:
    ** Define the function to enable the trace port
    FUNC void EnableTPIU(void) {
      _WDWORD(0x4002C028, 0x00000008);         // Enable TPIU in PINSEL10
    ** Invoke the function at debugger startup
    ** Execute upon software RESET
    FUNC void OnResetExec(void)  {

    ETM TRACEDATA[0..3] are output on the pins P2.5 through P2.2. The trace clock is configured on pin P2.6. PINSEL10.3 enables the trace functions for all trace pins P2.2 through P2.6. When PINSEL10.3 is set, it overwrites the configuration settings of PINSEL4 of the pin connect block.

    Use the _WDWORD command to configure the register, PINSEL10.3: _WDWORD(0x4002C028, 0x00000008);

    The special function OnResetExec() executes upon software RESET. Refer to TPUI Initialization after RESET (Cortex-M) for details.

  2. Open the dialog Options for Target — Debug, and insert conf_LPC17xx.ini into the Initialization File field.

    Enable trace on LPC17xx

Configure µVision to capture ETM trace data

  1. Enable Use, select ULINK Pro Cortex Debugger, and click Settings to open the Target Driver Setup dialog.

    Enable trace on LPC17xx

  2. Click the Trace tab.

    Options for ETM trace

  3. The Core Clock must correspond to the device configuration.
  4. Set Trace Port to Sync Trace Port with 4-bit Data.
  5. Set Trace Enable and ETM Trace Enable.
  6. Optionally, enable Unlimited Trace to navigate through the complete data stream history. Make sure to enable this option when measuring the system's energy consumption with PowerScale.

Start the debugging session and verify the captured trace data with a µVision window.


  • Use the examples delivered with the Keil board MCB1700 as a reference.
  • ETM tracing works in Serial Wire Debug as well as in JTAG Debug mode.
  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.