Skip to main content
Visitor II
March 28, 2025
Question

Problems with debugging STM32F4 using STM32CubeIDE

  • March 28, 2025
  • 2 replies
  • 591 views
I am encountering an issue while attempting to debug my STM32F429 microcontroller using STM32CubeIDE (version 1.18.0) with the ST-LINK V2 debugger. The console outputted the following message:
 
Open On-Chip Debugger 0.12.0+dev-00608-gd8ed48fef (2025-02-06-11:17) [https://github.com/STMicroelectronics/OpenOCD]
Licensed under GNU GPL v2
For bug reports, read
Info : Listening on port 7777 for tcl connections
Info : Listening on port 5555 for telnet connections
Info : STLINK V2J46S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 2.935230
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : clock speed 4000 kHz
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x2ba01477
Info : [STM32F429ZITx.cpu] Cortex-M4 r0p1 processor detected
Info : [STM32F429ZITx.cpu] target has 6 breakpoints, 4 watchpoints
Info : [STM32F429ZITx.cpu] Examination succeed
Info : starting gdb server for STM32F429ZITx.cpu on 4444
Info : Listening on port 4444 for gdb connections
Info : accepting 'gdb' connection on tcp/4444
Error: timed out while waiting for target halted
Error executing event gdb-attach on target STM32F429ZITx.cpu:
C:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.debug.openocd_2.3.100.202501240831/resources/openocd/st_scripts/gdb_helper.tcl:18: Error: TARGET: STM32F429ZITx.cpu - Not halted
in procedure 'gdb_attach_hook' called at file "C:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.debug.openocd_2.3.100.202501240831/resources/openocd/st_scripts/target/stm32f4x.cfg", line 192
in procedure 'first_gdb_attach_hook' called at file "C:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.debug.openocd_2.3.100.202501240831/resources/openocd/st_scripts/gdb_helper.tcl", line 18
Info : device id = 0x20036419
Info : flash size = 2048 KiB
Info : Dual Bank 2048 kiB STM32F42x/43x/469/479 found
Warn : GDB connection 1 on target STM32F429ZITx.cpu not halted
undefined debug reason 8 (UNDEFINED) - target needs reset
Info : accepting 'gdb' connection on tcp/4444
Warn : GDB connection 2 on target STM32F429ZITx.cpu not halted
undefined debug reason 8 (UNDEFINED) - target needs reset
Error: timed out while waiting for target halted
Error executing event gdb-flash-erase-start on target STM32F429ZITx.cpu:
TARGET: STM32F429ZITx.cpu - Not halted
Error: Target not halted
Error: failed erasing sectors 0 to 0
Error: flash_erase returned -304
Info : dropped 'gdb' connection
shutdown command invoked
Info : dropped 'gdb' connection
 
 

2 replies

KnarfB
Super User
March 28, 2025

A custom board? Known good / bringup ?

What pins connected? Reset pin ?

Debug Config Settings (Screendump) ? 

hth

KnarfB

TDK
Super User
March 28, 2025

Can you connect with STM32CubeProgrammer?

What does your code do?

Don't do any of the following in the first second of the program:

  • Write to flash.
  • Erase flash.
  • Reassign SWD pins.
  • Enter low power modes.
  • Reset.
"If you feel a post has answered your question, please click ""Accept as Solution""."