stlink_usb_open(): claim interface failed

I am attempting to use openocd (0.7.0-dev-00095-g27ad96e

(2012-12-07-17:13) under Linux) + ST-Link V1 + olimex STM32-H103 and

run into problems with the usb-interface.

When starting openocd I get an:

stlink_usb_open(): claim interface failed

Has someone a clue what I’m doing wrong?

plugged ST-Link:

Debug: 176 7 stlink_layout.c:43 stlink_layout_open(): stlink_layout_open

Debug: 177 7 stlink_usb.c:1152 stlink_usb_open(): stlink_usb_open

Debug: 178 7 stlink_usb.c:1167 stlink_usb_open(): transport: 1 vid: 0x0483 pid: 0x3744

Debug: 179 143 stlink_usb.c:1177 stlink_usb_open(): claim interface failed

Debug: 180 143 stlink_layout.c:50 stlink_layout_open(): failed

Debug: 181 143 command.c:631 run_command(): Command failed with error code -4

User : 182 143 command.c:669 command_run_line(): in procedure ‘transport’

Debug: 183 143 command.c:631 run_command(): Command failed with error code -4

User : 184 143 command.c:669 command_run_line(): in procedure ‘init’

Debug: 185 143 stlink_interface.c:99 stlink_interface_quit(): stlink_interface_quit

Compare to detached ST-Link:

Debug: 176 6 stlink_layout.c:43 stlink_layout_open(): stlink_layout_open

Debug: 177 6 stlink_usb.c:1152 stlink_usb_open(): stlink_usb_open

Debug: 178 6 stlink_usb.c:1167 stlink_usb_open(): transport: 1 vid: 0x0483 pid: 0x3744

Error: 179 140 stlink_usb.c:1170 stlink_usb_open(): open failed

Debug: 180 140 stlink_layout.c:50 stlink_layout_open(): failed

Debug: 181 140 command.c:631 run_command(): Command failed with error code -4

User : 182 140 command.c:669 command_run_line(): in procedure ‘transport’

Debug: 183 140 command.c:631 run_command(): Command failed with error code -4

User : 184 140 command.c:669 command_run_line(): in procedure ‘init’

Debug: 185 140 stlink_interface.c:99 stlink_interface_quit(): stlink_interface_quit

My openocd.cfg:

#daemon configuration###############################################################
telnet_port 4444
gdb_port 3333


#interface configuration############################################################
source [find interface/stlink-v1.cfg]

# didn'twork directly
# #board configuration################################################################
# source [find board/olimex_stm32_h103.cfg]
#

# board/olimex_stm32_h103.cfg
# Olimex STM32-H103 eval board
# http://olimex.com/dev/stm32-h103.html

# Work-area size (RAM size) = 20kB for STM32F103RB device
set WORKAREASIZE 0x5000

# source [find target/stm32f1x.cfg]
source [find target/stm32f1x_stlink.cfg]

(I build openocd with --enable-stlink and followed the advice to get

stlink ignored when connected).

Thank you!

Volker

I am guessing it is because of the badly broken mass storage implementation in the stlink-v1

You need to tell your OS to ignore it, see section on stlink about modprobe:

http://openocd.sourceforge.net/doc/html … dware.html

Cheers

Spen

Hello Spen,

I am guessing it is because of the badly broken mass storage

implementation in the stlink-v1

That’s possible.

You need to tell your OS to ignore it, see section on stlink about modprobe:

http://openocd.sourceforge.net/doc/html … dware.html

I did this, added usb-storage.conf in /etc/modprobe.d containing:

options usb-storage quirks=483:3744:i

dmesg when connecting:

[ 493.781652] usb 2-1.2: new full-speed USB device number 6 using ehci_hcd

[ 493.875576] usb 2-1.2: New USB device found, idVendor=0483, idProduct=3744

[ 493.875580] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3

[ 493.875583] usb 2-1.2: Product: STM32 STLink

[ 493.875585] usb 2-1.2: Manufacturer: STMicroelectronics

[ 493.875587] usb 2-1.2: SerialNumber: 4

[ 493.876024] usb-storage 2-1.2:1.0: device ignored

So it seems ignored, doesn’t it?

Regards

Volker

The problem is solved! I rebuild with more debugging options and found the cause of the usb-problems:

libusbx couldn’t open USB device /dev/bus/usb/002/013: Permission denied.

After fixing this now it works!

Cheers

Volker

Did you not add a udev rule, otherwise you will need to use sudo or run as root.

Spen