stlink-org/stlink

[STLINK-V3-SET]: If the device fails to enter SWD mode, the usb device is not released

TheFissk opened this issue · 2 comments

  • I made serious effort to avoid creating duplicate or nearly similar issue

  • Programmer/board type: STLINK-V3-SET
  • Operating system an version: Linux (Ubuntu 22.04 LTS + a really out of date version of Debian)
  • stlink tools version and/or git commit hash: v1.8.0
  • stlink commandline tool name: Tested against st-flash and st-info

When there is no board connected to the programmer causing it to fail to enter SWD mode subsequent invokations of the tool hang before failing.

Commandline output:
These commands are separated by several seconds, I'm not machinegunning the tool expecting it to work. The first command returns immediately, the second hangs for ~10s

$ st-flash reset
st-flash 1.8.0
Failed to enter SWD mode
Failed to connect to target
Failed to parse flash type or unrecognized flash type //This line went to stderr rather than stdout
$ st-flash reset
st-flash 1.8.0
2024-05-24T10:41:08 ERROR usb.c: GET_VERSION send request failed: LIBUSB_ERROR_TIMEOUT
2024-05-24T10:41:11 ERROR usb.c: GET_CURRENT_MODE send request failed: LIBUSB_ERROR_TIMEOUT
2024-05-24T10:41:14 ERROR usb.c: GET_COM_FREQ send request failed: LIBUSB_ERROR_TIMEOUT
2024-05-24T10:41:17 ERROR usb.c: GET_CURRENT_MODE send request failed: LIBUSB_ERROR_TIMEOUT
2024-05-24T10:41:20 ERROR usb.c: ENTER_SWD send request failed: LIBUSB_ERROR_TIMEOUT
Failed to parse flash type or unrecognized flash type
Failed to enter SWD mode
Failed to connect to target
2024-05-24T10:41:23 ERROR usb.c: DEBUG_EXIT send request failed: LIBUSB_ERROR_TIMEOUT

I also tested it against st-info --chipid and it works in much the same way, but it suppresses the stderr output, so that the program hangs for a ~10 seconds before outputting:

$ st-info --chipid
Failed to enter SWD mode
0x0000

Plugging a board into the programmer once its entered this degraded state does not resolve the issue, it will continue to output the same errors

st-info --probe works as expected returning instantly regardless of whether or not the device was able to enter SWD mode in previous invokations of st-info --probe

The V2 programmer works as expected, returning instantly even after failing to enter SWD mode.

Expected/description:

If the V3 programmer should return instantly after failing to enter SWD mode, regardless of whether or not it was able to enter SWD mode previously.

@Ant-ON: Can we be sure about that the STLINK-V3-SET is fully supported yet?
The only thing I found are the respective VID:PIDs in the udev-rules ...

@Nightwalker-87 STLINK-V3-SET has the same commands as STLINK-V3, therefore the STLINK-V3-SET should be supported too