STM32F103C6 (ARM Cortex-M3) embedded systems labs — from GPIO fundamentals to interrupt-driven scheduling and UART protocols.
This repository consolidates the five labs of the Microprocessors & Microcontrollers course (C03010) into a single monorepo. Each lab builds on the previous one, progressing from basic GPIO output to a structured cooperative scheduler and a UART command-response protocol — all implemented on the STM32F103C6 using the HAL library and verified through Proteus simulation.
Every lab folder was merged from its original standalone repository with full commit history preserved (git subtree).
| Category | Tooling |
|---|---|
| Microcontroller | STM32F103C6 (ARM Cortex-M3, 72 MHz) |
| Framework | STM32 HAL Library |
| IDE / Toolchain | STM32CubeIDE |
| Simulation | Proteus Design Suite 8 |
| Language | C |
| # | Lab | Topic | Key Concepts |
|---|---|---|---|
| 1 | led-animation |
GPIO output & LED control | GPIO, traffic-light FSM, 7-segment driver, 12-LED analog clock |
| 2 | timer-interrupt-and-led-scanning |
Timer interrupts & display scanning | TIM2/TIM3 interrupts, 7-seg multiplexing, software timers, 8×8 LED matrix |
| 3 | buttons-switches |
Button input & FSM | Finite state machine, software debouncing, modular architecture, real-time configuration |
| 4 | cooperative-scheduler |
Cooperative task scheduling | Function-pointer task table, periodic/one-shot tasks, single-timer scheduling |
| 5 | flow-and-error-control |
UART communication protocol | USART, ADC, command-parser FSM, request-response with retry/timeout |
GPIO output fundamentals on the STM32F103C6. Exercises progress from basic LED blinking through traffic-light sequencing and a 7-segment display driver, culminating in a full analog clock rendered on 12 LEDs (hours, minutes, seconds).
Replaces blocking HAL_Delay() with hardware timer interrupts (TIM2/TIM3). Covers multiplexed 7-segment displays, a software-timer abstraction, a digital clock with button adjustment, and an 8×8 LED matrix shift animation — all running concurrently under interrupt-driven scheduling.
A configurable 2-way traffic light system built on a Finite State Machine. Modular codebase (input reading, input processing, display, timing) with hardware debouncing and real-time duration adjustment via three push buttons across four operating modes.
A lightweight cooperative task scheduler that replaces ad-hoc timer-flag polling. Tasks are registered in a function-pointer table with configurable delay and period, then dispatched from a single timer tick — the foundation of an RTOS-style scheduling model.
A UART command-response protocol between PC and MCU. The STM32 reads an ADC sensor value and replies over USART using a framed message format (!RST# → !ADC=<value># → !OK#), driven by two cooperating FSMs — one for command parsing, one for flow control with retry/timeout handling.
.
├── led-animation/ # Lab 1 — GPIO & LED control
├── timer-interrupt-and-led-scanning/ # Lab 2 — Timer interrupts & display scanning
├── buttons-switches/ # Lab 3 — Button input & FSM
├── cooperative-scheduler/ # Lab 4 — Cooperative task scheduler
└── flow-and-error-control/ # Lab 5 — UART communication protocol
Each lab directory contains its own README.md with a detailed exercise breakdown, plus the C source, pre-compiled .hex firmware, and the Proteus project (.pdsprj) for simulation.
- Open the target lab's
.pdsprjfile in Proteus 8. - Confirm the STM32F103C6 program property points to the matching
.hexfile. - Run the simulation (▶) and interact via the on-screen buttons / virtual terminal.
To rebuild from source, import the .c files into an STM32CubeIDE project targeting the STM32F103C6 and compile with the HAL library.
Coursework developed for educational purposes at HCMUT. Free to reference and learn from.