Programming STM32F103C8 Board Using USB Port
Programming STM32F103C8 Board Using USB Port
embedded
ByAswinth Raj Aug 22, 2018 7
Programming STM32F103 Board (Blue Pill) using USB Port
The STM32 Development Board housing the STM32F103C8 Microcontroller is getting increasingly popular
thanks to its ARM Cortex M3 architecture, it has high operational speed and more peripheral options. Also since,
this board can be easily programmed using the Arduino IDE it has become a preferable choice for many
hobbyists and engineers for quick prototyping.
In our previous tutorial we learnt the basics of the STM32 Development Board and also programmed it to blink an
LED. But there was one huge drawback with it. In order to program the Board we utilised a FTDI programmer
module and also had to toggle the boot 0 jumper between and 1 position while uploading and testing a code, which is
surely a daunting task. Also the mini-USB port on the Development board was left totally unused. The reason for
doing that is, when the STM32 development board is purchased it does not come with an Arduino ready boot
loader and hence the board will not be discovered by your computer when connected through the USB.
Hopefully though, there exists an experimental boot loader developed by LeafLabs for Maple mini boards. This boot
loader can be flashed into the STM32 once and thereafter we can directly use the USB port of the STM32 board to
upload programs just like any other Arduino boards. However this boot loader is still in developmental stage at the
time of documenting this tutorial and is not advisable for critical applications. Before proceedings with this tutorial
make sure you have read the previous tutorial to understand the basics of this board including details about the
specifications and pin-outs.
Materials Required
STM32 – (BluePill) Development Board (STM32F103C8)
FTDI Programmer
Breadboard
Connecting wires
Laptop with Internet
Circuit Diagram
To program the STM32 Blue Pill board directly through USB port we need to first flash the Maple boot loader
into the MCU. To do this we need to use a Serial FTDI board. This board is connected to the Rx and Tx pin of
the STM32 as shown below.
The Vcc pin of the FTDI board is connected to the STM32 5V pin of power the board. The ground is connected to the
Ground of STM32. The Rx and Tx pin of the FTDI board is connected to the A9 and A10 pin of
the STM32 respectively. Where the A9 is the Tx pin of STM32 MCU and the A10 is Rx pin.
Make sure the boot 0 jumper pin on the board is set to 1 (programming mode) while uploading the boot loader. Once
the boot loader is flashed this pin can be changed back to initial position (operating mode).
Press the upload button on the Arduino IDE and your program should get compiled and uploaded. If everything has
worked as expected then you should see the following on your Arduino IDE console.
If the Program has been uploaded successfully then you should see the Green LED blinking at a 1 second interval as
shown in the video below. You can also fiddle around with the program to increase or decrease the delay. Now you
can start using the STM32 (Blue Pill) Development board like any other Arduino boards, that is you no longer need
not change the position of jumpers or use external hardware to upload and test programs.
Hope you understood the tutorial and found it useful to get started with STM32 Board. If you have any problem
leave them in the comment section, also tell me what projects we should try with this STM32 board in future.