2024-11-14 12:09 AM
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
2024-11-14 12:26 AM
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.
2024-11-14 12:38 AM
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
2024-11-14 01:23 AM
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.
2024-11-14 01:26 AM
The ARM standard supports UART signalling on SWO:
So, in theory, the ST-Link should at least not object to it ...
(credit to @DUrbano - I didn't realise this before that post!)
2024-11-14 02:02 AM
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.