STM32F103C8T6: Cheap Gateway to Bare Metal Embedded System Programming

Kunal Salvi
3 min readFeb 2, 2020

--

STM32F103C8T6 has served as a gateway to bare metal programming for embedded systems. Packed with important peripherals, writing drivers for them in Embedded C pushes the user to explore their coding skills and adds an element of thrill. The Coretex-M3 development board, also known as “Blue Pill”, can be bought cheaply from Aliexpress for about $3.

Fig 1: STM32F103C8T6 Development Board

The chip includes the following peripherals:

STM32F103C8T6 has an ARM® Cortex®-M3 32-bit RISC core operating at a 72 MHz frequency, high speed embedded memories and extensive range of I/Os. Onboard 8 MHz oscillator is the heart of the dev board and this clock can be multiplied by using internal PLL to reach the max operating frequency of 72 MHz. The chip includes 64 Kbytes of Flash and 20 Kbytes of SRAM.

The chip contains hardware implementation of the CRC ( Cyclic Redundancy Check ) unit with a fixed generator polynomial. A Nested Vector Interrupt Controller ( NVIC ) is embedded which can handle up to 43 maskable interrupt channels and 16 priority levels. External Interrupt/Event Controller ( EXTI ) consists of 19 edge detector lines used to generate interrupt/event requests. Interrupt/Event lines can be independently configured and masked. GPIOs can be configured individually by software and are multiplexed to serve digital or analog applications with the maximum toggling speed of 18 MHz. Two12-bit ADCs are embedded with 10 available channels and a sampling frequency of 1 us. The chip supports 3 low power modes: Sleep, Stop, and Standby to achieve the best low -power operation. The DMA controller embedded in the MCU has 7-channels which can manage memory-to-memory, peripheral-to-memory, and memory-to-peripheral transfers. The DMA controller also supports a circular buffer manager to avoid triggering interrupts when the transmission is completed. It can be used with all the main peripherals such as SPI, I²C, USART, GPIOs, Timers, USB, and ADC. RTC embedded in the chip provides a set of continuously running counters with suitable software that can provide a clock calendar, alarm, and periodic interrupt.

Debugging and uploading the code is done by the ST-Link V2 Programmer which can be again bought on Aliexpress.

Fig 3: ST-Link V2 Programmer

In the upcoming series, the communication protocols and peripherals will be explored in-depth and the code for drivers will be provided.

--

--

Kunal Salvi
Kunal Salvi

Written by Kunal Salvi

Embedded Systems Engineer | Roboticist | Researcher | Innovator

No responses yet