The best platform for open source, CAN-bus Arduino projects

Mar 08, 2022

Project update 6 of 14

CAN/FD Bus Sniffing From a Browser

by daniel k

The CANFDuino platform can be turned into a handy two-port CAN/FD sniffing tool for basic monitoring of bus traffic without any fancy PC-side software. What’s interesting is that a very old-school terminal protocol developed in the 1970’s for VT100 terminals plays a part. The ANSI X3.64 protocol provided a really simple method for manipulating cursor location and printing to the screen driven by the embedded device (a duty that nowadays is implemented in PC software that can be OS and driver dependent as well as licensed). Enter modern day browsers, for which terminal-emulator web pages have been developed. Or you can turn to the ubiquitous, free, and reliable terminal program PuTTY. Basically any PC-side “terminal emulator” can be used to “CANalyze” bus traffic, regardless of how it runs or what OS it’s on (provided USB to serial drivers). It’s not the most beautiful or elaborate solution, but hey, it’s simple, easy, and cheap.

CANTerm is a cheapo, two-port CAN/CANFD packet monitor that can be used in simple serial terminal programs regardless of OS and without special PC software.

Turning CANFDuino into a Dual-Port Bus Analyzer

Step 1

Read the entire GitHub readme file. Do everything in Installing the Library and First Sketch to make sure you can program your unit, it has passed testing, you have good connections, terminations etc.

Step 2

Choose your PC side terminal emulation tool. So far, we’ve only tested CAN sniffing from the browser with Google’s ChromeLabs serial terminal repository using the this code and the actual emulator found here. If you are willing to install a small terminal program (most of you already have this), we’ve tested this with PuTTY on Windows 7 and 10.

Step 3

Make your connections to the CAN/FD bus you are sniffing and the appropriate ports on CANFDuino (CAN0 and/or CAN1). Remember to consider terminations, if the bus you are monitoring is already terminated between two devices on the network then you do not want to enable the bus terminations on the CANFDuino as detailed in the hookup guide. Take note of the CANbus wiring conventions (for monitoring, a temporary small spur connection is usually no problem).

Step 4

Open ArduinoIDE, go to File->Examples->CANFDuino_CANTerm.ino. Upload the sketch to the CANFDuino.

Step 5

Open up the terminal program, Set a custom baud rate to 2 MBaud (2000000), select add COM port, pick the one assigned to CANFDuino, and then click connect. Wait for a few seconds for the reboot and on-screen instructions to appear and follow them (if no on-screen instructions, check the baud rate and COM port setting and connect again). Note: if you want to avoid the boot up delay each time you open the COM port, jumper the bootloader bypass as detailed in the hookup guide. Note that if you are using PuTTY, you can actually set the font sizes and line count to give you more real estate to work with if you have a ton of messages to go through.

CANTerm load screen in Chrome browser
CANTerm load screen in PuTTY

Step 6

CANTerm saves settings into internal flash memory, so if you’ve already set your baud rates, etc. then just press enter! If this is your first time (or you flashed CANFDuino), hit escape and follow the step-by-step prompts for:

Which Ports You Want to Monitor

Select which port you want to enable CAN monitoring on or both.

Set The Normal CAN Baudrate

Type “0” to only use CANFD speeds, the other settings are self explanatory.

Set the CANFD Baud Rate

Set the baudrate for CANFD messages, enter “0” if you are not using CANFD.

CAN ID Message Filter Setting One

Monitor CAN ID’s (hex) that are greater than this number (including extended ID’s). Type ALL for no message filters

CAN ID Message Filter Setting Two

All CAN ID’s less than this number and greater that filter setting two will be monitored

Step 7

Commence monitoring! You will see message contents listed in a static line order, with associated message counters. This display is useful for simply watching contents on the screen at naked eye speeds, enabling you to see what ID’s are being transmitted and what the contents look like.

Features for Future Consideration

Sign up to receive future updates for CANFDuino.

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects