Device is busy

Another tool or debugger is connected to this device.

DEVICE_BUSY

Symptoms

  • MCUHex lists the probe but connecting fails with a "device is busy" error.
  • The probe worked minutes ago, and a debug session in your IDE is (or was) open.
  • On Linux/macOS, other tools report LIBUSB_ERROR_BUSY for the same probe.

Likely causes

  • An active IDE debug session (STM32CubeIDE, Keil, IAR, VS Code Cortex-Debug) exclusively claims the probe’s USB interface.
  • A background GDB server — OpenOCD, ST-LINK_gdbserver, J-Link GDB Server or another pyOCD instance — is still running, sometimes left over from a crashed session.
  • STM32CubeProgrammer is left in its connected state; it holds the probe even in the background.
  • A second MCUHex tab or SDK instance is already attached to the same probe.

How to fix it

  1. Stop active debug sessions in your IDE

    End the debug session itself, not just the window focus — in STM32CubeIDE press the red Terminate button; in VS Code stop the Cortex-Debug session.

  2. Disconnect STM32CubeProgrammer

    If it is open, press "Disconnect" or close the application.

  3. Find leftover background processes

    Kill any stale GDB server or flasher process still holding the probe.

    # macOS / Linux
    ps aux | grep -E "openocd|gdb|pyocd|stlink"
    kill <pid>
    # Windows: Task Manager → end openocd.exe, ST-LINK_gdbserver.exe, pyocd.exe
  4. Replug the probe

    Unplug the USB cable, wait two seconds, plug it back in. This forces the OS to release a stuck USB claim.

  5. Retry in MCUHex

    Refresh the device list and connect. If it still fails, restart the MCUHex SDK so it re-enumerates the probe.