How to get "serial monitor" with ST-LINK V2 (no COM port)?

Hi,

I made a custom board based on “disco_l072cz_lrwan1” dev kit. Basically I removed ST-LINK circuitry, extra connectors etc and added SHT31 sensors to I2C-bus.

The board is alive. I was able to flash it with external ST-LINK V2.

But how do I get serial monitor to work? ST-LINK shows up as “Universal Serial Bus -device”. It doesn’t show up as COM-port.
image

When I click “PlatformIO: Serial Monitor” I get this:


That COM3 is not ST-LINK, it’s something else.

Thanks,
Tino

Correct. None of the external ST-Link (V2) devices I have show up as COM port, and can show up as COM port. Only those ST-Links integrated into devboards can. This is an ST-Link limitation, not a PlatformIO limitation.

You can double check that by downloading and executing the firmware upgrade utility STSW-LINK007 - ST-LINK, ST-LINK/V2, ST-LINK/V2-1, STLINK-V3 boards firmware upgrade - STMicroelectronics, which for built-in ST-Link gives you the option to set the drivers to STLink + VCP (virtual COM port). This option should not be available for external ST-Links.

For reference, my external ST-Link shows up in the upgrader program as

whereas the internal one on a Nucleo board shows up as

So, a lot more options although both are “ST-Link V2”.

Unofficially, there are upgrade ways

Well…this is a “small” surprise. It never came in my mind that external ST-LINK would have less features than integrated ST-LINK. Serial monitor over integrated ST-LINK was handy.

Going forward… If I connect FTDI cable (USB to TTL RS232) to PA11/TX1 and PA10/RX1 pins in STM32L0 (in CMWX1ZZABZ module), should that work for serial monitor?

Do I have to do some “tricks” / settings in PlatformIO (or in code itself) to get that to work?

Thanks,
Tipo

Yes that should suffice, given that the board itself is powered by a USB port on the computer, otherwise connect GND between the boards too.

PlatformIO will auto-detect the serial port. You can also set the baud rate and device explicitly using the monitor options in the platformio.ini.

Also, the ST-Links on existing Nucleo boards can be connected to external boards and disconnected from the internal MCU through 3 jumpers (1 power, 2 SWD). The user manual page 19 mentions that. The ST-Link part of a Nucleo board is also designed to be snapped-off. I’ve done that to one of the dev boards I don’t need anymore (and even then, the MCU part is still usable) so that I have a smaller and better ST-Link with COM port. But, you don’t need to snap that PCB off, you can also use it in-place. Then programmer and serial adapter is in-one.

This was a great idea and it works. On my “disco-board” B-L072Z-LRWAN1 I just needed two jumpers on CN8 removed and I could use SWD pins on CN12.

Additionally, to get logs via serial, I had to add to wires (serial rx and tx) from CMWX1ZZABZ module (pins #23 and #24) to JP6 in B-L072Z-LRWAN1. With that addition I get serial via ST-LINK to virtual COM in PC.