Skip to content

Instantly share code, notes, and snippets.

@jackm
Last active November 7, 2024 11:54
Show Gist options
  • Save jackm/f33d6e3a023bfcc680ec3bfa7076e696 to your computer and use it in GitHub Desktop.
Save jackm/f33d6e3a023bfcc680ec3bfa7076e696 to your computer and use it in GitHub Desktop.
Collection of CAN bus packages and tools

Collection of CAN bus packages and tools

This document assumes the use of Linux as the chosen development platform. Items in bold are highly recommended.

It is recommended to use SocketCAN when working with CAN bus on Linux. It is supported by the Linux kernel mainline and follows the Linux interface model, allowing you to use other network tools such as Wireshark. This also allows the creation of virtual CAN interfaces where no physical hardware is required to simulate or replay CAN messages.

Python packages

  • python-can - Support for multiple CAN hardware interfaces (SocketCAN, Kvaser, CAN over serial, IXXAT virtual CAN, etc.).
  • python-can-j1939 - SAE J1939 support dependent on python-can package. Provides address claiming, transport protocol, fd-transport protocol, requests, diagnostic messages, etc.
  • python-j1939 - SAE J1939 support dependent on python-can package. Provides codec and filtering by PGN but not full SPN decoding.
  • Cantools - CAN message encoding and decoding using DBC, KCD, SYM, ARXML, and CDD formats. Provides a command line tool and library module.
  • can4python - CAN signals sending and receiving using KCD format. Uses SocketCAN.
  • Canmatrix - Read and write several CAN database formats.
  • CANBabel - Conversion tool for CAN database files. Only supports reading/writing KCD and reading DBC formats.
  • Caring Caribou - Vehicle CAN bus security exploration tool (think of it as Nmap for automotive hacking).
  • CANalyzat0r - CAN analysis tool written in Python3. Modular, extensible, SocketCAN support.

Other packages

  • can-utils - SocketCAN command line utilities (candump, cansend, canplayer, etc.).
  • SavvyCAN - Cross-platform Qt based GUI analysis tool. Supports SocketCAN compatible interfaces.
  • CANdevStudio - CAN simulation software using a drag-and-drop style GUI with interconnected functional blocks. Provides a platform to add new custom components, however base components are lacking in features.
  • Kayak - Java-based CAN traffic GUI analysis tool. Uses SocketCAN and KCD format. Project semi-abandoned and hasn't been updated since 2014 (and still using Java 7!).
  • c0f - CAN bus fingerprinting tool. Written in Ruby. Still very experimental.
  • can-utils with J1939 support - Fork of can-utils with a few additional tools for J1939 (untested).
  • cannelloni - SocketCAN over Ethernet

CAN database formats

DBC

The de facto standard for CAN databases is the DBC file format developed by Vector Informatik GmbH. It is a proprietary format in that no official public documentation or specification is available, however it has been heavily reverse engineered and mostly all specifications are now known sans a few very obscure and seldom used features.

Parsers

  • Vector_DBC - DBC parser library written in C++14. Uses bison for grammar parsing.
  • dbcppp - DBC parser library written in C++17. Uses boost::spirit for grammar parsing.
  • dbc-parser - DBC parser written in C. Uses bison/flex/lemon. Not as robust or complete as the other parser libraries available.
  • Cantools - Python DBC parser
  • canmatrix - Python DBC parser
  • CANdb - DBC parser library written in C++11 from GENIVI. Uses cpp-peglib for grammar parsing.

Decoders

  • Cantools - Python scripting support for encoding and decoding CAN messages using a DBC CAN database. Implements its own DBC parser and supports multiplexed signals. Supports J1939. Does not support ISO-TP. Command line tool for real-time candump output decoding.
  • canmatrix - Python scripting support for decoding CAN messages using a DBC CAN database. Implements its own DBC parser and supports multiplexed signals. Supports J1939.
  • can_decoder - Python scripting support for decoding CAN messages using a DBC CAN database. Uses canmatrix for parsing DBC files, but implements its own decoder. Supports J1939.

KCD

Open source CAN database format for describing CAN signals and relationships. Essentially contains the same information found in the DBC file format but written in XML.

Originally created for the Kayak CAN analysis tool.

@JC0103
Copy link

JC0103 commented Sep 13, 2022

This tool is helpful in converting dbc to excel file format:
https://github.com/zhyongquan/DBC2Excel

@david-caruthers
Copy link

david-caruthers commented Jun 14, 2023

@jackm Great reference doc here! it seems that the link to DBC File Format Documentation v1.0 is broken. Can you update this link to route to the right place?

@jackm
Copy link
Author

jackm commented Jun 14, 2023

Do a search for DBC_File_Format_Documentation filetype:pdf and you should get some results. In fact, I found one that is for DBC version 1.0.5 which has corrected some of the errors found in version 1.0. I have updated the link.

@grant-allan-ctct
Copy link

Today I came across python-can-j1939 which is linked-to from the Other CAN bus tools page of python-can documentation.

@erzoe
Copy link

erzoe commented Jan 10, 2024

Thank you for this list. I was missing an editor to edit dbc and sym files so I have written one myself based on cantools and urwid: https://pypi.org/project/dbc-editor/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment