KevinOConnor/can2040
FreeSoftware CAN bus implementation for rp2040 micro-controllers
FreeFree tier
About KevinOConnor/can2040
The can2040 project is a software implementation of a CAN bus controller for Raspberry Pi RP2040 and RP2350 microcontrollers. It enables these chips to communicate over a CAN bus using a standard external CAN transceiver chip, supporting reading and writing of CAN 2.0B data frames at rates up to 1 Mbit/s. The code is written primarily in C and is released under the GPL-3.0 license. The repository includes a programmer API, testing and deployment tools, and internal documentation for developers. It is part of the uhub/awesome-c collection and has an active community with over 850 stars.
Key Features
Software CAN bus implementation for RP2040 and RP2350 microcontrollers
Uses standard CAN transceiver chips for physical layer
Supports CAN 2.0B data frames at data rates up to 1 Mbit/s
Open source under GPL-3.0 license
Written primarily in C with Python-based tools and scripts
Provides a programmer API for integration into projects
Includes testing and deployment tools (e.g., can2040tools)
Pros & Cons
Pros
- Eliminates need for dedicated hardware CAN controller, reducing BOM cost
- Supports high-speed communication up to 1 Mbps
- Compatible with both RP2040 and RP2350 microcontrollers
- Fully open source with permissive (GPL-3.0) license
- Well-documented with separate sections for features, API, and internals
- Active community with 857 stars and 89 forks on GitHub
Cons
- Software implementation may have higher CPU overhead than hardware CAN controllers
- Limited to RP2040 and RP2350 platforms
- No support for CAN FD (only CAN 2.0B)
- Requires external CAN transceiver chip and correct pin configuration
Best For
Embedded systems communication over CAN busReal-time control applications in automotive and industrial settingsReplacing or augmenting hardware CAN controllers on RP2040/RP2350CAN bus data logging, monitoring, and diagnosticsPrototyping CAN-based IoT devices with low-cost microcontrollers
FAQ
What is can2040?
can2040 is a software implementation of a CAN bus controller for Raspberry Pi RP2040 and RP2350 microcontrollers. It allows these chips to communicate over a CAN bus using a standard CAN transceiver.
Which microcontrollers does it support?
It supports the Raspberry Pi RP2040 and the newer RP2350 microcontrollers.
What CAN standards does it support?
It supports CAN 2.0B data frames. CAN FD is not supported.
What is the maximum data rate?
It supports data rates up to 1 Mbit per second.
What license is used?
The project is licensed under the GPL-3.0 license.
How can I get started?
The repository includes documentation on features, an API reference, and tools for testing and deployment. See the README and linked pages for details.