-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Flashing the bootloader from macOS
Roger Clark edited this page Sep 2, 2022
·
5 revisions
These steps assume you have a [Blue], [Red] or [Black Pill] board, a USB-Serial interface with 3.3V broken out to a pin, and a relatively modern macOS. I've tested them with a Black Pill on Mojave 10.14.
The aim is to go from a completely new out-of-the-box board with nothing but the built-in bootloader, to uploading sketches from the Arduino environment over USB.
- [Set the boot jumper] on the Pill board to "Serial Programming"
- Connect the USB-Serial interface's 3.3V pin to 3.3V on your Pill board, and ground to ground.
- Connect the TX pin on the USB-Serial interface to PA10 on the board, and the RX pin to PA09.
- Clone the Arduino_STM32 repository into
~/Documents/Arduino/hardware
- Select the appropriate
.bin
file from here, and download it into your~/Downloads
directory (I have a Black Pill with the LED on PB12, so I'm usinggeneric_boot20_pb12.bin
; if you have a Blue Pill or Red Pill you wantgeneric_boot20_pc13.bin
. Make sure you download the actual binary by clicking on the entry for the file you want in the list at the above link, then clicking the "Download" button in the Github interface.) cd ~/Documents/Arduino/hardware/Arduino_STM32/tools/macosx/stm32flash
-
./stm32flash -v -w ~/Downloads/generic_boot20_pb12.bin /dev/cu.usbserial-DN0091ZE
(the characters afterusbserial-
might be different on your system) - Unplug the Pill board from the USB-Serial interface, restore the boot jumper to its original position and power it up by connecting it to a USB port. Congratulations, you now have a bootloader!
Next, follow the instructions here to set up your Arduino environment to build and upload to your Pill board.