openocd **Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED**

Raph9023 picture Raph9023 · Dec 9, 2016 · Viewed 18.5k times · Source

I am trying to setup a eclipse development environment to work with stm32f303 nucleo 32 board. http://www.st.com/en/evaluation-tools/nucleo-f303k8.html

So far, the all the tools seems to be correctly installed and working: I have succefully compiled and started openocd debugger for stm32f4 discovery and when I connect stm32f303 nucleo 32 board and start openocd, the led on the board indicates that it is connected. (I have flashed the board.)

The thing is openocd get lost when I do step by step debugging and this seems related to the message openocd gives me when started (look for bold line):

Open On-Chip Debugger 0.9.0 (2015-05-19-12:09)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
**Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED**
Info : STLINK v2 JTAG v27 API v2 SWIM v15 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.239293
Info : stm32f3x.cpu: hardware has 6 breakpoints, 4 watchpoints

Does someone know how to fix usb driver in that case, or it is possible that something else cause the problem?

Answer

kalmiya picture kalmiya · Feb 18, 2018

In case you experience this issue on Linux, you have to configure udev rules to work with the device. Find the 99-openocd.rules included with the source distribution of openOCD under Contributions. Connect your ST-Link USB-device and run 'lsusb' from a terminal, it will list something like this:

Bus 004 Device 009: ID 0483:3748 STMicroelectronics ST-LINK/V2

Notice the value behind ID, you want to check the 99-openocd.rules to see if there is a matching entry supporting the device, in the above case it's this one:

# STLink v2
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", MODE="664", GROUP="plugdev"

Copy this file to your /etc/udev/rules.d configuration directory and reboot your machine. Then try debugging again.