Introduction: Getting Started With Stm32f103c8 With Mbed+STLink V2

Stm32f103c8 aka blue pill is a cheap ARM cortex m3 based processor which u can easily get by less than 2$ from sites like Aliexpress.This instructable is an intro them ARM mbed platform.

Hardware required

STM32f03 (STM32f103c8 ,Will work with any stm32f103 series)

ST Link V2 -> Cheap programmer less than 2$

Step 1: Getting Started

If you're like me and coming from Arduino and moving up to ARM and heard of the mbed platform, but when u visit the mbed website you realize that the website only directly supports mbed enabled development boards and our stm32f103c8 or blue pill is nowhere to be seen.:(.But don't worry the MCU is fully (Almost) compatible with another mbed enabled dev board called NUCLEO-F103RB.You will also require an app called stink utility which is used to program the MCU via the SWD debugging interface.

Software required

Mbed online compiler(web browser)

ST-link Utility-> (Login Required)

Step 2: Setting Up Mbed

Now to setup the online compiler we have to first make an account in mbed go to

Make an account and after the registration is complete you will automatically be taken to the online compiler

Now to add a dev board click on import a program upon which you will be asked to add a platform and will be directed to the mbed board's page (

Now click on STMicroelectronics on the target vendor, now you will see the NUCLEO-F103RB listed select and add to compiler

Upon adding to the compiler the compiler, you will be presented with a list of example programs.Great:)

Select Blinky LED Hello world (or any other program if you know what your doing)

Congratulations you have set up mbed compiler

Step 3: Programing LED Blink

Now to be able to use mbed online compiler to write programs for youl need a library

Click on import into compiler to add to your mbed compiler

Now select the path to your program and select import

Now you can see the library files in your workspace

Select main.cpp and add the library by


#include "stm32f103c8t6.h"

so the program should look like this

#include "stm32f103c8t6.h" //Make sure this comes first i have no idea why(someone smarter than me can tell me)

#include "mbed.h"

DigitalOut myled(LED1);

int main()




myled = 1; // LED is OFF

wait(0.2); // 200 ms

myled = 0; // LED is ON

wait(1.0); // 1 sec



Then click compile and cross your fingers:)

This will download the binary file which we will upload to our MCU

Step 4: Loading the Program to the MCU

Before you can load programs you need to install the stink drivers

go to

Download and install the drivers

and in the device manager you will see that it shows up as

STMicroelectronics STLink Dongle

This means you have successfully installed the stlink drivers and are ready to go

Now wire the stm32 board with st link v2 in the following manner

Connect board and ST link in following manner.
STLINK------>STM32 Board






Make sure to check the pinout of the board and the ST Link your using

Now open ST Link Utility i mentioned earlier

And select Target-Connect

It will show the data present in the MCU (in hexadecimal format) we are not going to do anything with that now

open the binary file file-open

Now select target-program

and select start

Now the program will be flashed and the led wil start blinking......:):D

If you have trouble connecting to the target make sure drivers

you can also try by connecting in"connect under reset" mode in setting and erasing the chip selecting erase chip while holding down the reset buttom in stm32 board


Check out the above link for more info

This is my first instructable and i would love to hear some constructive critsism from you guys in the comments below, I myself got into mbed platfrom quite recently and i will try to put more instructables taking this further like offline compiling ,STM32cube etc


Swansong (author)2017-08-10

Thanks for sharing :)

About This Instructable




More by XavierJ4:Getting Started With Stm32f103c8 With Mbed+STLink V2
Add instructable to: