Pages

18/08/2017

Flashing a bootloader on to an STM32 'Blue Pill' using a Raspberry Pi

I am currently preparing some STM32 'Blue Pill' Microcontrollers for use with an Amateur Radio project. From the factory these appear to arrive without USB support, so before we can flash any firmware over USB you must first flash a new bootloader over the UART interface.

I used a USB to Serial adapter set to 3.3v, but you could use the Raspberry Pi's UART if you wish. Remember, if you're using the Raspberry Pi 3 you will need to disable the built in bluetooth and TTY running on the UART first.

The following assumes you have connected to your Raspberry Pi via an SSH session or monitor and keyboard, and you've opened up a terminal.

Switch to the root user

The steps below assume you're running as the root user. You can switch to root using-

sudo su

Install the dependencies

There are a few dependencies required before you can flash the bootloader to the STM32-

Finishing up

Now the bootloader is flashed, you should be able to unplug it from the UART and power, move the BOOT0 jumper back to its original place, and start flashing programs over USB. You will know if the bootloader has successfully installed if you see a green flashing light on the STM32 when its first powered up. I will cover one method of flashing firmware to the STM32 in another blog post in the future.

Contact Form

Name

Email
*

Message
*

Disclaimer

I may occasionally post affiliate and referral links. These allow me to collect revenue on items you purchase at no monetary cost to yourself, however they may allow the advertiser to track your browsing to a certain extent. If you don't wish to participate, please don't purchase items via the links.