Error while uploading to STM32 Nucleo64 F411RE - OpenOCD init failed

Hey All,

I’m trying to upload sample code to my STM32 Nucleo64 F411RE board, but I haven’t been successful.

The error I get when trying to upload is

xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:04)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 2

Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_deassert_srst

Info : clock speed 2000 kHz
Info : STLINK V2J33M25 (API v2) VID:PID 0483:374B
Info : Target voltage: 4.359184
Error: init mode failed (unable to connect to the target)
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked

*** [upload] Error 1

This indicates to me that the issue is when connecting to my STM32 board. Now, the board’s LEDs are on (so that means it’s not power-related). I also have it connected on virtual com port 3.

I have tried following the documentation on ST Nucleo F411RE — PlatformIO v6.1 documentation and also checked a user with a similar error at ** OpenOCD init failed ** - Nucleo-F401RE, but it was to no avail.

Can someone help me if they get a chance?

my platform.ini file is the following:

[env:nucleo_f411re]
platform         = ststm32
board            = nucleo_f411re
framework        = arduino
upload_protocol  = stlink
upload_port      = COM[3]

Thanks for the help!