Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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-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.

  • CAN DBC File Explained - A Simple Intro
  • An Introduction to J1939 and DBC files
  • DBC Format - Very brief explanations about various sections, however does have many examples and explains multiplexed signals well.
  • DBC File Format Documentation v1.0 - Leaked DBC file format specification version 1.0 (2007-02-09). Uses EBNF notation for grammar syntax. WARNING this is an old specification and some aspects of it are incorrect for the currently used format version - for example it says that for the signal byte order field a 0 indicates little endian and a 1 indicates big endian but this is wrong and actually the opposite of what it actually is!

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.

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