0

I am trying to debug using Arduino IDE through STM32Duino for my STM32 Nucleo-144 F767ZI. The code is uploaded successfully, but upon pressing debug, I get this error.


Waiting for gdb server to start...[2025-09-10T16:17:04.732Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
"C:\\Users\\User\\AppData\\Local\\Arduino15\\packages\\STMicroelectronics\\tools\\xpack-openocd\\0.12.0-6/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "c:\\Users\\User\\AppData\\Local\\Temp\\.arduinoIDE-unsaved2025810-9148-1hcu05t.jn7e\\Blink" -f "C:/Users/User/AppData/Local/Programs/Arduino IDE/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f interface/stlink.cfg -f "C:\\Users\\User\\AppData\\Local\\Arduino15\\packages\\STMicroelectronics\\hardware\\stm32\\2.11.0/debugger/select_dapdirect.cfg" -f target/stm32f7x.cfg
xPack Open On-Chip Debugger 0.12.0+dev-01850-geb6f2745b-dirty (2025-02-07-10:08)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'gdb port', not 'gdb_port'
DEPRECATED! use 'tcl port' not 'tcl_port'
DEPRECATED! use 'telnet port', not 'telnet_port'
CDRTOSConfigure
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : STLINK V2J46M33 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.246408
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x5ba02477
Info : [stm32f7x.cpu] Cortex-M7 r1p0 processor detected
Warn : [stm32f7x.cpu] Erratum 3092511: Cortex-M7 can halt in an incorrect address when breakpoint and exception occurs simultaneously
Info : [stm32f7x.cpu] The erratum 3092511 workaround will resume after an incorrect halt
Info : [stm32f7x.cpu] target has 8 breakpoints, 4 watchpoints
Info : [stm32f7x.cpu] Examination succeed
Info : [stm32f7x.cpu] starting gdb server on 50000
Info : Listening on port 50000 for gdb connections
Info : accepting 'gdb' connection on tcp/50000
Warn : [stm32f7x.cpu] target was in unknown state when halt was requested
Error: timed out while waiting for target halted
Error: [stm32f7x.cpu] Execution of event gdb-attach failed:

Info : device id = 0x10016451
Error: Failed to read memory at 0x00202442
Warn : STM32 flash size failed, probe inaccurate - assuming 2048k flash
Info : flash size = 2048 KiB
Error: Failed to read memory at 0x00002442
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected
Error: [stm32f7x.cpu] Polling failed, trying to reexamine
[2025-09-10T16:17:08.456Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start... 

1
  • please add a focused, answerable question to your post Commented Sep 12 at 13:53

1 Answer 1

0

If your sketch (uploaded via Arduino IDE) changes clock setup, low-power states, or reconfigures the debug pins (PA13/PA14 = SWDIO/SWCLK), then OpenOCD may not be able to halt the CPU anymore. Hold down the reset button, start the debug session, and release reset once OpenOCD is trying to connect. Or configure OpenOCD with reset_config srst_only srst_nogate so it resets the MCU on connect.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.