An embedded system is not just a CPU; it is a memory-mapped architecture. Everything in the STM32F103 is accessed via memory addresses.
| Address Range | Function | Purpose |
| :--- | :--- | :--- |
| 0x0000 0000 | Code/Flash | Program code and constants. |
| 0x2000 0000 | SRAM | Stack, heap, variables. |
| 0x4000 0000 | Peripherals (APB1) | Lower-speed buses (USART2, I2C1) |
| 0x4001 0000 | Peripherals (APB2) | High-speed buses (GPIO, ADC, SPI1) |
To turn on an LED, you don't call a function like digitalWrite() (unless you use a library). You write a 32-bit value to a specific address. For example, to set PA5 high on GPIO Port A:
*(volatile uint32_t*)0x40010810 |= (1 << 5); // Set BSRR register
This direct memory access is why C (not C++ or Python) is the lingua franca of embedded systems. It gives you raw pointer control over the hardware. the stm32f103 arm microcontroller and embedded systems work
#include "stm32f1xx_hal.h"void main(void) HAL_Init(); __HAL_RCC_GPIOC_CLK_ENABLE(); GPIO_InitTypeDef gpio = GPIO_PIN_13, GPIO_MODE_OUTPUT_PP, GPIO_PULLUP, GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOC, &gpio);
while(1) HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13); HAL_Delay(500);
// Single conversion on channel 0 (PA0)
ADC1->SQR3 = 0; // Select channel 0
ADC1->CR2 |= (1 << 22); // Start conversion
while(!(ADC1->SR & (1 << 1))); // Wait for EOC
uint16_t value = ADC1->DR;
Example EXTI0 (PA0):
void EXTI0_IRQHandler(void)
if(EXTI_GetITStatus(EXTI_Line0))
// Handle interrupt
EXTI_ClearITPendingBit(EXTI_Line0);
Given newer, faster, cheaper chips exist (e.g., ESP32, RP2040), why does the STM32F103 remain the educational and industrial standard?
| Feature | Details | |---------|---------| | Core | ARM Cortex-M3 (32-bit) | | Max Frequency | 72 MHz | | Flash Memory | 64 KB (up to 128 KB on some variants) | | SRAM | 20 KB | | Operating Voltage | 2.0V – 3.6V | | I/O Pins | Up to 80 (depending on package) | | Timers | 2x 16-bit basic, 2x watchdog, 1x SysTick | | Advanced Timers | 2x 16-bit with PWM & dead-time generation | | ADCs | 2x 12-bit, 16 channels total | | Communication | 2x I2C, 3x USART, 2x SPI, 1x CAN, 1x USB 2.0 FS | | DMA | 7-channel controller | An embedded system is not just a CPU;
The STM32F103 ARM Cortex-M3 microcontroller exemplifies how a modern 32-bit MCU enables efficient embedded systems work. Its balanced architecture—combining a high-performance core, flexible memory, rich peripherals, and low power consumption—makes it a workhorse for applications ranging from motor control and sensor hubs to consumer electronics and IoT edge nodes. By mastering the STM32F103, engineers not only learn a specific chip but also gain a deep understanding of ARM-based embedded design, interrupt-driven real-time programming, and hardware-software co-design. As embedded systems continue to proliferate in smart devices, the principles exemplified by the STM32F103 remain foundational.
This is the definitive "academic bible" for the STM32F103, offering unparalleled depth in low-level programming, though it may feel dense for hobbyists seeking quick high-level projects.