Designing your own STM32F103 PCB gives you full control over hardware — compact, power-efficient, and ready for production.
This complete guide walks through how to design and flash your custom STM32F103 board, finishing with an LED blink test using STM32CubeIDE and ST-Link V2.

Required Tools and Components

Hardware

  • STM32F103C8T6 (LQFP48 package)
  • 8 MHz crystal + 20pF capacitors
  • 3.3V regulator (RT9193-33GB or AMS1117-3.3)
  • LED + 330Ω resistor
  • 10kΩ resistors (BOOT0, RESET)
  • SWD 4-pin header
  • Breadboard wires or PCB connectors
  • ST-Link V2 programmer
  • USB-to-UART module (CH340, CP2102, or FTDI)
  • Multimeter, soldering tools, USB cable

Software

Step 1: Design the Core STM32F103 Circuit

The minimum working system for STM32F103 includes:

FunctionPin(s)Description
PowerVDD, VDDA+3.3V from regulator
GroundVSS, VSSACommon ground
ClockOSC_IN, OSC_OUT8MHz crystal + capacitors
ResetNRST10kΩ pull-up + reset button
BootBOOT0Jumper to GND (Flash) / 3.3V (Bootloader)
SWDPA13, PA14Programming via ST-Link
LEDPC13User LED
UARTPA9 (TX), PA10 (RX)Debug communication

Step 2: Power Supply and Voltage Regulation

Use RT9193-33GB LDO regulator (as in your circuit):

  • Input: 5V (from DC adapter)
  • Output: Stable 3.3V
  • Capacitors:
    • Input: 1µF
    • Output: 10µF
  • Connect 3.3V to all VDD and VDDA pins
  • Connect GND to all ground pins and planes

Step 3: Add Programming Debug Interfaces

Add a 4-pin header to connect the ST-Link V2:

PinSignalDescription
13.3VPower reference
2SWDIOSerial Wire Data
3SWCLKSerial Wire Clock
4GNDGround

BOOT0 should be tied to GND for normal operation.
Keep the SWDIO and SWCLK traces short (under 5 cm).


UART (Debugging)

Add a 3-pin header for UART communication:

PinSignalDescription
1TX (PA9)Connect to USB-UART RX
2RX (PA10)Connect to USB-UART TX
3GNDGround common

You can connect this header to a USB-to-UART adapter (like CH340 or FTDI) for serial debugging in tools like PuTTY or Tera Term.

Step 4: PCB Layout Guidelines

  • Keep the crystal and capacitors close to the MCU pins
  • Place decoupling capacitors near every VDD pin
  • Maintain a solid GND plane on the bottom layer
  • Keep SWD and UART headers accessible on the board edge
  • Place BOOT0 jumper and RESET button in easy reach
  • Route TX/RX traces short and avoid noisy areas

Recommended Components

  • MCU: STM32F103C8T6 (LQFP48)
  • Crystal: 8MHz ±20ppm
  • Regulator: RT9193-33GB
  • Capacitors: 0.1µF × 4, 1µF × 1, 10µF × 1
  • Resistors: 10kΩ (Reset, Boot0), 330Ω (LED)

Step 5: Generate Gerber Files

When your schematic and layout are done:

  1. Run DRC (Design Rule Check)
  2. Generate Gerber files (Top/Bottom Copper, Silkscreen, Solder Mask, Drill)
  3. Export BOM (Bill of Materials)
  4. Upload to a PCB manufacturer such as:

Step 6: Flashing Firmware (LED Blink)

Open STM32CubeIDE → Create new STM32 project (STM32F103C8Tx) → Enable:

  • PC13 as GPIO Output (LED)
  • PA9 / PA10 as USART1 TX/RX (Asynchronous Mode, 9600 baud)

Replace main.c with this code:

#include "main.h"
#include "usart.h"
#include "gpio.h"
#include <stdio.h>

int _write(int file, char *ptr, int len) {
  HAL_UART_Transmit(&huart1, (uint8_t*)ptr, len, HAL_MAX_DELAY);
  return len;
}

int main(void)
{
  HAL_Init();
  SystemClock_Config();
  MX_GPIO_Init();
  MX_USART1_UART_Init();

  printf("STM32F103 Custom PCB Initialized\r\n");

  while (1)
  {
    HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
    printf("LED toggled\r\n");
    HAL_Delay(1000);
  }
}

You can view UART output by opening a serial terminal (115200 baud, 8-N-1).


Step 7: Build and Upload

  1. Connect ST-Link and power up your board
  2. Click Run ▶ in STM32CubeIDE
  3. STM32CubeProgrammer flashes the firmware automatically
  4. Open your UART terminal — you should see:
STM32F103 Custom PCB Initialized
LED toggled
LED toggled

And your LED on PC13 blinks every 1 second 🎉


Troubleshooting

IssueCheck
Flashing failedVerify SWD connection and 3.3V power
No UART outputCheck TX/RX orientation and baud rate
LED not blinkingVerify PC13 LED connection
MCU not detectedEnsure BOOT0 = GND and RESET high
No 3.3VInspect regulator (RT9193) and input voltage

Step 8: Final Notes

You now have:

  • A custom STM32F103 PCB
  • ST-Link SWD programming interface
  • UART debug capability (PA9/PA10)
  • Working LED blink firmware

This foundation allows expansion to:

  • I²C, SPI, and ADC sensors
  • LoRa, BLE, or Wi-Fi modules
  • Battery power and deep-sleep IoT designs

Project files on GitHub:
All design files, source code, and firmware for this custom STM32F103 PCB are available at the GitHub repository: github.com/Haipk001/Custom-STM32F1
Please make sure to download the latest files from the “Circuit” and “Core” folders before building or programming the board.