Hi is there any complete example how to make SWO running using S32 design studio? How to configure pinMUX, clocks, etc? I've tried multiple examples with J-link and PEMicro debuggers, but with no success. I've been using also retarget_itm.c library for ITM configuration (delivered by NXP).
Hi @jakub-holoubek,
I believe this is a question for SEGGER instead. There is no other example for configuring this with S32DS specifically, but you can use the following posts as guidance:
Also, SEGGER has a dedicated page in their knowledge base for their J-Link SWO Viewer: J-Link SWO Viewer - SEGGER Knowledge Base & UM08001 J-Link / J-Trace User Guide - SEGGER Knowledge Base.
Best regards,
Julián
Hi @Julián_AragónM,
thanks for reply. I've checked that tutorials. One issue I've got is that MCU goes to the hard fault once I want to write/read some TPIU registers.
For example this code:
*((volatile unsigned *)(ITM_BASE + 0x400F0)) = 0x00000002; /* "Selected PIN Protocol Register": Select which protocol to use for trace output (2: SWO NRZ, 1: SWO Manchester encoding) */
*((volatile unsigned *)(ITM_BASE + 0x40010)) = SWOPrescaler; /* "Async Clock Prescaler Register". Scale the baud rate of the asynchronous output */
Once trying to set one of those registers the MCU goes to hard fault. I've found in reference manual of ARM M7 core, that TPIU is not configured in M7 cores - can you confirm that?
Or is there any other register I have to set before writing into TPIU related registers?
Hi @jakub-holoubek,
Are you using the S32K344 evaluation board? By default, all TRACE signals are DISABLED.
Best regards,
Julián
Hi, @Julián_AragónM,
yes, I'm using S32K3-T-BOX board. Those TRACE signals are valid for ETM interface. However I need to communicate using ITM through JTAG_TDO pin - so it is routed to JTAG connector. That pin is used for SWO communication in case the SWD protocol is used instead of JTAG - which is my case.
Hi @jakub-holoubek,
I apologize for the late reply. This may be an issue with the implementation of trace and our architecture. There is an internal discussion with the SW team now. I will try to update you if anything else comes up.
As of now, you can create a new project in S32DS with prinft ITM, but the retarget_itm library does not work as expected.
Best regards,
Julián
Hi @Julián_AragónM, ok thanks.
Cortex m7 TPIU registers
In case I'm setting them from the code the MCU goes to hard fault. And same happens also in case I connect the debugger (tried J-Link, PEMicro, Lauterbach) and want to enable the SWO through debugger's settings - MCU goes into hard fault.
Hi @jakub-holoubek,
I have sent you a private message through the community.
For example in this article: Single Wire Output (SWO) support within S32 Design Studio, enabled by PEmicro's GDB Server It would be nice have more details, including sources.