RT1021 SWO Trace problems

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

RT1021 SWO Trace problems

Jump to solution
944 Views
rshipman
Contributor V

Hi,

(I'm reposting this, as I think something went wrong with the last one.)

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:

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,

Ronnie

 

Labels (1)
Tags (4)
0 Kudos
1 Solution
906 Views
rshipman
Contributor V

Hi Kerry,

Thank you for your reply.

I have discovered what the problem was. When I change the has_swo setting to true in the SDK manifest file, I also need to do the same in any .launch file that I am using. Actually I simply delete the .launch files and let MCUXpresso recreate them (it pulls in the correct has_swo setting). I couldn't find a setting in MCUXpresso that let me set this via the GUI.

So in case anyone needs it, here are the things I needed to do to get SWO Trace working on the RT1021 using a LPC-Link 2 and MCUXpresso:

  • Modify the SDK manifest:
    • Edit the SDK archive. E.g.: C:\Users\Ronnie Shipman\mcuxpresso\02\SDKPackages\SDK_2_10_0_EVK-MIMXRT1020.zip
    • Edit the manifest file. E.g.: EVK-MIMXRT1020_manifest_v3_8.xml
    • Edit the line (search for has_swo): <params id="internal.has_swo.release.MIMXRT1021xxxxx" name="internal.has_swo" value="true"/>
    • Modify/recreate the .launch files relating to this hardware as mentioned above.
  • 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);
    •  
    • The SWO Config in MCUXpresso will ask for the trace clock speed.

 

No need to worry about copying retarget_itm.c or anything else.

FYI: Remember that the RT1021 routes JTAG_TDO and SWO to different pins in case that has a bearing on the target hardware.

Hope that helps.

Ronnie

View solution in original post

2 Replies
937 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @rshipman ,

   Thank you for your interest in the NXP MIMXRT product, I would like to provide service for you.

    When you use the LPC-Link 2  test with RT1020, which SDK code you are using? please use the helloworld test it, don't use the led_blinky, as the led_blinky will use the pin which is connected to the LPC-LINK2, then it will influence the debug.

   If you have external Segger JLINK, I think you also can try the directly JLINK.

    Answer your questions:

1 What have I missed - is the above all I need to do to get SWO Trace to work?

Answer:  Normally, these steps to enable the SWO.

  1) check pinmux.c , enable the SWO pin.

   In fact, newest SDK code already add it:

void BOARD_InitPins(void) {
CLOCK_EnableClock(kCLOCK_Iomuxc);

IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_06_LPUART1_TX, 0U);
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_07_LPUART1_RX, 0U);
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_11_ARM_CM7_TRACE_SWO, 0U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_06_LPUART1_TX, 0x10B0U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_07_LPUART1_RX, 0x10B0U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_11_ARM_CM7_TRACE_SWO, 0x10B1U);
}

2) trace clock enable, I find the clock_confg.c also enable it.

3) main

  Add the ITM_SendChar('A');

After entering the debugger, open the SWO configuration, whether you can see the swo target speed?

  If you can see the speed, it means it works. Otherwise it still have issues.

   Just use the LPC-LINK2 test the helloworld, not the led_blinky.

2 Are the 3 SWD signals all that I need to get SWO Trace to work in MCUXpresso?

Answer: SWD_CLK, SWD_DAT, RESET, SWD_SWO, GND, VDD, these pins is enough.

3 Or do we need 2-wire or 4-wire SWD? I believe the RT1021 only supports 1-wire.

Answer: check point 2.

4 Do we actually need SWO for the profiler and interrupt history?

Answer: check point 1.

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?

Answer: As I know, LPC-LINK2 firmware with JLINK or CMSIS DAP shoud works. which firmware you are using now? Do you try the MIMXRT1020-EVK, whether that works or not?

If yu still have issues, just kindly let me know.

About the issues, you can give me some screenshot.

Best Regards,

Kerry

  

0 Kudos
907 Views
rshipman
Contributor V

Hi Kerry,

Thank you for your reply.

I have discovered what the problem was. When I change the has_swo setting to true in the SDK manifest file, I also need to do the same in any .launch file that I am using. Actually I simply delete the .launch files and let MCUXpresso recreate them (it pulls in the correct has_swo setting). I couldn't find a setting in MCUXpresso that let me set this via the GUI.

So in case anyone needs it, here are the things I needed to do to get SWO Trace working on the RT1021 using a LPC-Link 2 and MCUXpresso:

  • Modify the SDK manifest:
    • Edit the SDK archive. E.g.: C:\Users\Ronnie Shipman\mcuxpresso\02\SDKPackages\SDK_2_10_0_EVK-MIMXRT1020.zip
    • Edit the manifest file. E.g.: EVK-MIMXRT1020_manifest_v3_8.xml
    • Edit the line (search for has_swo): <params id="internal.has_swo.release.MIMXRT1021xxxxx" name="internal.has_swo" value="true"/>
    • Modify/recreate the .launch files relating to this hardware as mentioned above.
  • 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);
    •  
    • The SWO Config in MCUXpresso will ask for the trace clock speed.

 

No need to worry about copying retarget_itm.c or anything else.

FYI: Remember that the RT1021 routes JTAG_TDO and SWO to different pins in case that has a bearing on the target hardware.

Hope that helps.

Ronnie