I am not familiar with this advanced tool.
After commenting ASYNCIO define, st-link works without any problem. That was
good idea.
I continued previous investigation. I've found more accurate function which is
a source of this issue. In stlink_usb.c file there is a function:
~~~
static void sync_transfer_wait_for_completion(struct libusb_transfer *transfer)
{
int r, *completed = transfer->user_data;
/* Assuming a single libusb context exists. There no existing
interface into this
* module to pass a libusb context.
*/
struct libusb_context *ctx = NULL;
while (!*completed) {
r = libusb_handle_events_completed(ctx, completed);
if (r < 0) {
if (r == LIBUSB_ERROR_INTERRUPTED)
continue;
libusb_cancel_transfer(transfer);
continue;
}
}
}
~~~
Function libusb_handle_events_completed() (located in libusb library file
io.c) used above at first calling doesn't return and after about 2 seconds
opendocd is exited without any warning.
Xiaofan Chen mentioned about this commit:
[https://github.com/libusb/libusb/commit/32a22069428cda9d63aa666e92fb8882a83d4515](https://)
Bingo!
This commit causes issue with st-link.
Earlier commit works fine :)
---
** [tickets:#308] ST-link connect issue using latest libusb-1.0.dll**
**Status:** new
**Milestone:** 0.11.0
**Created:** Fri Jun 11, 2021 10:12 AM UTC by asier70
**Last Updated:** Wed Jun 23, 2021 12:05 PM UTC
**Owner:** nobody
For years I compile openocd and libusb-1.0 by myself from the newest sources
(cross-compilation under ubuntu on Windows 10 for windows 10 x64). I noticed
problem with the newest libusb-1.0.dll - I can't connect to st-link (ver. 2.1
and also 3). Log ends with:
~~~
Debug: 46 239 stlink_usb.c:3420 stlink_open(): stlink_open
Debug: 47 243 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x3744 serial:
Debug: 48 248 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x3748 serial:
Debug: 49 255 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x374b serial:
Debug: 50 261 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x374d serial:
Debug: 51 269 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x374e serial:
Debug: 52 275 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x374f serial:
Debug: 53 280 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x3752 serial:
Debug: 54 289 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x3753 serial:
~~~
and openocd is exited without any information like "open failed". Connecting to
DAP-Link v2 with bulk works. This issue is for latest libusb-1.0.dll version
1.0.24.11627 (and 1.0.24.11623 as I checked).
For older version 1.0.24.11608 all works fine:
~~~
Debug: 46 217 stlink_usb.c:3420 stlink_open(): stlink_open
Debug: 47 221 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x3744 serial:
Debug: 48 226 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x3748 serial:
Debug: 49 234 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x374b serial:
Debug: 50 240 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x374d serial:
Debug: 51 246 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x374e serial:
Debug: 52 254 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x374f serial:
Debug: 53 260 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x3752 serial:
Debug: 54 269 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid:
0x3753 serial:
Info : 55 1722 stlink_usb.c:1318 stlink_usb_version(): STLINK V2J37M27 (API v2)
VID:PID 0483:3752
Debug: 56 1729 stlink_usb.c:1543 stlink_usb_exit_mode(): MODE: 0x01
~~~
Any suggestions?
---
Sent from sourceforge.net because [email protected] is
subscribed to https://sourceforge.net/p/openocd/tickets/
To unsubscribe from further messages, a project admin can change settings at
https://sourceforge.net/p/openocd/admin/tickets/options. Or, if this is a
mailing list, you can unsubscribe from the mailing list.