Skip to main content

USB Mode

This screen is displayed when the CAN Bus Debugger tool is controlled by a PC. While in this state, physical tool controls are limited. However, pressing the ✔ button will toggle the tool's internal terminator state.


Enable USB control using an application that supports the gs_usb protocol. Some applications supporting this protocol are listed below in the PC Applications section.

PC Applications

CAN Bus Debugger is compatible with a range of PC utilities for analysing and interacting with CAN networks. Some of these utilities are listed below.

Alternatively, analyse .pcap captures created and stored on the CAN Bus Debugger tool in handheld mode at a later date using tools such as Wireshark. See the Log Files section for further information.

canutils

The canutils suite is a collection of command-line utilities for working with CAN interfaces on Linux systems. These tools allow you to send, receive, and monitor CAN traffic, as well as configure CAN devices. Common utilities include candump (for monitoring CAN traffic), cansend (for sending CAN frames), and canconfig (for configuring CAN interfaces).

Supported Operating Systems

  • Linux

These tools are included in many Linux distributions and work seamlessly with USB CAN adapters like the CAN Bus Debugger using the gs_usb protocol. Ensure the gs_usb kernel module is loaded in your Linux distribution for any gs_usb compatible device to function. Support for the CAN Bus Debugger was added to the gs_usb driver in Linux kernel version 5.18+. If you use an older kernel, manually compile and install a newer version of the gs_usb kernel module to ensure compatibility.

Refer to your Linux distribution's documentation for installation instructions, or see the canutils GitHub page for more details.

Example: CAN 2.0 Setup with canutils

This example demonstrates how to configure a classic CAN interface and capture or send frames using canutils.

1. Configure the CAN 2.0 Interface

//TODO:!!!!!!!!!!!!!!!!!!!!!!!! Does this need fd off when swapping between them? terminator?

Set up your CAN interface for classic CAN operation. This example uses a 500 kbit/s bitrate:

# Bring down the interface if it's already up
sudo ip link set can0 down

# Configure the interface for classic CAN and bring it up
sudo ip link set can0 up type can bitrate 500000

You can verify the interface configuration with:

ip -details link show can0

2. Capture CAN Frames

Use candump to monitor incoming CAN traffic:

# Basic capture on can0
candump can0

# Capture with timestamps
candump -t a can0

# Capture and save to a log file
candump -l can0

Example output:

can0  123   [8]  01 02 03 04 05 06 07 08
can0 456 [4] DE AD BE EF
can0 7FF [2] AA BB

3. Send CAN Frames

Use cansend to transmit CAN frames:

# Send a standard CAN 2.0A frame (11-bit ID 0x123, 8 bytes of data)
cansend can0 123#0102030405060708

# Send a frame with fewer data bytes
cansend can0 456#DEADBEEF

# Send a CAN 2.0B extended ID frame (29-bit ID)
cansend can0 12345678#AABBCCDD
note

Classic CAN frames support a maximum payload of 8 bytes. Extended IDs (29-bit) are indicated by IDs greater than 0x7FF.

Example: CAN FD Setup with canutils

This example demonstrates how to configure a CAN FD interface, enable the internal terminator, and capture or send frames using canutils.

1. Configure the CAN FD Interface

First, set up your CAN interface with CAN FD enabled. This example uses a 1 Mbit/s arbitration bitrate and 4 Mbit/s data bitrate:

# Bring down the interface if it's already up
sudo ip link set can0 down

# Configure the interface for CAN FD with the terminator enabled and bring the interface up
sudo ip link set can0 up type can bitrate 1000000 dbitrate 4000000 fd on

You can verify the interface configuration with:

ip -details link show can0

2. Capture CAN Frames

Use candump to monitor incoming CAN traffic:

# Basic capture on can0
candump can0

# Capture with timestamps
candump -t a can0

# Capture and save to a log file
candump -l can0

Example output:

can0  123   [8]  01 02 03 04 05 06 07 08
can0 456 [4] DE AD BE EF
can0 789 [64] 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 00 ...

3. Send CAN Frames

Use cansend to transmit CAN frames:

# Send a standard CAN frame (ID 0x123, 8 bytes of data)
cansend can0 123#0102030405060708

# Send a CAN FD frame (ID 0x456, up to 64 bytes, with BRS flag)
cansend can0 456##1.DEADBEEFCAFEBABE0011223344556677

# Send an extended ID frame (29-bit ID)
cansend can0 12345678#AABBCCDD
note

For CAN FD frames, the ## notation is used, followed by flags (1 = BRS enabled) and data.

python-can

python-can is a Python library that provides an interface for working with CAN networks. It supports sending and receiving CAN messages, and works with a variety of CAN hardware and drivers, including gs_usb compatible devices like the CAN Bus Debugger.

Supported Operating Systems

  • Linux
  • Windows
  • macOS (untested with gs_usb devices)

Refer to the python-can documentation for installation instructions and more details.

cangaroo

cangaroo is a cross-platform graphical application for analysing and visualising CAN traffic. It supports a range of CAN hardware, including gs_usb-compatible devices like the CAN Bus Debugger. cangaroo provides features such as message filtering, logging, and graphical data representation, making it suitable for diagnostics and development work.

Development of cangaroo stalled several years ago, but recent forks have added new features. The current official release does not support gs_usb devices using high-speed USB, so modifications are required for compatibility. A version that supports CAN Bus Debugger tools is available here.

Supported Operating Systems

  • Windows

Refer to the cangaroo GitHub page for installation instructions and more details.

SavvyCAN

SavvyCAN is an open-source, cross-platform CAN bus analysis tool with a graphical user interface. SavvyCAN is mainly used as a reverse engineering tool while offering features such as logging, graphing, fuzzing, etc. It is popular for automotive and industrial CAN analysis.

The current main release of SavvyCAN does not support gs_usb devices on Windows (it uses socketCAN on Linux). There is currently a Pull Request to add support, but it is still awaiting final review. Once merged, full support will be available. Until then, a Windows version supporting the CAN Bus Debugger tool is available here.

Supported Operating Systems

  • Linux
  • Windows
  • macOS (untested with gs_usb devices)

Refer to the SavvyCAN website for installation instructions, downloads, and documentation.