Keil Logo

Enable 4-Pin Trace (ETM)

To enable CoreSight ETM tracing on NXP LPC43xx 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 LPC43xx User Manual chapter LPC43xx Pin Connect Block.
  • Configure µVision to capture ETM trace data.

Enable the Trace Port Interface

  1. Create a text file, for example LPC43xx_TP.ini, and enter the following code:
    /*-------------------------------------------------------------------
    ** Define the function to enable the trace port
    **-----------------------------------------------------------------*/
    FUNC void EnableTPIU(void) {
    
      _WDWORD(0x40086790, 0x000000B2);  // LPC_SCU->SFSPF_4 = 2;
      _WDWORD(0x40086794, 0x000000B3);  // LPC_SCU->SFSPF_5 = 3;
      _WDWORD(0x40086798, 0x000000B3);  // LPC_SCU->SFSPF_6 = 3;
      _WDWORD(0x4008679C, 0x000000B3);  // LPC_SCU->SFSPF_7 = 3;
      _WDWORD(0x400867A0, 0x000000B3);  // LPC_SCU->SFSPF_8 = 3;
    }
    
    /*-------------------------------------------------------------------
    ** Invoke the function at debugger startup
    **-----------------------------------------------------------------*/
    EnableTPIU();
    
    /*-------------------------------------------------------------------
    ** Execute upon software RESET
    **-----------------------------------------------------------------*/
    FUNC void OnResetExec(void)  {
      EnableTPIU();
    }
    

    Use the _WDWORD command to configure registers.

    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 LPC43xx_TP.ini into the Initialization File field.

    Enable trace on LPC43xx

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 LPC43xx

  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 the Clock Signal Delay CLK to 4.9ns.
  6. Set Trace Enable and ETM Trace Enable.
  7. 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.

Note

  • Use the examples delivered with the Keil board MCB4300 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.