Enable SWO Debug on LPC55xx Custom Board and LPC-Link2

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

Enable SWO Debug on LPC55xx Custom Board and LPC-Link2

Jump to solution
2,712 Views
danielholala
Senior Contributor II

Hi there,

I have a custom board with LPC5526. It has an SWD connector with SWO connected to PIO0_8. So far I had no issues with debugging my program using MCUXpresso IDE 11.4.1. I can stop the program, set breakpoints and everything else in the debugger works like a charm.

Now I wanted to use the SWO Debug views that MCUXpresso provides (e.g., SWO ITM Console). Using Pins Tool, I configured PIO0_8 for SWO. In SWO Trace Config I set the clock speed to system clock speed (which is 100 MHz).

However, as soon as I click "Resume data display" (white triangle on green ball) in, e.g., SWO ITM Console I get the error message:

Failed to initialize SWO trace.
Reason: Failed to configure the probe for SWO. Unable to program the SWO coresight component.

I wonder why this is?

Do I have to explicitly enable the Trace clock first?

danielholala_0-1641403212154.png

I'M asking as neither the User Manual UM11126 (chapter 51) nor the "MCUXpresso IDE SWO Trace Guide" (included with MCUXpresso installation)  suggest to enable TRACECLKSEL before using SWO. 

Thanks.

 

Labels (2)
Tags (2)
0 Kudos
Reply
1 Solution
2,639 Views
danielholala
Senior Contributor II

Summary:

a) Trace Clock has to be enabled. Set TRACECLKDIV = 0 (Divider = 1) and withTRACECLKSEL select divider output.

b) SWO and MCUXpresso IDE 11.4 is buggy. Tried with clean installation and issues persist. See here

c) Good introduction to SWO Trace can be found here.

View solution in original post

0 Kudos
Reply
8 Replies
2,640 Views
danielholala
Senior Contributor II

Summary:

a) Trace Clock has to be enabled. Set TRACECLKDIV = 0 (Divider = 1) and withTRACECLKSEL select divider output.

b) SWO and MCUXpresso IDE 11.4 is buggy. Tried with clean installation and issues persist. See here

c) Good introduction to SWO Trace can be found here.

0 Kudos
Reply
2,672 Views
danielholala
Senior Contributor II

I figured that my custom board is having no SWO issues. It's running perfectly as is the LPCXpresso55S28 board. However, SWO only works in the first debug session after starting MCUXpresso IDE. As soon as I stop debugging and start to debug my project again, the error message window appears. So I assume that this is a bug in MCUXpresso IDE.

0 Kudos
Reply
2,653 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello danielholala,

OK, thanks for your sharing, about your IDE case, there will be other help you.

 

BR

Alice

0 Kudos
Reply
2,681 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello danielholala,

How about directly use the demo "hello_world_swo" under SDK/

 

BR

Alice

0 Kudos
Reply
2,677 Views
danielholala
Senior Contributor II

Hi Alice,

followed your advice:

I imported this example from the SDK for the LPCXpresso55S28 evaluation board. This board includes a LPC-Link2 debug probe if I'm not mistaken.

After compiling and starting a "Debug session", debugger stops it in main() (default breakpoint) as usual and I continue execution.

While the target ist running, I go to SWO Trace Config and set clock speed. A clock speed of 12 MHz is detected. See screenshot:

danielholala_0-1641554252613.png

 

SWO Status is incomplete:

danielholala_1-1641554277614.png

Starting SWO "Resume data display" results in the same error message window as reported earlier:

Data communication error
Error encountered during data processing.

Please advise. Thanks.

 

0 Kudos
Reply
2,684 Views
danielholala
Senior Contributor II

Hello again,

I now configured Trace Clock to 100 MHz using Clocks Tool (TRACECLKDIV = 0, i.e., Trace Clock == System Clock). LPC-Link2 debug probe is connected to target via 100 mm ribbon cable.

Further, after starting a debugging session on the target (using MCUXpresso IDE) I let it run past the clock configuration code to make sure all clocks are configured properly.

Then in "SWO Trace Config" I click on "Change" button and click on "Detect". A clock speed of 100 MHz is detected. I accept this value.

This is what "SWO Trace Config" looks like thereafter:

danielholala_0-1641542464456.png

and

danielholala_1-1641542483378.png

Everything seems ready to start an SWO trace.

However, clicking on "Resume data display" in any of the SWO views results in this error message window:

Data communication error
Error encountered during data processing.

see screenshot:

danielholala_2-1641542580879.png

 

I got the SWO trace running only twice on this board and I have difficulties getting it to work again.

 

Tags (3)
0 Kudos
Reply
2,705 Views
Alice_Yang
NXP TechSupport
NXP TechSupport
0 Kudos
Reply
2,703 Views
danielholala
Senior Contributor II

Hi Alice,

the thread includes one additional step "Step3. Enable SWO Trace clock" which is not explicitly mentioned in the device manual UM11126. 

I might sound tedious but this should be explicitly mentioned in the device manual. 

Now to configure trace clock, I need to know what the maximum speed of the SWO is. Manual states that I should set TRACECLKDIV to 0 (i.e., divide by 1). Connected to system clock this would mean a trace clock for SWO fo 100 MHz in my system. I wonder whether this is too high.

  • What is the (maximum) recommended value for Trace Clock?
  • What do I have to configure as Clock Speed in SWO Trace Config view: System Clock or Trace Clock? Note: pressing "Detect" fills in the value of System Clock, i.e., 100 MHz.
  • What are requirements regarding cabling (ribbon cable between board and LPC-Link2)?

Thanks.

0 Kudos
Reply