cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to route ITM traffic to VCP on ST Link? At the moment i can only get serial data showing in the uVision Debug printf window. Nothing comes out on its COM port. Thanks

RStep.6
Associate II
 
7 REPLIES 7
TDK
Guru

ITM and VCP are separate paths. If you want data out of the VCP COM port, you'll need to use the appropriate UART channel rather than using ITM.

https://community.st.com/s/article/how-to-redirect-the-printf-function-to-a-uart-for-debug-messages

If you feel a post has answered your question, please click "Accept as Solution".

Not how it works.

Technically they probably could create a VCP that way, but they don't.

Need to use a physical one on the ST-LINK/V2-1 devices

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Nikita91
Lead II

I cannot get the point of that additional FTDI C232HM hardware. I'm just using SWO which is present on ST-LINK on a Nucleo board and connected to both - the on-board slave MCU and a header for external boards. And, by initializing the SWO output only on a single one of those simultaneously, I can switch from one to another without hardware modification. Debug, SWO and VCP - it all works simultaneously with just a single USB cable and a bare Nucleo board at the end of it.

Interesting.

How do you get and display the data from the SWO through the STLINK usb?

Sorry, forgot to mention that the board is NUCLEO-F767ZI, but I'm using J-Link GDB Server and J-Link SWO Viewer and onboard ST-LINK is re-flashed as a J-Link:

https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/

Just in case you want to try - it's an easily reversible action. The main reason for me is J-Link has a workaround implemented for the Cortex-M7 core bug, which makes single step debugging next to impossible. On firmware side I'm doing just this without any other code related to debug hardware:

static int SWO_Output_(int ch, lwprintf_t* lwp)
{
	if (ch != '\0') {
		ITM_SendChar(ch);
	}
	return ch;
}

Some time ago I remember ST-LINK Utility being capable of showing SWO data. CubeIDE should also be capable of doing it, isn't it?

Thank you. I was not aware of the M7 core bug.

Yes CubeIDE can display SWO data, but only at slow baud rate.

I use SWO at high speed (8-12 Mbits/s) to get data traces for some tricky algorithms (~20-40 char every ms). without timing disturbance.

And the processing software receives this data directly