** OpenOCD init failed ** - Nucleo-F401RE

Oh boy do I hate running into upload problems :man_facepalming:.

I was uploading to my Nucleo board just fine, but then all of a sudden I started getting this error when attempting to upload to the board.

GNU MCU Eclipse OpenOCD, 64-bitOpen On-Chip Debugger 0.10.0+dev-00593-g23ad80df4 (2019-04-23-00:01)
Licensed under GNU GPL v2
For bug reports, read
debug_level: 1
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Error: init mode failed (unable to connect to the target)
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked

*** [upload] Error 1

Does anyone have any experience fixing this error? It would also be great if someone could explain why it happens ahaha… :sob:

Here is my .ini file if it matters at all:

platform = ststm32
board = nucleo_f401re
framework = stm32cube

Wisdom on the internet has it that this happens if you reconfigure the SWD pins such that they no longer work for the debug interface. If I’m not mistaken, they are all on port A.

The way to get out of it is to press the reset button and hold it pressed, start the upload, wait until OpenOCD has started and release the reset button.

Of course, you need to flash a firmware that does not configure the SWD pins as output pins. Otherwise, you’ll have to repeat it every time.

ya its just not working :man_shrugging:. Frustrating.

I cleaned my build, reset my computer, and pressed that reset button a million times.

There are only two buttons on the board that I can see. One says reset, and the other says user. When I press the reset button the board resets. But holding it down and releasing it while uploading just does not seem to work. Unless there is a particular timing I am missing :thinking:. I remember programming another chip I had to do something similar but there were blinking LEDs kinda indicating when I should pull the reset pin low etc.

All of a sudden meaning after you changed some firmware stuff? Did you do anything to the SWD pins PA_13 and PA_14 (SWCLK + SWDIO), or disabled the clock for the GPIOA block or activated any other function on the SWD pins? Or went into STANDBY or STOP modes for deepsleep?

Can you add

upload_protocol = mbed

to the platformio.ini so that it attempts an upload via the virtual USB disk?

1 Like

*** [upload] No space left on device
This is what my output is after I add the code in .ini file.

This error message likely refers to your computer. It seems that the disk is full.

@scottc11 did you ever figure this out? I have exactly the same problem on OSX.

Using upload_protocol = stlink gives me unable to connect to target, whether I specify a port or not (and it dies instantly, holding reset gives me no wait to release it`. and the mbed protocol fails every time because the disk is full every time (if I delete everything from that volume, unplug it and re-plug it, they’re back again, and it’s full again).

Are you trying to upload the firmware? If so, please provide the full build output.

Additionally, show the contents of the platformio.ini file.