2019-08-26 09:51 AM
I have a NUCLEO-F401RE, which has a virtual serial port associated with the built-in ST-LINK/V2-1.
This is very convenient and handy, but I'm having issues with it.
The first time I tried using this feature, it worked fine. The serial port associated with the ST-LINK on the board enumerated as COM28 on my PC and I was able to open it in TeraTerm and see serial output from my board.
I found, however, that if I power cycle the Nucleo board, I can no longer connect to the serial port with TeraTerm. The serial port still enumerates as COM28 on the PC, and TeraTerm see it in the list of available serial ports, but when I select it in TeraTerm, it says the port is unavailable. COM28 also shows up in Device Manager, and Device Manager says "This device is working properly." I tried several pther PC serial port programs, but none of them could open COM28.
The only way to get it to work again is to reboot the PC. This is a real nuisance because I'm frequently power-cycling the Nucleo to load new firmware or hook up scope probes, etc.
Is there a way to fix this so I don't have to reboot the PC every time I want to reconnect to the virtual serial port ST-LINK creates on my Nucleo board?
2019-08-26 10:06 AM
One of the primary issues here is Windows, it doesn't do PnP nicely with serial ports, and apps holding handles in open instances will be a problem. At a kernel level this will require you to restart windows to recover the resources/handles held.
Best to close terminal apps, or disconnect COM port, before cycling power or removing/inserting COM port.
If you're doing this a lot, consider some FTDI or SiLabs USB-to-Serial, or RS232 ports, to connect up to STM32 boards. This way you fiddling with external resources won't break windows.
2019-08-26 10:16 AM
Thanks for the reply, but I think this is related to how ST implements virtual com ports in ST-LINK/V2-1. I say this because I have two other development boards (non-ST) and both of these have a similar virtual com port capability through the built-in J-LINK debugger on these boards, and neither of these boards require me to reboot the PC if I power cycle the dev board--the virtual com port reappears as soon as I re-power the board and I'm able to connect to it with TeraTerm with no problems.
2019-08-26 10:46 AM
I guess you don't need to reboot the PC, maybe there is an improve STLinkSW update with better behaviour for USB and it's composite device.
Otherwise, when using STLink Com port or HC-06 SPP port (wireless), it's important to close the terminal to free the corresponding com port.
In BT case, just delete the device, then reinstall the drivers. This is probably as good as reboot, just faster?