The STM32F405 chip has a built in ROM bootloader that cannot be disabled or erased, this makes it a fool-proof way to always be able to recover your microcontroller code. It's not as easy to use as UF2, but it isnt too difficult either.
The ROM bootloader looks for signal on the serial RX line as well as USB, so make sure no GPS or other serial/uart data device is connected to RX while you are trying to bootload the device!
Enabling DFU bootloader mode
Enabling the DFU bootloader is super easy. Simply connect the BOOT0 (B0) pin to 3.3V logic. Then press the reset button or power cycle while the board is connected to your computer USB port
After you've hit reset, you can remove the BOOT0 jumper - it's only checked on powerup
In MacOS X
Visit the AppleMenu->About This Mac->System Report
Select USB and look for the item labeled STM32 BOOTLOADER
Windows
The easiest way by far to program under windows is to download STM32CubeProg. It's a graphical programmer, does not require Zadig or special command line invocation
You'll need to make an ST.com account is the only downside.
With a new version of this software out, users report some of the buttons and prompts may be different than those shown. As this is an advanced section, the user should look to map the appropriate responses.
In the top right, below the Not Connected message, find the dropdown to the left of the Connect button
Select USB
OK if the device is plugged in and the bootloader is running, it will show up under the USB configuration pane. If not, enter bootloader mode by connecting BOOT0 to 3.3V and resetting, and click the refresh button.
Once it appears as a valid Port, click Connect
You should see the Device info pane in the bottom right is updated with info about what chip was found!
Click the 3-lines below the STM32 logo in the top left, to expand the menu.
Then click Erasing & Programming
Click Browse to open the firmware files you want to program
You can program .hex or .bin files, it does not seem to support .dfu
Don't change the Start Address
Make sure Verify Programming and Run after Programmingare clicked, but Skip flash erase is not
Then click Start Programming
It will take a few seconds to erase and reprogram the chip.
It's normal to get a Warning Connection is lost alert
Click away until you get the File download complete alert
That's it! You should close STM32 CubeProg now - leaving the program open may conflict with other connections to the board.
Mac (and Linux)
For Mac users, install dfu-util
with brew
dfu-util can only program .bin and .dfu files. It cannot program .hex files (but there are tools to convert .hex's to .bin's)
Then upload the firmware with the command
dfu-util -a 0 --dfuse-address 0x08000000 -D firmware.bin
Don't change the address value, only the firmware filename!
Or, if you have a dfu file - use
dfu-util -a 0 -D firmware.dfu
Upon success, reset the board without the BOOT0 jumper and you will see after a few seconds the CIRCUITPY disk drive appear
Page last edited May 07, 2024
Text editor powered by tinymce.