Skip to content

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STM32 Bare-Metal Firmware & Driver Development

Welcome to this repository for bare-metal firmware development on STM32 (Cortex-M) microcontrollers. This project focuses on writing low-level drivers from scratch by directly manipulating registers and utilizing hardware structures without relying on HAL.


Repository Contents & Features

The project is structured into progressive modules, moving from basic register manipulation to advanced interrupt-driven applications:

Core & Foundations

  • chip_headers/CMSIS: Core Cortex-M hardware abstraction and register definitions.
  • 0_led_toggle_addr & 1_led_toggle_addr_struct: Introduction to memory-mapped I/O and register structures.

General Purpose I/O (GPIO)

  • 2_gpio_output & 3_gpio_bsrr: Configuring pins as outputs using standard registers.
  • 4_gpio_input: Reading digital input signals.

Universal Asynchronous Receiver-Transmitter (UART)

  • 5_uart_tx & 8_uart_rx: Basic polling-based serial transmission and reception.
  • 6_uart_printf: Retargeting the standard printf() function to output over UART for easier debugging.
  • 7_uart_modular: Clean, modular driver structure separating UART initialization and logic.
  • 16_uart_rx_interrupt: Non-blocking asynchronous data reception using interrupts.

Analog-to-Digital Converter (ADC)

  • 9_adc_single_conversion: Sampling an analog signal once on demand.
  • 10_adc_continous_conversion: Continuous sampling modes for real-time signals.
  • 17_adc_interrupt: Handling ADC conversion completions asynchronously.

Timers & System Tick (SysTick)

  • 11_systick_delay & 18_systick_interrupt: ARM Cortex-M internal system tick timer for precise delays.
  • 12_timers: Configuring hardware general-purpose timers.
  • 13_OutputCompare & 14_InputCapture: Generating waveforms (PWM) and measuring external signal frequencies/pulse widths.
  • 19_timers_interrupt & tim2_interrupt: Working with periodic timer-overflow interrupts.

Interrupt Handling (15_InputInterrupt)

  • Using the Nested Vectored Interrupt Controller (NVIC) to manage external and internal peripheral triggers.

Hardware Verification

  • docs/: Relevant technical documentation, reference manuals, and datasheets.
  • logic analyzer outputs/: Saved waveforms and timing captures verifying that the protocols (UART, Timers, PWM) match physical hardware specifications exactly.

Tools & Environment

  • Language: Embedded C
  • Target Architecture: ARM Cortex-M4 (STM32)
  • Development Flow: Direct register-level access (No HAL)

About

A comprehensive collection of bare-metal C drivers and firmware examples for STM32 (Cortex-M) microcontrollers. Covers GPIO, UART, ADC, Timers, and Interrupt handling.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages