Guide to loading the bootloader and using the Arduino IDE with the "blue pill" STM32 board

Guide to loading the bootloader and using the Arduino IDE with the

Reviewed by: Olivia

On: 30 Mei, 2020

Viewed:457 times - 7 hour, 48 minute, 47 second ago

Downloaded: 0 times -

Category: Circuit

Guide to loading the bootloader and using the Arduino IDE with the "blue pill" STM32 board Rating:
4
10 out of 100 based on 290 user ratings

Premise

Some time ago, intrigued by this thread on Electroyou Module with STM32F103C8 and ST-LINK very cheap, I had obtained for a few euros a coupon called on the "blue pill" network and the related USB clone programmer ST LINK V2.

<...

Premise

Some time ago, intrigued by this thread on Electroyou Module with STM32F103C8 and ST-LINK very cheap, I had obtained for a few euros a coupon called on the "blue pill" network and the related USB clone programmer ST LINK V2.


arduino ide with the blue pill stm32 board 1

arduino ide with the blue pill stm32 board 1


The card (with minimal equipment and very small dimensions) is equipped with a powerful 32bit STM32F103C8T6 processor. The coupon and programmer have not been used for various times; after more than two years I took it again and I decided to make this little guide on how to install the bootloader and how to use the board with the Arduino IDE in a Windows environment. I know that many will turn up their noses, however I think that any attempt to bring the kids closer to electronics or passions in general is still to be done; the module is cheap, the Arduino IDE is widespread and that's enough.


Obviously, those who want to can deepen and study programming and microcontrollers in general in a more serious and rigorous way.

Why the bootloader

The bootloader is a small program which, in our case, creates a COM port that allows us to program the microcontroller without the external programmer, but through a USB cable connected to our PC. It is very convenient because, especially those who are beginners, compile and load the program several times on the microcontroller to see the effects of the changes on the code. Also in the case of the blue pill card, every time I load the code with the ST LINK programmer I would have to move a jumper on the card, which is a waste of time. The bootloader occupies about 20kB of the 64kB available.

Take a look at the card

The card is really small (a couple of two euro coins side by side ....) but the invoice leaves something to be desired. Before proceeding I replaced the R10 (a 10k value SMD package 0603 resistor) with the correct 1.5k resistor as per USB specifications.


arduino ide with the blue pill stm32 board 2

arduino ide with the blue pill stm32 board 2


Apparently this is a common problem. I also replaced the 90 ° connection strip for connecting the programmer with a female strip (only for my convenience in the connections). I cleaned the card with nitro thinner.


We load the bootloader

First you need to install the USB drivers for ST-LINK which are located at the following address:
USB driver (STSW-LINK009) for ST-LINK / V2, ST-LINK / V2-1 and STLINK-V3 boards
To download the drivers you will need to create an account on ST; we will also need the account to download other ST tools. We insert the ST-LINK programmer into the USB port and verify that it is correctly recognized (control panel -> system -> device management):

arduino ide with the blue pill stm32 board 3

arduino ide with the blue pill stm32 board 3

At this point you need to download the bootloader .bin file for the coupon in our possession at this link:
STM32duino-bootloader
The correct one is chosen based on the connection of the status LED (in my case the LED is connected to the PC13 pin). So I downloaded the "generic_boot20_pc13.bin" file. At this point it is necessary to connect the ST-LINK programmer to the board through four connections:

GND -> GND
3.3V -> 3.3
SWDIO -> GOD
SWCLK -> DCLK

The connector pin of the ST LINK is stamped on the chassis of the connector. Care must be taken not to supply the 5V voltage to the blue pill card, otherwise it will break.

arduino ide with the blue pill stm32 board 4

arduino ide with the blue pill stm32 board 4

We insert the programmer into the USB port of the PC and verify that the red LED is on. To load the bootloader you need to download the STM32CubeProgrammer software at:
STM32CumeProgrammer
You must first connect to the device:

arduino ide with the blue pill stm32 board 5

arduino ide with the blue pill stm32 board 5

Then we can proceed to upload the bin file:


arduino ide with the blue pill stm32 board 6

arduino ide with the blue pill stm32 board 6

Now we can remove the connections and connect the blue pill card to the PC using a USB cable. Now we need to make sure that the COM port is recognized as "Maple Serial COMx". You will need to install the drivers at the following link:
Driver STM32 maple
You need to create the folder C: \ Users \ username \ Documents \ Arduino \ hardware and unzip the previously downloaded file. Open a prompt in C: \ Users \ username \ Documents \ Arduino \ hardware \ Arduino_STM32-master \ drivers \ win \ and run install_drivers.bat. The command will run wdi-simple.exe twice to install the necessary drivers. At the end, connect the blue pill card to the PC via USB cable and see if the driver for the COM port is correctly recognized:

arduino ide with the blue pill stm32 board 7

arduino ide with the blue pill stm32 board 7

Configure Arduino IDE

To configure the Arduino IDE, we need to download support for STM32duino boards. To do this, go to the program settings and insert the following link in the Additional URL section for the Card Manager:
STM32duino

arduino ide with the blue pill stm32 board 8

arduino ide with the blue pill stm32 board 8

Then go to the Tools -> Card Manager menu and install the package: STM32F1xx / GD32F1xx boards

arduino ide with the blue pill stm32 board 9

arduino ide with the blue pill stm32 board 9

After installing the package, connect the blue pill to the USB port and go to the Tools menu to select the tab (Generic STM32F103C6 / fake STM32F103C8) and the upload mode (STM32duino bootloader):

arduino ide with the blue pill stm32 board 10

arduino ide with the blue pill stm32 board 10

Let's try to compile and load a program

Let's try the simple "blink" example sketch that we will modify as below (in practice we define that the present on the "LED_BUILTIN" card is connected to PC13.

arduino ide with the blue pill stm32 board 11

arduino ide with the blue pill stm32 board 11

We compile and load the program and if all goes well we will see the LED flash .....

Conclusions

I hope this guide is for some students or hobbyists who already use Arduino and who want to try this really cheap board and that this can be a launching pad!

 

 

Related Posts

How to Build Audio DIY

My (first) version of Class-A

Some time ago, I ran across the net in the creatures of Jean Hiraga. In particular, my attention was captured by the apparent simplicity of two of his class A ...

How to Build a tube amplifier - Practical realization

It is obvious that the first thing to do is to get all the material, electrical and not necessary. The next step is to "present" the components on the aluminum plate, and to decide the position to ...

Reflow Soldering Oven with a Stencil and Soldering Paste

In this article I will talk about the transformation of a 35 € oven into a reflow soldering oven, i.e. the type of soldering that allows you to obtain quality assembled PCBs with a stencil and...

Solving problems commonly occur at Alternator and Regulator

How to determine the failure in an electrical system must through some steps. To get the best result to need to check and clean up all connections available in the electrical system before searchin...

How to repair comprehensive electrical vintage car

How to Easy Repairing Electrical Vintage car

Fixing electrical system for vintage cars easily and suddenly is my topic post today taken from trusted reference. Before we already posted abou...

2000 Mercury Cougar Fuse Diagram

2000 Mercury Cougar Fuse Panel Diagram Wiring Forums 10/08/2017 · Looking for info regarding 2000 Mercury Cougar Fuse Panel Diagram...

As the fastest growing demand of circuit and wiring diagram for automotive and electronics on internet based on different uses such as electronic hobbyists, students, technicians and engineers than we decided to provide free circuit and wiring diagram base on your needed.

To find circuit and wiring diagram now a day its easy. E-learning through internet as a right place to search an exact circuit and wiring diagram of your choice and it's much fun and knowledgable. On internet you will find thousands of electronic circuit diagrams some are very good designed and some are not. So you have to modify them to make them according to your needs but some circuits are ready to make and require no changes.

There are many categories of circuit and wiring diagrams like automotive, audio circuits, radio & RF circuits, power supply circuits, light circuits, telephone circuits, timer circuits, battery charger circuits etc. There are many types of circuit and wiring diagrams some are very easy to build and some are very complicated, some are so small and some contain huge list of parts.

We provides free best quality and good designed schematic diagrams our diagrams are free to use for all electronic hobbyists, students, technicians and engineers. We also provides a full educational system to students new to electronics. If you are new to electronics you are a student or a electronic hobbyist and want to increase your knowledge in electronics or want to understand electronics in a very easy way so this is the right place for you we provide electronics beginner guide tutorials to easily understand complicated electronic theory. Our mission is to help students and professionals in their field.