cancel
Showing results for 
Search instead for 
Did you mean: 

Configuring built-in OpenOCD in STM32CubeIDE

chriskuku
Senior III
I'm trying to run a Debug launch configuration in STM32CubeIDE but I'm getting an error:

Console:
 

Open On-Chip Debugger 0.12.0+dev-00623-g0ba753ca7 (2025-04-30-14:20) [https://github.com/STMicroelectronics/OpenOCD]
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : STLINK V2J46S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 2.716832
Error: init mode failed (unable to connect to the target)



Error message of STM32CubeIDE (1.19.0)  popping up:


Error in final launch sequence:

Failed to execute MI command:
target extended-remote localhost:3333

Error message from debugger back end:
localhost:3333: Operation timed out.
Failed to execute MI command:
target extended-remote localhost:3333

Error message from debugger back end:
localhost:3333: Operation timed out.
localhost:3333: Operation timed out.


Any ideas what's going wrong?
 
--
Christoph
1 ACCEPTED SOLUTION

Accepted Solutions
Ghofrane GSOURI
ST Employee

Hello @chriskuku 

The error you're encountering in STM32CubeIDE—"init mode failed (unable to connect to the target)" and "Operation timed out" indicates that OpenOCD cannot communicate with your STM32 device. This is often caused by hardware connection issues (such as loose or incorrect SWD/JTAG wiring, insufficient power, or incorrect BOOT pin settings), outdated ST-Link firmware, the MCU being in a low-power or locked state, or conflicting software accessing the ST-Link. To resolve this, ensure all hardware connections are secure, update your ST-Link firmware, check that the target board is powered and in the correct boot mode, and close any other software that might be using the debugger. Also, try changing the reset mode in your debug configuration and, if necessary, perform a full chip erase using STM32CubeProgrammer. If the problem persists, test with a different USB port and  cable.

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
Ghofrane GSOURI
ST Employee

Hello @chriskuku 

The error you're encountering in STM32CubeIDE—"init mode failed (unable to connect to the target)" and "Operation timed out" indicates that OpenOCD cannot communicate with your STM32 device. This is often caused by hardware connection issues (such as loose or incorrect SWD/JTAG wiring, insufficient power, or incorrect BOOT pin settings), outdated ST-Link firmware, the MCU being in a low-power or locked state, or conflicting software accessing the ST-Link. To resolve this, ensure all hardware connections are secure, update your ST-Link firmware, check that the target board is powered and in the correct boot mode, and close any other software that might be using the debugger. Also, try changing the reset mode in your debug configuration and, if necessary, perform a full chip erase using STM32CubeProgrammer. If the problem persists, test with a different USB port and  cable.

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.