SWO Data Trace functionallity (on MCXA156)

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

SWO Data Trace functionallity (on MCXA156)

2,623 Views
AlexRu
Contributor II

Hello NXP Community,

I have been experimenting with the Debug functionalities of the MCXA156 Controller and its respective development board.

My setup:

(FRDM-MCXA156) as well as MCXA156 in a custom board.

MCUXpresso IDE v25.6 [Build 136] [2025-06-27]

MCU Link pro Debugger

So far with various examples from the NXP Expresso SDK I was able to cover most of debugging needs. (Breakpoints, Datawatch points, ITM printf redirect, Interrupt tracing etc.)

Somehow I am stuck with usage of Data Watch Trace/Stream over SWO. I am at a point where I think I have misunderstood the capabilities of the MXCA156 debugging feature.

To my understanding the MCXA156 supports ITM and DWT.

With this it should be possible to add read/write data comperators and stream/trace out the appropriate data over the SWO pin. With my setup it seems I cant get to work the "SWO Data" window to work even if all other tracing feature seems to work fine.

I am on the right track with my setup or does the MCUXpresso IDE simply not supporting my use-case yet?

Best regards

Alex

Tags (3)
0 Kudos
Reply
7 Replies

2,479 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @AlexRu 

To use SWO, you can follow the provided step guide.

Hardware Requirements:
Ensure that the chip’s SWO pin is connected to the debugger’s SWO interface.

(This is FRDM-MCXN947 board)

Alice_Yang_0-1764234995466.png

 

Software Configuration:

  1. When creating a new project, select “Redirect printf/scanf to ITM” to redirect printf/scanf output to ITM.

     

 

Alice_Yang_1-1764235038209.png

2. Configure the Trace Clock:

Alice_Yang_2-1764235054451.png

 

CLOCK_AttachClk(kTRACE_DIV_to_TRACE); /*! Switch TRACE to TRACE_DIV */

/*! Set up dividers */

CLOCK_SetClkDiv(kCLOCK_DivTraceClk, 3U); /*! Set TRACECLKDIV divider to value 3 */

 

3. Configure ITM Console View in MCUXpresso IDE:

    • Open SWO ITM Console.
    • Configure the corresponding Core Clock and Trace Clock in both the IDE settings and your code    .Alice_Yang_4-1764235140283.pngAlice_Yang_5-1764235162015.png

       

    • Alice_Yang_6-1764235196129.pngAlice_Yang_7-1764235214710.pngAlice_Yang_8-1764235219324.png

       

      4. View the Output Results.

Alice_Yang_9-1764235228270.png

 

For details on SWO and DWT usage, please refer to MCUXpresso_IDE_25.06_Instruction_Trace_Guide.pdf. You can find this guide under MCUXpresso IDE install path. 

BR

Alice

 

0 Kudos
Reply

2,439 Views
AlexRu
Contributor II

Hi Alice,

thank you very much for your detailed visualisations on how to setup the SWO Tracing.

In my case I already verified the electrical connection of the SWO pin (MXCA-156 PCB) to my MCU-Link Pro Debug Probe. The PDF you mentioned has indeed more detailed information and extends my knowledge. Nevertheless it does not really explain/disprove my assumutions of DWT usage.

In my setup I already see data from Interrupt returns and Interrupt entry points in the "SWO Interrupts" windows: (this is live data from my SW! Meaningfull data and correct timing information.)

AlexRu_0-1764332623019.png

With this information I verfied that my electrical connection via SWO pin is working, trace clocks are enabled and frequency is as expected in my SWO Trace Config.

What I am missing (or maybe there is a misunderstanding on my side?) is the function to trace Data via a Data Watch comparator (DWT) to the SWO trace pin in window "SWO Data".

After enabeling the "play" button I dont receive any trace information: 

AlexRu_1-1764333027216.png

I even veriefied that with my config of MXCA156 the data watchpoints are limited to 2 comparators, so the IDE seems to be able to set them and warns about too many Data Watch points set (I did it intentionally to check the plausibility):

AlexRu_2-1764333135738.png

So my question is: Does the IDE support this method of debugging or is there a misunderstanding on my side and the DWT does not provide this kind of Data tracing capabilities at all?

0 Kudos
Reply

2,394 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @AlexRu 

Thanks for your reply.

Could you please let me know which data you want to use DWT to watch?
Also, please share a project that can reproduce the issue and provide a video showing all the steps you took.
I will use this information to reproduce and check the issue on my side.

 

Thank you!

 

BR

Alice

0 Kudos
Reply

2,348 Views
AlexRu
Contributor II

Hello @Alice_Yang ,

I did prepare a minimalistic Project based on the SDK Example (LED Blinky) for the FRDM-MCXN236 Demonstration Board. (demo_apps -> LED_BLINKY_PERIPHERAL)

The MCXN236 Board setup seems to show the same effect as the MCXA156 Board I used before. I just wanted to confirm this behaviour on another Board.

Pin config set P0_2 -> Output SWO (Default in this example)

Enabled the TRACECLK and TRACECLKDIV (1) as this example uses BOARD_BootClockFRO12M()

Added following code to see some action on glocal ram variables:

volatile uint32_t debug_cnt = 0;
void SysTick_Handler(void)
{
    /* Toggle pin connected to LED */
    GPIO_PortToggle(BOARD_LED_GPIO, 1u << BOARD_LED_GPIO_PIN);
    debug_cnt++; //<- added for demonstration purpose
}

 Attachments: Zip with demo project, video of my debug session.

You can see that "SWO Data" does not show any tracing data. Global variables window shows the increment of debug_cnt in SysTick_Handler cycle of ~1s. Also "SWO Interrupts" shows the entry and exit of SysTick_Handler() reliably so the electrical connection of SWO trace seems to work correctly.

Let me know if I can provide more info to narrow down this issue.

I would also be happy if you could confirm whether my expectation of tracing a global/static RAM variable with DWT is possible. Or I have a misunderstanding.

0 Kudos
Reply

2,101 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @AlexRu 

I tested on my side. This cannot output the variable’s value in real time. It can only check the variable’s value when debugging is paused.
Alice_Yang_0-1765449677747.png

 

BR

Alice

 

 

0 Kudos
Reply

2,092 Views
AlexRu
Contributor II
Hi Alice, thank you for your effort. So it seems that MCUXpresso does not support the "data trace" debugging currently. Is it possible to request this for future releases?

From my outsider perspective it seems that there is not much missing to make it work. SWO Interrupt seems to work just finde and extends to advanced debugging functionalities.
SWO Data tracing whould further extend the possibilities for Debugging in NXPs Xpresso Toolchain.
Best regards
Alex
0 Kudos
Reply

2,073 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @AlexRu 

Thank you for your reply. I will forward this request to the MCUXpresso development team and keep you updated on any progress. Thank you.
 

BR

Alice