cancel
Showing results for 
Search instead for 
Did you mean: 

UART signal on SWO pin from ST-Link V2/3

KisGlm
Associate II

Hi

For a project, we have switched from a M3 to a M0 microcontroller, which lacks the SWO that we used in production. We now want to connect the SWO pin of the debug connector to UART TX and use an external adapter to read it out. My question is, what would happen if we connected the debugger (ST-Link V2/3) without the adapter and the SWO trace received a (3.3 V) UART signal? Would there be a problem with the debugger?

Best regards, Mathieu

6 REPLIES 6
SofLit
ST Employee

Hello @KisGlm and welcome to the community,

If you mean you need to use STLINK VCP (virtual comport) without the need of SWD connection that will be connected to your UART. Yes you can.

Don't forget the common GND.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Hi

Thanks for the quick response. That's not quite what I mean, I want to misuse the SWO Pin from our debug Connector (TC-2030) to bring a UART TX signal from the STM32G0 Microcontroller to a custom adapter board, where we can divert the signal to a UART to USB device. But I want to know what happens when we don't have that adapter and connect the ST-Link regularly to the debug connector, which means that the ST-Link receives a UART TX signal on the SWO trace. Before I do that. I want to know if that is a problem for the ST-Link.

Best regards, Mathieu 

Isn't SWO already implemented as an OUTPUT?

But generally yes you shouldn't drive on output into another output.

I don't think the debugger is going to care in this case, but isn't going to recognize your output.

You can delay initialization to allow time from NRST for the debugger to connect. 

Several of the STM32 CM0(+) devices have UART output on the SWDIO/SWCLK pair in the event you aren't using a debugger.

On the CM0(+) I suspect one would use the event recorder or memory based communication channel. 

 

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

The ARM standard supports UART signalling on SWO:

https://community.st.com/t5/stm32-mcus-products/switch-jtag-to-swd-port-on-stm32l4/m-p/739687/highlight/true#M265469

https://developer.arm.com/documentation/ddi0314/h/Serial-Wire-Output/SWO-trace-port/Physical-pin-protocol

 

So, in theory, the ST-Link should at least not object to it ...

 

(credit to @DUrbano - I didn't realise this before that post!)

KisGlm
Associate II

Thanks for the replies

@Tesla DeLorean: shouldn't the SWO be an output from the MCU side? The UART TX would also come from the MCU. Also we still want to be able to debug the MCU at the same time, so switching the SWD lines after booting is not really an option for us. The event recorder seems to be for Keil MDK, but we're not working with Keil. Can you elaborate what you mean with "memory based communication channel"?

@Andrew Neil: thanks for those links, I wasn't aware that the SWO is basically a UART port. Than it's a bit of a bummer, that the STM32 Cube Programmer can not be used as a common serial viewer, then we wouldn't have to change that much. As I see it, it should at least not harm anything if it was a UART port anyway.


@KisGlm wrote:

 the SWO is (sic) basically a UART port. .


"can be" rather than "is" - I don't know whether ST-Link can or does use that mode.