PlatformIO Community

STM32 upload stalled via ST-LINK "error writing to flash at address 0x08000000"

I am trying to migrate my project off of the Nucleo F401RE development board and onto my own STM32F401RE dev board. Using the Nucleo F401RE Schematic, I have setup the official ST-LINK programmer JTAG pins in “SWD” mode to all the appropriate pins on the microcontroller.

It seems like the upload process is seeing the board, but cannot identify the “flash” address. Or perhaps it is having trouble reseting the board… its hard to tell.

Here is the console output:

** Programming Started **
Error: timeout waiting for algorithm, a target reset is recommended
Error: error executing stm32x flash write algorithm
Error: flash write failed = 00000040
Error: error writing to flash at address 0x08000000 at offset 0x00000000
embedded:startup.tcl:449: Error: ** Programming Failed **

Is there anything unique about a Nucleo Board vs just the microcontrollers themselves? Is there some preloaded bootloaders or something that Nucleo boards get shipped with which would be missing on the raw chips?


platform.ini:

[env:nucleo_f401re]
platform = ststm32
board = nucleo_f401re
framework = mbed
debug_tool = stlink
upload_protocol = stlink

No pre-flashed bootloader is necessary to flash via SWD.

Which are? Any schematics?

One thing I noticed is I don’t have anything done with VCAP1, but I don’t believe it to be required.

Another thing I can’t wrap my head around is how does the ST-LINK know whether it is in Serial Wire Mode Interface (SWD) or the JTAG Interface?

holy ****, it was the VCAP1 pin… all I had to do was connect it to GND with some random capacitor I had lying on my desk

1 Like