CAN logging - dalathegreat/Battery-Emulator GitHub Wiki

CAN logging basics

The board can operate as a CAN logger, skipping the need for purchasing an expensive tool. There are two ways to log CAN messages, via USB (more reliable), and via Webserver (easier).

CAN logging via Webserver

Start by accessing the Webserver

On the main page, there is a button named "CAN logger" .When opened, the system starts logging CAN messages. This is disabled by default to not disturb the system.

image

Refresh the page to get an updated list of incoming (RX) and sent (TX) CAN messages.

image

USB CAN logging

To access the CAN-logging, enable the DEBUG_CAN_DATA feature. When this is enabled, all the incoming/outgoing CAN&CAN-FD messages will get timestamp, direction, ID, DLC, and data fields printed out via the Arduino IDE serial monitor. This can then be exported to a .txt file for later analysis.

##Log file format The log file format is compatible with the CANdump format. This can be read natively by tools like SavvyCAN.

Example format, CAN log:

(7.556) TX1 54A [8] 10 0 70 2 0 0 0 2B 
(7.558) TX1 54B [8] 1 8 80 12 4 0 0 0 
(7.560) TX1 54C [8] 61 66 0 0 0 0 57 0 
(7.561) TX1 1D4 [8] F7 7 0 0 7 46 0 7B 
(7.573) TX1 11A [8] 1 40 0 AA C0 0 0 3 

Example format, CAN-FD log:

(64.644) TX1 10A [32] D8 DE 99 00 00 00 00 01 FF 01 00 00 36 39 35 35 C9 02 00 00 10 00 00 35 00 00 0A 00 00 00 00 00  
(64.656) TX1 120 [32] 6E F3 99 00 00 00 00 01 FF 01 00 00 37 35 37 37 C9 02 00 00 00 00 00 35 00 00 0A 00 00 00 00 00 
(64.668) TX1 19A [32] 19 48 88 55 44 64 D8 1B 40 20 00 00 00 00 11 52 00 12 02 64 00 00 00 08 13 00 00 00 00 32 00 00 
(64.669) TX1 10A [32] 12 35 9A 00 00 00 00 01 FF 01 00 00 36 39 35 35 C9 02 00 00 10 00 00 35 00 00 0A 00 00 00 00 00 
(64.681) TX1 120 [32] A4 18 9A 00 00 00 00 01 FF 01 00 00 37 35 37 37 C9 02 00 00 00 00 00 35 00 00 0A 00 00 00 00 00 

[!NOTE]
If your serial monitor is filled with strange symbols "???!"?¤¤%" , change the baud rate in the serial monitor window from 9600 -> 115200
When a large amount of CAN traffic is present on the bus, you may need to increase the serial monitor baud rate to 460800 in Software.ino ( by changing Serial.begin(115200); to Serial.begin(460800); ) of course the serial baud rate of the serial monitor then also needs to be increased to 460800.