How to Decode Vehicle's CAN Bus Data

Introduction: How to Decode Vehicle's CAN Bus Data

In this instructable we will record a CAN bus data of car or truck and convert the recorded CAN bus log data to readable values. For decoding we will use can2sky.com cloud service which is free. We can record the log by CAN-USB adapters but pay attention to the log format - it should be compatible with decoder service.

Step 1: Choosing CAN-bus/USB Tool and Software

can2sky.com decoder supports several types of can bus log:

1. CAN-hacker trc-file format.

USB adapter link

CAN bus log (29bit) example(truck, buses, tractors, other commercial machinery). File should have *.trc extension. Time ID DLC Data Comment

40,425 18FFB5F2 8 3A 82 FF 5C C6 80 11 05

40,431 18F005F6 8 FF FF FF FB FF FF 20 50

40,431 14FFB4F6 8 00 FF 16 F0 FF FF FF FF

40,433 18FFB6F2 8 00 00 00 00 F1 12 FF FF

Download example

CAN bus log (11bit) example (cars).File should have *.trc extension.

Example of format

36,492 1 0004 40A 8 C0 00 38 8F 94 DA 07 3A 00000000

36,592 1 0004 40A 8 C0 01 00 00 9F AF 00 35 00000000

36,692 1 0004 40A 8 BF 00 3D 04 02 37 A7 00 00000000

36,792 1 0004 40A 8 BF 02 22 00 00 00 02 2B 00000000

36,892 1 0004 40A 8 BF 03 30 00 02 00 00 00 00000000

36,992 1 0004 40A 8 BF 04 31 80 00 24 00 06 00000000

Download example

2. Output format of the Linux utility candump.

This file should have an extension *.log. You can use Raspberry Pi, Orange Pi or any other Linux PC with can interface and can-utils software installed. How to set up Pi for CAN-bus operation you can read there. 11bit format example:

(1579876676.199507) slcan0 2DE#0000000000000050

(1579876676.199539) slcan0 358#000A800000000000

(1579876676.199547) slcan0 1CA#0000000005005055

(1579876676.199553) slcan0 1CB#00000000000185

Download example

3. Simple csv format

This file should have an extension *.csv

First string - header with names of rows. SA row is necessary but can be filled by "1". time;PGN;SA;b0;b1;b2;b3;b4;b5;b6;b7;;

0,01;41;1;7A;3;0;0;0;0;0;0;;

0,02;50;1;0;20;90;B0;FF;FF;FF;FF;;

0,03;0D0;1;B5;20;0;8;0D;90;FF;FF;;

0,04;1A0;1;0;40;0;0;FE;FE;0;0E;;

0,05;280;1;1;22;CC;0C;22;0;17;19;;

0,06;288;1;8A;7B;10;0;0;53;93;0F;;

Download example Download example

For 29-bit CAN bus, just use 2 bytes of PGN in PGN column (for example - FEF2, FECA, etc).

Step 2: Register and Login to Can2sky.com Service

Once your CAN bus log has been recorded you can upload it to the can2sky.com service to decode it.

You have to register to enter the service. Email requires confirmation, which will be sent by service.

After login you can load your first CAN log. Click Upload TRC-file button.

Step 3: Load Your CAN Bus Log

Choose New Car option and fill information about vehicle (all fields are required).

Drag and drop your CAN bus log file.

Then we can choose a parser (DBC-file) to decode the log. Service will check all possible parsers and show a number of matching parameters from parser and log. Choose most suitable parser to decode your log. Take into account that same manufacturer parser will provide you better results.

For 29bit CAN bus of truck, buses and other commercial vehicles we will use one of J1939 parsers because of this industry standard. For cars there are no standards so each vehicle is different in terms of CAN bus IDs. That means that although we can use Ford parser for decoding Mercedes data - but we will receive useless results even with great number of matching IDs. Because different car vendors can use same IDs for different parameters.

In our example for BMW X6 log we will use BMW X1 parser, because of same manufacturer and biggest number of matching IDs.

Click Send.

Step 4: Visualization of CAN Bus Data

Main dashboard window appears where you can see all your logs and parsers (both default and your private parsers). After some time status of your log will be changed from "progress" to "completed"

Click View to see the visualization.

Left part of screen – a list of CAN identifiers which are active in this log. Some of them are reckognized by DBC-parser, some – not (marked with red background).

Value column shows minimum and maximum parameter value during log.
You can change a period for analysis using Time Filter range settings. If you click on parameter in the parameter’s list – it becomes green. Table of values will appear and parameter plot.

You may zoom plot with left mouse button and selecting a part of plot.
You can built several plots at once, also you can combine plots from different log-files. To choose another source of parameters you can click on listbox of loaded logs.

Filter section allows to filter out CAN bus parameters which doesn't look interesting for us. Parameters marked green appears in the list. Inversion will reverse selection.

Step 5: Parser Editor

Rules of CAN-bus messages decoding are described by DBC-files. Each parameter (SPN) has its own decoding rule which you can edit, clone or delete in SPN editor

SPN editor window contains all information related to the decoding of this CAN bus parameter.

Bit start – start position of parameter in CAN bus message (in bits, because there are a lot of bit-coded parameters). Each byte=8 bits (fyi).
Bit length – length of CAN parameter in bits.

Little endian or Big endian - byte order enumeration. Service supports both Intel (Little endian) or Motorola Lsb (Big endian) format.

Scale – scale how to convert can value to real parameter.

Offset – offset of real value, so real data calculated as CAN parameter * scale + offset.

Min and Max – minimum and maximum value (optional).

You can see also the result of your decoding operation in DEC, HEX and binary format.
After SPN modification you will be prompted to save a DBC-parser under new name (you can’t modify default DBC-file), you can only create new version of it. Creation of new DBC-parser can take a lot of time (several minutes, please, be patient).

Step 6: Improve Your Private Parser

In SPN-editor you can add decoding rules for unrecognized messages.

Click +SPN to make it.
Again, you cannot create new SPN rule in default DBC, so you will be prompted to make a new one.

After saving as new DBC open your log by new parser.

Now you can add new SPN definitions. SPN-editor will appear where you can put a name of SPN and set meaningful bits and scale.

Since new SPN have been created you may use its result for plots and analyze together with other parameters.
Active (changing) bytes during period of analysis will be colored.

Step 7: Make Your Log Public.

By default, every log is private and can be reviewed only by its owner. But you can turn off this switch and make log “Public”.

After login under new username we will see this log in public section, accessible for any user of platform. Everybody can review it and built plots, post commends under log.

Step 8: Save Results in PDF File

You can generate a report with all recognized and unrecognized CAN bus data parameters. Click Export to PDF.

Be the First to Share

    Recommendations

    • Make it Move Challenge

      Make it Move Challenge
    • Micro:bit Contest

      Micro:bit Contest
    • Lamps and Lighting Contest

      Lamps and Lighting Contest

    Comments