How to Set Up an STM32 Blue Pill with ST-Link and the Arduino IDE

The STM32 Blue Pill gives you a fast Cortex-M3 microcontroller for the price of a basic Arduino clone, but the first upload trips up a lot of people because the board ships without a friendly USB bootloader. If you would rather skip the trial and error, Compoden's AI build assistant can take a plain-English description of your project, recommend the Blue Pill and an ST-Link programmer, and ship you a kit with the parts and a tested starting sketch. This guide walks through doing it by hand so you understand each step.

What you need

You will need an STM32 Blue Pill (F103C8T6), an ST-Link V2 USB programmer, four female-to-female jumper wires, and a computer with the Arduino IDE installed. The Blue Pill has a 4-pin SWD header on the short edge of the board: VCC (3.3V), GND, SWCLK, and SWDIO. These are the only pins you need for flashing.

Install the STM32 board package

Open the Arduino IDE and go to File, then Preferences. In the "Additional boards manager URLs" field, paste the official STM32 index: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json. Click OK, then open Tools, Board, Boards Manager. Search for "STM32 MCU based boards" and install the STMicroelectronics package (the Arduino_Core_STM32 core). This downloads the toolchain and upload tools you need.

Install ST-Link drivers and tools

Download and install STM32CubeProgrammer from the ST website. It includes the ST-Link USB driver on Windows. Once installed, plug your ST-Link V2 into a USB port; Windows should recognise it. You can open STM32CubeProgrammer and click Connect to confirm the dongle talks to your computer before wiring anything.

Wire the ST-Link to the Blue Pill

With both devices unplugged, connect four wires: ST-Link 3.3V to Blue Pill 3.3V, ST-Link GND to GND, ST-Link SWCLK to SWCLK, and ST-Link SWDIO to SWDIO. Double-check the labels printed on both connectors, since pin order varies between ST-Link clones. Now plug the ST-Link into USB, which powers the Blue Pill through the SWD header.

Select the board and upload

In the Arduino IDE, go to Tools and set Board to "Generic STM32F1 series", Board part number to "BluePill F103C8", and Upload method to "STM32CubeProgrammer (SWD)". You do not select a COM port for SWD uploads. Open File, Examples, Basics, Blink. Change the LED pin to PC13, which is the onboard LED on most Blue Pills. Click Upload. The IDE compiles, then STM32CubeProgrammer flashes the board over SWD. The PC13 LED should start blinking within a few seconds.

If the upload fails

The most common issue is a worn jumper labelled BOOT0. For SWD flashing it should sit at 0 (the position closer to the board edge). If CubeProgrammer cannot connect, try the "Connect under reset" mode, or briefly hold the reset button while uploading. A loose 3.3V wire is the next most common cause, so reseat all four connections.

Build it with Compoden's AI

If you tell Compoden's AI build assistant what you are building, say a data logger or a small motor controller, it maps your description to a parts list around the Blue Pill, suggests the right ST-Link and any sensors or drivers, generates wiring notes, and produces starter code that already targets PC13 and the STM32 core. The matching kit ships to your address in India, so you spend your time on the project rather than on board setup.

Ready to start? Describe your build to Compoden's AI assistant and get a Blue Pill kit that is wired and coded for your idea. Browse the STM32 Blue Pill and ST-Link V2 to get going.

FAQ

Can I program the Blue Pill over USB instead of ST-Link? Yes, but only after you flash a USB bootloader, which itself needs an ST-Link or a USB-to-serial adapter. Using ST-Link directly is the most reliable first method.

Why is PC13 the LED pin? The onboard LED on the standard Blue Pill is wired to GPIO PC13, so example sketches must reference that pin rather than the Arduino number 13.

Does the board run at 5V? No. The STM32F103 core is a 3.3V device. Power and signal the SWD header at 3.3V, and never feed 5V into a GPIO pin.

Back to blog