Program STM32 Blue Pill using Arduino IDE

PAUL SABU
4 min readApr 17, 2021

--

Here we are going to program STM32 Blue Pill in Arduino IDE using USB to TTL Adapter , Install STM32F1xx/GD32F1xx board in Boards Manager and write a simple program to blink the builtin led

Overview of STM32

The STM32 is a development board for the ARM Cortex M3 microcontroller. It looks very similar to the Arduino Nano . It can accommodate two crystal oscillator : one 8MHz crystal and one 32KHz crystal , that can be used to drive an internal RTC (real-time clock).

STM32 PINOUT Diagram

Materials Required

  • STM32 F103C8T6
  • USB to TTL Adapter (CP2102)
  • Bread Board
  • Arduino IDE
  • Jumper Wires

Installing STM32 Board in Arduino IDE

We need to install STM32 Board in Boards Manager of Arduino IDE inorder to upload code to STM32 board . Launch Arduino IDE

Click on File >>> Preferences

Click inside the box of Additional Boards Manager URLs and copy the url given below and paste it inside the box . If there are more one url , then put a comma in end of the other url and paste this url , then click on OK

Board URL : http://dan.drown.org/stm32duino/package_STM32duino_index.json

Click on Tools>>>Board>>>Boards Manager...

  • Search for stm32 in search box as shown above and press Enter
  • Click on Install in box with STM32F1xx/GD32F1xx boards

Once the above process is over , Installation of STM32 Board is Successful

Wiring Circuit

We need to connect pins for uploading program to STM32

The pin connection Table is as below:

Before connecting USB to TTL Adapter to computer

Normal Mode
Write Mode
  • Change the position of jumper of BOOT0 to 1
  • Connect USB to TTL Adapter to computer

For Windows users (Follow only if Port is greyed or no COM* is found in Port of Arduino IDE)

After connecting USB to TTL Adapter

  • Press on Start
  • Search “device manager”
  • Look for Unknown device
  • Right-Click on Unknown device >>> Update driver
  • Click on Search automatically drivers (want to be connected to internet)

If driver installation was successful , then we can continue with uploading the code.

If driver is not found ,you can manually download and install driver from given Link (For CP2102 USB TO TTL Adapater)

Download Link : https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers

Program

we are going to write a small program to blink the inbuilt led in Arduino IDE

void setup() {
pinMode(PC13, OUTPUT);
}
void loop() {
digitalWrite(PC13, HIGH);
delay(100);
digitalWrite(PC13, LOW);
delay(100);
}
  • Copy the program the above program
  • Paste it to ide and Save it
  • Click on Tools>>Board>>STM32F1 Boards(Arduino_STM32)>>Generic STM32F103C series
  • Click on Tools>>Variant>>STM32F103CB(20k RAM,128k Flash)
  • Click on Tools>>Upload method>>Serial
  • Click on Tools>>Port>>COM* (Instead of COM3 select the port that is showing up) , If Port is greyed no COM* is showing check above “For Windows users “
  • Click on Verify
RESET Button
  • Beforing uploading the program , press on RESET Button on STM32
  • Click on Upload
Normal Mode
  • Change the position of jumper of BOOT0 to 0

OUTPUT

--

--

PAUL SABU

Loves To Play with MicroControllers , Hardware Enthusiast