Skip to main content
Associate III
October 27, 2025
Question

Flashing a blank STM32

  • October 27, 2025
  • 3 replies
  • 539 views

I have an STM32L4R5ZI-P on a custom PCB. When designing the PCB I did not think far ahead enough and do my due diligence when it came to assigning and wiring pins on the STM32 in order to flash it. My design incorporates  USB D connected to my PCB which supplies power, and such, along with connections to USB_DM and USB_DP on my STM32. I did not wire BOOT0 or NRST. After looking online a bit, I heard that I must pull BOOT0 high and NRST low, allowing the STM32 to enter boot mode and then I can flash my STM32 via the DM and DP pins (using the CubeIDE and CubeProgrammer, etc.). I was just planning to jump BOOT0 to 3.3V and NRST to GND and then use my DM and DP pins on the USB to program is somehow using my PC. Am I thinking about this correctly? Is there an easier way to flash my virgin STM32 on my custom PCB? I do have a NUCLEO evaluation board for my specific STM32L4, which I have programmed and ran code on already. I was wondering if I can utilize the ST-LINK that is on the NUCLEO board to flash the virgin STM32 on my custom PCB. Any advice or pointers will help. Thank you

3 replies

TDK
Super User
October 27, 2025

Yes, you can jump to bootloader by pulling BOOT0 and then applying power and using the USB DFU bootloader from STM32CubeProgrammer.

Don't jump NRST to GND. That will prevent it from doing anything. Floating is okay. Would be better to have 0.1 uF cap on there.

 

Not having a way to debug the board (i.e. a SWD ST-Link connection) will not lead to a productive development environment.

"If you feel a post has answered your question, please click ""Accept as Solution""."
ym21Author
Associate III
October 27, 2025

When you say "USB DFU bootloader", are you referring to the DP and DM pins that I have connected on my USB? To facilitate a productive development environment, can I snap off the ST-LINK from my NUCLEO board and somehow use that to debug my PCB MCU?

TDK
Super User
October 27, 2025

Yes, the USB DFU bootloader uses the USB connection, so the DM/DP pins on the board.

You'd need to connect the programmer to the SWD pins on the board. If they're exposed and you can do so, that'll work.

"If you feel a post has answered your question, please click ""Accept as Solution""."
TDK
Super User
October 28, 2025

Why are you using an external loader for a STM32H745 Discovery board? Do you even have external memory?

TDK_0-1761657732695.png

 

Create a new project for your cpu in CubeMX and toggle a single pin. That's it.

Try to connect with STM32CubeProgrammer.

"If you feel a post has answered your question, please click ""Accept as Solution""."
ym21Author
Associate III
October 28, 2025

I am not using an external loader for the STM32H Disco board, that was from a different post in a forum. I changed my .stldr file to the one that is shown below for the STM32L4. I have also linked the discussion where changing the .stldr file and my launch error (OpenOCD).

.stldr: https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/error-in-final-launch-sequence-for-stm32h745i-disco-board-again/td-p/57836
OpenOCD: https://community.st.com/t5/stm32cubeide-mcus/failed-to-start-gdb-server-error-in-initialising-st-link-device/td-p/132760

TDK
Super User
October 30, 2025

I think the question in the opening post has been answered. I'm not sure how much more I can provide.

"If you feel a post has answered your question, please click ""Accept as Solution""."