RT1021 SWO Trace problems

Showing results for 
Show  only  | Search instead for 
Did you mean: 

RT1021 SWO Trace problems

Jump to solution
Contributor V


I am trying to get SWO Trace working in MCUXpresso, but without success.

Whatever I try, the 'Change' button in the SWO Configuration section of the Configuration tab remains greyed out (as do the other settings).

I am able to debug ok with MCUXpresso. I.e. I can download software to the target board and run it, and break/start/stop/step etc as you would expect.

Our target board uses an RT1021 and has the following connections:

  • SWDIO: Pin 111, GPIO_AD_B0_00, routed as JTAG_TMS, connected to pin 2 of the 10-pin jtag connector.
  • SWCLK: Pin 110, GPIO_AD_B0_01, routed as JTAG_TCK, connected to pin 4 of the 10-pin jtag connector.
  • SWO: Pin 97, GPIO_AD_B0_11, routed as ARM_TRACE_SWO, connected to pin 6 of the 10-pin jtag connector.
  • (FYI: The remaining jtag pins are as follows: 1 = +3V3; 3,5,9 = GND; 7,8 = n/c)

I am using the NXP LPCXpresso LPC-Link 2 (Rev B) connected via the 10-pin J7 connector to our target board.

Here is a list of some of the documents and web pages that I have gleaned information from:

At least one person has got this working on a target board using the RT1021, although they do not use the LPC-Link2:

This is what I have done so far:

  • Copied retarget_itm.c into my source tree.
  • Changed the library to 'NewLibNano (no host)' so that it links (setting was 'NewLibNano (semihost)').
    See project properties | C/C++ Build | Settings | Tool Settings tab | MCU C++ Linker | Managed Linker Script | Library field.)
  • Modify the SDK manifest:
    • Archive: C:\Users\Ronnie Shipman\mcuxpresso\02\SDKPackages\SDK_2_10_0_EVK-MIMXRT1020.zip
    • File: EVK-MIMXRT1020_manifest_v3_8.xml
    • Line: <params id="internal.has_swo.release.MIMXRT1021xxxxx" name="internal.has_swo" value="true"/>
  • After the call to BOARD_BootClockRUN() I have added the line:
    •     CLOCK_EnableClock(kCLOCK_Trace);
    • FYI: In BOARD_BootClockRUN are the lines:
    •     /* Disable TRACE clock gate. */
    •     CLOCK_DisableClock(kCLOCK_Trace);
    •     /* Set TRACE_PODF. */
    •     CLOCK_SetDiv(kCLOCK_TraceDiv, 2);
    •     /* Set Trace clock source. */
    •     CLOCK_SetMux(kCLOCK_TraceMux, 2);
    • This should give us a 132 MHz clock although I'm not sure how to measure that is actually being generated.
  • I have confirmed the connectivity between RT1021 pin 97 and pin 6 of the jtag connector.

So my questions:

  1. What have I missed - is the above all I need to do to get SWO Trace to work?
  2. Are the 3 SWD signals all that I need to get SWO Trace to work in MCUXpresso?
  3. Or do we need 2-wire or 4-wire SWD? I believe the RT1021 only supports 1-wire.
  4. Do we actually need SWO for the profiler and interrupt history?
  5. Will this work with the LPC-Link2? In the document (MCUXpresso IDE SWO Trace Guide, Rev. 11.4.1) is this note: "Note: SWO cannot be used with other CMSIS-DAP based probes or with LPC-Link2 debug probes using the non default Non Bridged (NB) or Serial (ser) firmware. Non LinkServer probes may also provide SWO trace capabilities via other software – check the vendors' websites for more details." What does this mean?

Many thanks and regards,



Labels (1)
Tags (4)
0 Kudos
1 Solution
Contributor V
0 Kudos
2 Replies
Contributor V
0 Kudos
Contributor V

Did anyone at NXP have a chance to look at this please?

0 Kudos