← back to projects
flagship project

rust-spacecan

language: Rust · no_stdhardware: STM32F4 · Cortex-M4status: Active development

motivation

I got interested in spacecraft communication protocols through reading about CubeSat missions. The problem was clear: real satellites need CAN bus communication following ECSS standards, and there was no production-quality Rust implementation.

what it does

A complete no_std SpaceCAN protocol stack — CAN frame encoding/decoding, five ECSS service layers (TC verification ST01, housekeeping ST03, function management ST08, connection test ST17, onboard storage ST20), and a bus abstraction trait that works identically on real STM32 hardware and Renode simulation.

technical detail

The key architectural decision was the bus abstraction trait. Instead of writing separate code paths for hardware and simulation with #[cfg(test)] everywhere, I defined a CanBus trait that both the STM32 bxCAN driver and the mock transport implement. The same protocol logic runs in CI on Renode and on silicon — zero divergence.

system architecture

spacecraft firmware (host application)
Application / Mission Software
↓ embedded-hal traits
spacecan — no_std library crate
Frame Layer
encode / decode
Service Layer
ST01 ST03 ST08 ST17 ST20
Bus Abstraction Trait
↓           ↓
STM32F4 bxCAN
(real hardware)
Mock transport
(Renode / CI)

technology used

Rust
no_std / no alloc
embedded-hal traits
bxCAN peripheral
ECSS PUS-C standard
Renode simulation
STM32F4Discovery
RTIC v1