can-bootloader logo

can-bootloader

Free

The bootloader used to flash our CAN-connected boards

FreeFree tier
Type
Open Source
Company
CVRA

About can-bootloader

This repository contains the code for a bootloader running on every microcontroller in CVRA's robots. It allows firmware updates over a CAN bus network on up to 20 boards without disassembly or additional electrical connections. The bootloader uses dual configuration pages with CRC32 redundancy to prevent bricking, supports multicast write commands for efficient bandwidth usage, and includes safety features such as device class checking and application CRC validation. Performance estimates show flashing a 1 MB binary takes about 20 seconds per board over a 1 Mb/s CAN bus.

Key Features

Dual redundant configuration pages with CRC32 validation
CAN bus protocol for firmware updates
Multicast write commands to reduce bandwidth usage
Safety features: never erases itself, device class matching, application CRC check
Fast updates: approximately 20 seconds per board for 1 MB firmware
Configurable node ID, board name, device class, and update count

Pros & Cons

Pros
  • Enables fast, simultaneous firmware updates over CAN bus
  • Redundant config pages prevent bricking from corrupted configuration
  • Safety checks prevent writing wrong firmware to a board
  • Protocol is designed for multi-board systems (up to 127 nodes)
  • Open source and freely available
Cons
  • Limited to CAN bus communication (not generic over other protocols)
  • Tied to the CVRA robotics ecosystem and may require adaptation for other projects
  • Manual hardware setup (CAN transceivers) required
  • Performance depends on CAN bus speed and binary size

Best For

Updating firmware on multiple CAN-connected microcontroller boards in robotsOver-the-wire firmware updates without physical access or disassemblyFlashing identical firmware to many boards simultaneously using multicast

FAQ

How does the bootloader prevent bricking a board?
It uses two redundant configuration pages checked by CRC32. If one page is invalid, the bootloader replaces it with the other. It also never erases itself or its configuration page and validates the device class before writing.
How fast is the firmware update process?
At 1 Mb/s CAN speed with about 50% overhead and 10% protocol overhead, a 1 MB binary can be flashed in approximately 20 seconds per board. If all boards run the same firmware, multicast can achieve a full system update in about the same time.