Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use STM32F103: Examples, Pinouts, and Specs

Image of STM32F103
Cirkit Designer LogoDesign with STM32F103 in Cirkit Designer

Introduction

The STM32F103 is a 32-bit microcontroller developed by STMicroelectronics, based on the ARM Cortex-M3 core. It is renowned for its low power consumption, high performance, and a rich set of peripherals, making it a versatile choice for embedded systems and IoT applications. The STM32F103 is part of the STM32 family and is available in various configurations to suit different project requirements.

Explore Projects Built with STM32F103

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
STM32F103C8T6 Battery-Powered LED Indicator Circuit
Image of Assigment.2: A project utilizing STM32F103 in a practical application
This circuit features an STM32F103C8T6 microcontroller powered by a 3.3V battery, which controls a red LED. The LED is connected to pin A1 of the microcontroller through a 10-ohm resistor to limit the current.
Cirkit Designer LogoOpen Project in Cirkit Designer
Solar-Powered STM32-Based Automation System with Matrix Keypad and RTC
Image of soloar cleaner : A project utilizing STM32F103 in a practical application
This circuit features an STM32F103C8T6 microcontroller interfaced with a membrane matrix keypad for input, an RTC DS3231 for real-time clock functionality, and a 16x2 I2C LCD for display. It controls four 12V geared motors through two MD20 CYTRON motor drivers, with the motor power supplied by a 12V battery regulated by a buck converter. The battery is charged via a solar panel connected through a solar charge controller, ensuring a renewable energy source for the system.
Cirkit Designer LogoOpen Project in Cirkit Designer
STM32F103C8T6-Based Spectral Sensor with ST7735S Display and Pushbutton Control
Image of ColorSensor: A project utilizing STM32F103 in a practical application
This circuit features an STM32F103C8T6 microcontroller interfaced with a China ST7735S 160x128 display and two spectral sensors (Adafruit AS7262 and AS7261). It also includes two pushbuttons for user input, with the microcontroller managing the display and sensor data processing.
Cirkit Designer LogoOpen Project in Cirkit Designer
STM32F103C8T6 Microcontroller-Based Motor Control System with RS485 Communication
Image of ROBOCON_TASK 1 SCHME DIAGRAM: A project utilizing STM32F103 in a practical application
This circuit is designed to control LEDs, a DC motor, and a servo motor using an STM32F103C8T6 microcontroller. It includes a motor driver for the DC motor, a voltage regulator for stable power supply, and an RS485 to USB converter for communication. User inputs can be provided through pushbuttons, and a potentiometer allows for variable analog input.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with STM32F103

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Assigment.2: A project utilizing STM32F103 in a practical application
STM32F103C8T6 Battery-Powered LED Indicator Circuit
This circuit features an STM32F103C8T6 microcontroller powered by a 3.3V battery, which controls a red LED. The LED is connected to pin A1 of the microcontroller through a 10-ohm resistor to limit the current.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of soloar cleaner : A project utilizing STM32F103 in a practical application
Solar-Powered STM32-Based Automation System with Matrix Keypad and RTC
This circuit features an STM32F103C8T6 microcontroller interfaced with a membrane matrix keypad for input, an RTC DS3231 for real-time clock functionality, and a 16x2 I2C LCD for display. It controls four 12V geared motors through two MD20 CYTRON motor drivers, with the motor power supplied by a 12V battery regulated by a buck converter. The battery is charged via a solar panel connected through a solar charge controller, ensuring a renewable energy source for the system.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of ColorSensor: A project utilizing STM32F103 in a practical application
STM32F103C8T6-Based Spectral Sensor with ST7735S Display and Pushbutton Control
This circuit features an STM32F103C8T6 microcontroller interfaced with a China ST7735S 160x128 display and two spectral sensors (Adafruit AS7262 and AS7261). It also includes two pushbuttons for user input, with the microcontroller managing the display and sensor data processing.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of ROBOCON_TASK 1 SCHME DIAGRAM: A project utilizing STM32F103 in a practical application
STM32F103C8T6 Microcontroller-Based Motor Control System with RS485 Communication
This circuit is designed to control LEDs, a DC motor, and a servo motor using an STM32F103C8T6 microcontroller. It includes a motor driver for the DC motor, a voltage regulator for stable power supply, and an RS485 to USB converter for communication. User inputs can be provided through pushbuttons, and a potentiometer allows for variable analog input.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Industrial automation and control systems
  • IoT devices and smart home applications
  • Consumer electronics
  • Robotics and motor control
  • Medical devices
  • Data acquisition systems

Technical Specifications

The STM32F103 microcontroller is available in multiple variants, such as STM32F103C8, STM32F103RB, etc., with slight differences in memory and pin count. Below are the general technical specifications:

Feature Details
Core ARM Cortex-M3, 32-bit RISC architecture
Operating Frequency Up to 72 MHz
Flash Memory 16 KB to 1 MB (depending on the variant)
SRAM 6 KB to 96 KB (depending on the variant)
GPIO Pins Up to 80 GPIOs (depending on the package)
Communication Interfaces USART, SPI, I2C, CAN, USB 2.0 FS, and more
Timers 16-bit and 32-bit timers, PWM support
ADC 12-bit ADC with up to 16 channels
DAC 12-bit DAC (available on some variants)
Operating Voltage 2.0V to 3.6V
Power Consumption Low-power modes available (Sleep, Stop, and Standby)
Temperature Range -40°C to +85°C (industrial grade)
Packages LQFP, TQFP, QFN, and others

Pin Configuration and Descriptions

The STM32F103 is available in different packages, such as 48-pin, 64-pin, and 100-pin variants. Below is an example pinout for the STM32F103C8T6 (48-pin package):

Pin Number Pin Name Function
1 VDD Power supply (3.3V)
2 VDDA Analog power supply
3 PA0 GPIO, ADC_IN0, TIM2_CH1
4 PA1 GPIO, ADC_IN1, TIM2_CH2
5 PA2 GPIO, USART2_TX, TIM2_CH3
6 PA3 GPIO, USART2_RX, TIM2_CH4
... ... ...
48 VSS Ground

Refer to the official datasheet for the complete pinout of your specific STM32F103 variant.

Usage Instructions

How to Use the STM32F103 in a Circuit

  1. Power Supply: Provide a stable 3.3V power supply to the VDD and VDDA pins. Ensure proper decoupling capacitors (e.g., 0.1 µF and 10 µF) are placed close to the power pins.
  2. Clock Configuration: Connect an external crystal oscillator (e.g., 8 MHz) to the OSC_IN and OSC_OUT pins for accurate clocking. Alternatively, use the internal RC oscillator.
  3. Programming: Use an ST-Link programmer/debugger to upload firmware via the SWD (Serial Wire Debug) interface.
  4. Reset Circuit: Connect a pull-up resistor (e.g., 10 kΩ) to the NRST pin for proper reset functionality.
  5. Peripherals: Configure GPIOs, communication interfaces (USART, SPI, I2C), and other peripherals as needed in your application.

Important Considerations and Best Practices

  • Voltage Levels: Ensure all input signals are within the 3.3V logic level range to avoid damage.
  • Decoupling: Use decoupling capacitors near power pins to reduce noise and improve stability.
  • Boot Modes: Configure the BOOT0 and BOOT1 pins to select the desired boot mode (e.g., boot from Flash, SRAM, or system memory).
  • Debugging: Use the SWD interface for debugging and firmware updates.
  • Low Power Modes: Utilize the Sleep, Stop, and Standby modes to reduce power consumption in battery-powered applications.

Example Code for STM32F103 with Arduino IDE

The STM32F103 can be programmed using the Arduino IDE with the STM32duino core. Below is an example code to blink an LED connected to pin PA5:

// Include the STM32 HAL library
#include <Arduino.h>

// Define the LED pin
#define LED_PIN PA5

void setup() {
  pinMode(LED_PIN, OUTPUT); // Set PA5 as an output pin
}

void loop() {
  digitalWrite(LED_PIN, HIGH); // Turn the LED on
  delay(500);                 // Wait for 500 milliseconds
  digitalWrite(LED_PIN, LOW);  // Turn the LED off
  delay(500);                 // Wait for 500 milliseconds
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. Microcontroller Not Responding

    • Cause: Incorrect power supply or missing decoupling capacitors.
    • Solution: Verify the power supply voltage (3.3V) and ensure proper decoupling capacitors are in place.
  2. Unable to Program the Microcontroller

    • Cause: Incorrect BOOT pin configuration or faulty ST-Link connection.
    • Solution: Ensure BOOT0 is set to 0 (boot from Flash) and check the SWD connections.
  3. Peripherals Not Working

    • Cause: Incorrect pin configuration or missing initialization in the code.
    • Solution: Double-check the pin assignments and ensure all peripherals are properly initialized in the firmware.
  4. High Power Consumption

    • Cause: Microcontroller not entering low-power modes.
    • Solution: Implement Sleep, Stop, or Standby modes in the firmware to reduce power consumption.

FAQs

Q: Can I use the STM32F103 with 5V logic devices?
A: No, the STM32F103 operates at 3.3V logic levels. Use level shifters to interface with 5V devices.

Q: How do I select the correct STM32F103 variant for my project?
A: Consider factors such as required Flash memory, SRAM, GPIO count, and package size when selecting a variant.

Q: Can I program the STM32F103 without an ST-Link?
A: Yes, you can use the built-in bootloader to program the microcontroller via USART or USB (if supported).

Q: What is the maximum clock speed of the STM32F103?
A: The STM32F103 can operate at a maximum clock speed of 72 MHz.

For more detailed information, refer to the official STM32F103 datasheet and reference manual.