Keil Logo

Enable Serial Wire Trace

To enable Serial Wire Trace on Toshiba TMPM360 devices:

  • Connect J-Link/J-Trace to the board's Cortex Debug connector and to the host computer.
  • Enable the Serial Wire Trace Output Port.
  • Configure µVision to capture Serial Wire Trace data.

Enable the Serial Wire Trace Output Port

  1. Create a text file, for example TMPM360_SWV.ini, and enter the following code:
    /*-------------------------------------------------------------------
    ** Define the function to enable the trace port
    **-----------------------------------------------------------------*/
    FUNC void EnableTPIU(void) {
    
      _WDWORD(0x400C0508, 0x03);   // Configure Port F pins for tracing using PFFR1.
      _WDWORD(0x400C0504, 0x02);   // Enable output on port F using PFCR.
    }
    
    /*-------------------------------------------------------------------
    ** Invoke the function at debugger startup
    **-----------------------------------------------------------------*/
    EnableTPIU();
    

    On TMPM360 devices, port F is used for tracing. After reset, the pins PF0-PF4 are set to general I/O ports.

    The Serial Wire Trace Output pin is PF1 and has to be configureda after each reset. The trace clock on PF0 has to be enabled as well.The Port Function Register, PFFR1, selects the port function, whereas the Port Control Register, PFCR, enables port F pins as output or input pins. These pins have to be reprogrammed after each RESET.

    Use the _WDWORD command to configure the PFFR1 and PFCR registers.

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

    Configure the device for tracing

Configure µVision to capture Serial Wire Trace data

  1. Open the dialog Options for Target — Debug.

    Select J-Link/J-Trace as the debugger adapter

  2. Enable Use, select Cortex-M/R J-LINK/J-Trace , and click Settings open the Target Driver Setup dialog.

    Set the Serial Wire Trace options

  3. Select SW.
  4. Click the Trace tab.

    Configure the Serial Wire Debug mode

  5. Set Enable.
  6. Set the Trace Port to Serial Wire Output - UART/NRZ.
  7. Enable Autodetect max SWO Clk.
  8. The Core Clock must correspond to the device configuration.

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

Note

  • Use the examples delivered with the Keil board MCBTMPM360 as a reference.
  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.