The STM32F4 family (Cortex-M4F, up to 180MHz, up to 2MB flash) is the workhorse of embedded development. The Rust HAL (stm32f4xx-hal) provides safe peripheral drivers built on top of the PAC (Peripheral Access Crate) generated from the SVD file.
PAC vs HAL:
- PAC: generated register access.
dp.GPIOA.moder.modify(|_, w| w.moder5().output()). Safe from race conditions, but raw. - HAL: ergonomic abstractions.
let led = gpioa.pa5.into_push_pull_output(). Implementsembedded-haltraits for portability.
embedded-hal traits: The key abstraction layer. Your driver crate takes impl SpiDevice or impl I2c, not a concrete type. The same driver works on STM32F4, RP2040, ESP32 — anything with an embedded-hal impl. SpaceCAN's CAN driver is written against bxcan (the STM32 bxCAN peripheral crate), which sits alongside the HAL.
DMA: The STM32F4 has a DMA controller that can transfer data between peripherals and memory without CPU involvement. For high-throughput protocols (UART at 1Mbaud, SPI at 10MHz), DMA is not optional — interrupt-driven transfer at those speeds consumes too many cycles. Using DMA from safe Rust requires careful lifetime management (the DMA must not outlive the buffer) — stm32f4xx-hal's DMA API encodes this in the type system.