CAN DBC File - Convert Data in Real Time (Wireshark, J1939)

Wamt to stream human-readable CAN bus data in real-time?

With the CLX000 CAN bus analyzer, it's possible to stream converted/physical data in Wireshark using your CAN DBC file - incl. J1939 DBCs

Below we introduce the DBC file format - incl. how to use it via our Wireshark Plugin.

Need to convert CLX000 log file data using CANvas? See this guide instead.

DBC J1939 CAN Bus Wireshark

For a quick intro, check out our 3 min video above, showing the DBC Wireshark plugin feature in practice!


What is a CAN DBC File?

A CAN DBC file lets you convert raw CAN bus data to physical, readable data.

By default, a CAN analyzer records raw CAN data - see e.g. below CAN frame:

0x0CF00400FF  

FF  FF  68  13  FF  FF  FF

Using a CAN DBC for this CAN ID, you can get the 'scaled engineering values':

Here we converted an SAE J1939 CAN ID, EEC1, with data on Engine RPM.



How Does DBC Conversion Work?

A CAN bus DBC file is simply a database format structured around CAN Messages (e.g. EEC1) and Signals (e.g. RPM).
The DBC format is proprietary, but a number of online DBC wikis detail the basic concepts.

The core of a DBC file consists of CAN Messages and their Signal details, structured as below:

J1939 EEC1 EngSpeed RPM CAN DBC File Database Format Message Signal

A few comments on the DBC structure above:

  • Each CAN Message contains 1+ CAN Signals
  • The 'DBC Message ID' adds 3 extra bits for 29 bit CAN IDs as an 'extended CAN ID' syntax
  • Bit positions start at 0 - above example Signal starts after the 3rd byte with a 2-byte length
  • The Sender and Receiver reflect sending & receiving nodes
  • More info (e.g. descriptions, value tables) can be added later in the DBC file

In short, the CAN DBC file is a standardized format for storing the rules for converting raw CAN bus data.

Standard vs. Proprietary DBC Files: For standardized cases like the SAE J1939, you can use the same DBC across many vehicles to convert most data. However, for proprietary CAN protocol systems (e.g in cars), typically only the OEM will have the conversion rules. If you do not have access to the rules, you may be able to reverse engineer some of the information.



Example - J1939 RPM Conversion

Let's assume we logged raw J1939 data from a transit bus and want to "manually" convert the RPM data.

First, we paste all logged CAN IDs into a CAN-ID-to-PGN converter to see what J1939 PGNs our data contains.

One of the CAN IDs, 0CF00400, equals the PGN F004 (DEC: 61444), i.e. EEC1. From the J1939 standard, we identify that this contains the SPN/CAN signal EngSpeed (aka RPM) - with conversion rules as in the previous illustration .

To convert a single CAN frame observation, we extract the 2 date bytes after byte 3 (e.g. 68 13), swap order (little endian) and convert to decimal (4,968).

Stream J1939 Data Convert RPM from Transit Bus J1939 Heavy Duty DBC

To "scale" this RPM data to human readable form, the J1939 standard dictates a linear conversion as below:

[Scaled Value] = [Offset] + [Scale] x [Raw Decimal Value]

621 RPM = 0 + 0.125 x 4,968

Basically, CAN software mimics the above process using the parameters of your DBC file.

For more on DBC conversion, check our J1939 DBC product page (incl. J1939 sample data & DBC):

LEARN MORE


How To Convert Live CAN Data via DBC in Wireshark

Wireshark does not by default support CAN DBC conversion - but our Wireshark Plugin solves that!

With the plugin, you can easily load e.g. your J1939 DBC file and stream converted J1939 data in real-time using a CLX000 as CAN interface.
The plugin has many other features incl. OBD2 conversion and a trace view for reverse engineering.

For a general intro to streaming CAN bus data with the CLX000, see our CAN interface intro.

Loading Your DBC File in Wireshark:

  • Start streaming raw CAN data in Wireshark as normally
  • Go to Edit/Preferences/Protocols/CAN DBC
  • Click Edit, then New and browse to your DBC file
  • Specify 'DBC type' to switch between regular and J1939 and click OK
  • Right-click a streamed CAN Message and click 'Decode As' and choose 'CAN DBC'

You are now streaming human-readable CAN bus data:

Stream J1939 Data Real-Time Graph Plot

The default view above is called 'Message View' and shows 1 row per CAN Message.


For some use cases, you may prefer the alternative Signal View - which shows 1 row per CAN Signal:

CAN DBC J1939 SPN Signal Live Trace

To enable Signal View, check "Signal per row" in the preferences, re-start Wireshark and re-enable your decoding.
Above, we've also added various column fields - to do so, select a field from the details window and "Apply as Column".




4 Cool Wireshark DBC Features

DBC converting real-time data is great - and below features make it truly powerful:

1

Create Graphs

Data plots are easily done in Wireshark - also in real-time!

Simply go to Statistics/IO Graph. Here, you can start by setting the X-axis to show "Time of day" and the Y-axis unit to "Advanced...". Next, set the Calc field to "AVG(*)" and to the right enter β€œcan-dbc.” in the field. This brings up a drop-down to scroll through Messages and Signals of the DBC file. Select one and click the Graph button to plot it. Remember to set a reasonable interval frequency to avoid funky plots (e.g. 10s or 1 min).

2

Filter Your Data

Wireshark offers great filter options to simplify your views.

These are set up in the Expressions tab in the upper right corner. For example, you can add the filter, β€œ!can-dbc.signal_max && !can-dbc.signal_min” and hit enter to filter out invalid Signals when in Signal View.

You can also right-click any field in the details pane and choose to add it as a filter.

3

Export to *.CSV, *.TXT, *.JSON, etc

Easily export data to other formats!

Simply go to File/Export Packet Dissections to select format (*.txt, *.ps, *.csv, *.psml, *pdml, *.c, *.json) and settings.

You can export all frames, a selected range or the displayed frames based on filters. Under "Packet Format", we recommend to include the Packet summary line, column headings and packet bytes, while excluding the rest. You can export either raw CAN data or the dissected version.

4

Load a CLX000 Log File

Quickly load a CLX000 log file into Wireshark.

This allows you to convert, plot and export the data via Wireshark. For large or multiple log files, we recommend using CANvas for conversion as it is designed for efficient log file conversion. In particular, CANvas handles multiple "split" log files easily with speed. However, for simpler cases the Wireshark solution can offer a quick way to get an overview of your logged data.





Ready to start streaming your own DBC converted CAN data?
Then learn more about our CLX000 CAN analyzer below!





Liked this article? Please share!




RECOMMENDED FOR YOU



We use cookies to improve our site (see our privacy policy)

OK