This is an old revision of the document!
Table of Contents
STM32 "Blue Pill"
Some quick notes about setting up a STM32F103C8T6 "Blue Pill" for development on Arduino.1)
Setup
Arduino environment
Do once:
- Under Files > Preferences, add to the “Additional Boards Manager URLs:” field:
http://dan.drown.org/stm32duino/package_STM32duino_index.json
- Under Tools > Board > Boards Manager …, find “STM32F1xxx/GD32F1xxx boards by stm32duino” and install it.
Hardware
In addition to your “Blue Pill,” you will also need a 3.3V USB to serial converter. I used a SparkFun Serial Basic configured for 3.3V. Only the power, TX and RX pins will be used, so you should be able to use a standard FTDI board as well.
Some serial converter boards put out 5V as VCC even when set to 3.3V mode. Be careful!
Applying 5V to the 3.3V main supply line of Blue Pill will kill it.
There is a 5V input on the Blue Pill and a USB connector that can power the board from 5V. These go through a small 3.3V regulator.
Lots of pins on the STM32F103C8T6 are purported to be 5V tolerant, but the main DC isn't! I don't know if TX/RX are.
- Connect VCC and ground from the serial converter board to the
3.3
andGND
pins of the Blue Pill (or5V
andGND
if your serial converter board puts out 5V even in 3.3V mode). - Connect the serial converter's RX to the Blue Pill's
A9
and TX toA10
.
Project config
Under the Tools menu, make the following selections:
- Board : “Generic STM32F103C series”
- Variant : “STM32F103C8 (20k RAM. 64k Flash)”
- Upload method : “Serial”
- CPU Speed(MHz) : “72Mhz (Normal)”
- Optimize : “Smallest (default)”
- Port : wherever the serial converter is plugged into
Programming
- Move the top jumper (i.e., the one furthest from the Reset button) to the 1 position (i.e., closest to the microcontroller IC).
- Push reset.
- Upload the sketch.
- To re-upload, push reset and upload.
To put the device into “use” mode, move the top jumper back to 0 (left) position.
Pinout
From here:
Resources
Note that the stm32duino.com domain has gone down at least once because it exceeded the host's traffic limit.