Skip to main content
Visitor II
September 10, 2024
Question

LibUSB Error suddenly appearing

  • September 10, 2024
  • 2 replies
  • 2184 views

I am using a MacBook M1 Max (Sonoma 14.6.1) and STM32CubeIDE(1.16.0) with a STM32g0316-disco

board.  

Everything was working fine until, out of the blue, I started getting LibUSB errors when I tried to flash/debug my code.

I tried a second identical dev board and new cables and every usb-c port on my Macbook and the error persists.

 

I brought the machine up in safe mode and the error is still there.  Here is the Error message from the IDE.

libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access

Device connect error

 

Error in initializing ST-LINK device.

Reason: libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access

libusb: info [darwin_claim_interface] no interface found; setting configuration: 1

libusb: error [darwin_claim_interface] could not set configuration

Failed to connect to device. Please check power and cabling to target.

 
The USB device tree on my Mac shows the 3 USB3.1 Buses with STM32 STLink connected to one of them.  The device is correctly resolved as follows:

 

STM32 STLink:

Product ID: 0x374b
Vendor ID: 0x0483 (STMicroelectronics)
Version: 1.00
Serial Number: 0670FF3936324D5043114936
Speed: Up to 12 Mb/s
Manufacturer: STMicroelectronics
Location ID: 0x00100000 / 1
Current Available (mA): 500
Extra Operating Current (mA): 0

And yet STM32CubeIDE cannot flash the board because it seems to think that (or is told by) Darwin (=MacOS) that the port is not available.

I'm not really sure where the problem is.  I've tried reinstalling LibUSB as well but it makes no difference.  What is particularly annoying is I cannot recall making any changes at all between everything working well and the problem appearing.  I was happily editing my code and from one compile/flash to the next I problem appeared and will not go away.

Any ideas anyone?

2 replies

Pavel A.
Super User
September 11, 2024

Reason: libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access

Try to find who else has the ST-link opened.

Associate II
August 26, 2025

I am also having this problem when trying to debug on my STM32N6570-DK board. I have been able to run once through the IDE but not now when trying with a CLion config using the command line debugger. It seems to be locking the device or something.

Ideas?

Pavel A.
Super User
August 28, 2025

Yes, any app that opens and holds the ST-LINK will lock it from other apps. Find who holds it.