cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 ITM Trace without ST-Link

benwilliam
Associate II
Posted on January 27, 2016 at 14:49

Hi@all

is it possible to get the usual ''printf'' outputs on the SWO pin without any Debugger(like ST-link) conected?

My goal is to connect a plain FTDI Uart2USB converter to the SWO pin. And just read the outputs.

If I do so and start debugging with the ST-Link I get all outputs through the FTDI, it works great.

But when I stop debug mode there are no messages at all.

(the reason why I'm not jsut using the ST-Link it self for SWO is, that the cheap ST-Links are not fast enough. I get several messages lost. Other Debugger (like UPROLINK2) are to expensive.)

#itm-swo-trace-uart
8 REPLIES 8
Posted on January 28, 2016 at 00:41

Pretty sure it's NOT a USART

Now if you did use a USART, you could get 921600 without much sweat.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
benwilliam
Associate II
Posted on January 28, 2016 at 09:19

its NRZ coded with start and stop bits

and I get the correct data out of a connected UART with 2MBaud

so its pretty close to an UART :)

the only problem is to get this outputs while there is no debugger connected.

Posted on January 28, 2016 at 11:07

> the only problem is to get this outputs while there is no debugger connected.

This may be impossible or cumbersome at least.

RM0090 rev.11 says, ''Figure 484 shows that the asynchronous TRACE output (TRACESWO) is multiplexed with TDO. This means that the asynchronous trace can only be used with SW-DP, not JTAG-DP''. The mechanism to select between JTAG-DP and SW-DP is described subsequently in chapter 38.3.1, and it is by wiggling the TMS and TCK (= SWDIO and SWCLK) pins from ''outside''.

You could try this wiggling from unused pins of FTDI; then still you need to enable the debugging in DBGMCU, CoreDebug, ITM and set the baudrate and mode in TPIU, at least. Not impossible, but needs some work to be done.

Why can't you have STLink connected, and simply snoop on the SWO pin with the FTDI/any other 3V USART Rx?

JW

benwilliam
Associate II
Posted on January 28, 2016 at 12:03

>Why can't you have STLink connected, and simply snoop on the SWO pin with the FTDI/any other 3V USART Rx?

thanks for the feedback.

Well I can and it looks like this have to be than the final solution.

Would just be great if I could send a ''Debug firmware'' and a cheap FTDI adapter to someone in the field and he can collect some debug outputs.

Now I have to add a ST-Link and explain him how to install ST-Link utility and start the SWV Viewer.

Posted on January 28, 2016 at 13:50

All seems to be an unnecessary circus, just use a standard USART from the chip, with a standard connector/header. Some buffering and DMA TX would make for low system loading, although if you can generate too much data anything is going to bog down and block. Have settings to refine the level of telemetry provided.

http://www.dlpdesign.com/usb/txrx.shtml

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
benwilliam
Associate II
Posted on January 28, 2016 at 15:29

it's a communication device where all UARTs and SPIs are used.

a simple UART was used before, but moving to a cheaper MCU were containing to have less UARTs available :)

so no alternativ.

Posted on January 28, 2016 at 16:06

> so no alternativ.

Oh, there are always alternatives... A simulated/bit-banged UART, perhaps? Any spare I2C?

JW

Posted on February 13, 2017 at 15:01

Hi

‌

Did you succeed in enabling SWO thru SWD emulation?

I am working in something similar, and now I am trying to determine the minimum SWD command sequence to enable the SWO Output..

I Followed the example configurations (31.15.4 in page 1102 and 31.17.10 in page 1111) in the Reference Manual (RM0008) but even configuring all possible registers (prescale, enable bits, etc) I still not getting SWO in the pin without connecting with STLINK (as already pointed out in this topic)

My problem now is to determine what is the minimum SWD command sequence needed to enable this output (considering that I already configured all possible registers which are configurable thru the firmware itself)

ATM Im trying to determine it with a logic analyzer and a stlink connected to the target, but debugger always sends a lot of information thru SWD as it always reconfigures the MCU registers related to the trace (prescaler, formatter, etc) wich are things that i already had previously configured thru my firmware.

Somebody already did this and could give me some light?