Showing results for 
Search instead for 
Did you mean: 

Stm32F4 Can not flash/debug with OpenOCD: Error connecting DP: cannot read IDR

Associate III

I'm trying to use VS code to flash/debug my Stm32F407VET6. When I tried to flash I got following terminal output:



"xpack-openocd-0.12.0-3/BIN/OPENOCD.EXE" -f ./openocd.cfg -c "program build/Stm32F4_Hello.elf verify reset exit"
xPack Open On-Chip Debugger 0.12.0+dev-01557-gdd1758272-dirty (2024-04-02-07:27)
Licensed under GNU GPL v2
For bug reports, read
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
Info : Using CMSIS-DAPv2 interface with VID:PID=0x0d28:0x0204, serial=
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: Test domain timer supported
Info : CMSIS-DAP: FW Version = 2.1.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 2000 kHz
Error: Error connecting DP: cannot read IDR
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked

MAKE.EXE: *** [STM32Make.make:229: flash] Error 1



But when I download using UART1 there is no problem. Google results don't even give the meaning of the error.

ST Employee

hi @Jemegen 

Try to upgrade STLink FW using the extension menu