Error while uploading to L475 IoT Discovery

Okay so in none of these cases was there even a connection established to the USB Device “ST Link”. It’s not failing on the “connect to chip” part since it’s not even getting there.

The STLink USB device can only be claimed by one program (if special “shared STLink” hacks aren’t used). Having another program open that is attempting to use the STLink or holding some handle to it will definitely cause OpenOCD to not find the device.

As a sanity check, you can also not flash in PlatformIO after you re-logged into your user account and VSCode with PlatformIO is the only active program?

If so, then the only explanation I know and have seen is per (SOLVED) Cannot Upload to STM32F103 "BluePill" using ST Link on Nucleo Board - #27 by maxgerhardt. If STM32CubeProgrammer could access the USB device but OpenOCD cannot, it is as driver issue. Uninstall all ST-Link drivers in the device manager (you might possibly have to uninstall software like ST-Link Utility and STM32CubeProgrammer too) until the ST-Link shows up as an unknown device in the device manager again. From there grab the latest copy of ST-Link Utility and let it install along with the drivers. Now again with all other programs closed, try uploading.

If that still does not work, use https://zadig.akeo.ie/ to load WinUSB (or libusb-win32) drivers for the ST-Link USB device and retry.

grafik