Automotive CAN Bus

CAN stands for (Controller Area Network) and is a data protocol for connecting and communicating among automotive ECUs.

It uses the SAE J1939 protocol.

PGN = Parameter Group Number

OBD= On-Board Diagnostics. Of course Wikipedia explains it all.

Kvaser has products to interface with CAN and a tutorial about the technology in general.

Linux CAN

Linux has a kernel level module called SocketCAN which makes CAN traffic available to the kernel at a pretty low level so that analysis programs and userspace applications can have something consistent to work with .

You can also apt install can-utils to get lots of CAN specific utilities. A very good one to keep in mind is candump. Here’s an example of how that might be used.

sudo ip link set can0 up type can bitrate 500000
ip link show up # Check if the link setup worked.
candump can0
cansend can0 123#DEADBEEF

This allows you to check and see if you’re even getting anything. It is analogous to what tcpdump is for network packets. Analogous to Wireshark is, well, Wireshark. It can — possibly requiring a plug-in — also process and display CAN messages as well as network TCP packets. But another one is SavvyCAN which is rumored to be helpful.

Other can-utils to keep in mind.

  • asc2log

  • bcmserver

  • can-calc-bit-timing

  • canbusload - monitor CAN bus load.

  • candump - dump CAN bus traffic.

  • canfdtest - full duplex test program.

  • cangen - CAN frames generator.

  • cangw - gateway

  • canlogserver

  • canplayer - replay a compact CAN frame logfile to CAN devices.

  • cansend - send CAN-frames via CAN_RAW sockets.

  • cansequence - send sequenced messages to test link reliability.

  • cansniffer - volatile CAN conent visualizer.

  • isotpdump -

  • isotpperf

  • isotprecv

  • isotpsend

  • isotpserver

  • isotpsniffer

  • isotptun

  • j1939acd

  • j1939cat

  • j1939spy

  • j1939sr

  • log2asc

  • log2long

  • slcan_attach

  • slcand

  • slcanpty

  • testj1939

Kvaser Leaf Light V2

Kvaser Leaf Light v2 Data Sheet

Your Gateway to Efficient Connectivity

  • Warranty: 2-Year warranty. See our general conditions and policies for details.

  • Support: Free support for all products by contacting support@kvaser.com

  • EAN: 73-30130-00685-0

The Kvaser Leaf Light v2 represents one of the easiest and lowest- cost methods of connecting a computer to a CAN bus network. With its USB 2.0 compliant connector and 9-pin D-SUB connector, the Leaf Light v2’s sleek, ergonomically designed housing is both robust enough for everyday use and small and flexible enough to be used in space-constrained applications. Now with galvanic isolation as standard.

Ref. No. 98326-7 v. 2.0

Kvaser AB Aminogatan 25A SE-431 53 Mölndal Sweden

Major Features

• 8000 messages per second, each timestamped with 100 microsecond accuracy.

• Supports both 11-bit (CAN 2.0A) and 29-bit (CAN 2.0B active) identifiers.

• High-speed CAN connection (compliant with ISO 11898-2), up to 1 Mbit/s.

• Galvanic isolation, previously a more expensive option on Kvaser’s original Leaf Light, now comes as standard on the Leaf Light v2, enhancing protection from power surges or electrical shocks. • Low current consumption (70 mA) reduces power drain from your laptop.

• Local buffering and preprocessing results in high performance and a reduction of time critical tasks for the PC.

• Compatible with J1939, CANopen, NMEA 2000® and DeviceNet. Higher layer protocol translation handled by the user’s application. For software support please see our Technical Associates products and our Software Download page (www.kvaser.com).

Support

Documentation, Kvaser SDK and drivers can be downloaded for free at http://www.kvaser.com/downloads.

Kvaser CANlib is a free resource that includes everything you need to develop software for the Kvaser CAN interfaces. Includes full documentation and many program samples, written in C, Cpp, C#, Delphi, Visual Basic, Python and t script language.

Kvaser CAN hardware is built around the same common software API. Applications developed using one device type will run without modification on other device types.

Technical Data

Casing Material

PA66

CAN FD

No

Channels

1

Connector

DSUB 9

Current Consumption

90 mA

Dimensions

35 x 165 x 17 mm for body incl. strain relief

Error Frame Detection

Yes

Galvanic Isolation

Yes

Interfaces

USB, CAN

IP Class

IP40

Maximum Bitrate

1000 kbps

Minimum Bitrate

40 kbps

Operating Systems

Linux, Windows

Regulatory Compliance

CE, FCC

Silent Mode

No

Temperature Range

-20 to +70 °C

Timestamp Resolution

100 µs

Weight

11g

NMEA2000 - Marine Applications

NMEA is the National Marine Electronics Association. (Not to be confused with NEMA, the National Electrical Manufacturers Association, which standardizes things like electrical boxes.)

NMEA2000

NMEA 2000 is based on CAN bus electricals as found in cars but with its own codes, not SAE J1939.

250kbit/s (31kB/s) max low level throughput.

0183

This is an older communication specification. It seems to be serial text as opposed to (perhaps more efficient but complex) binary frames. Eric Raymond has a very helpful document on the NMEA 0183 protocol.

The Yacht Devices USB<→NMEA2k converter can do a live conversion to 0183 which may make it easier to see what’s going on.

sudo bash -c 'echo "YDNU MODE 0183" > /dev/ttyACM0'

Physical

Physical cabling and hardware must be DeviceNet compliant. This is a standard from equipment like industrial controllers.

There are two sizes of cabling, "mini" and "micro"; these are sometimes referred to as "thick" and "thin" respectively. Vendor complications such as Simrad’s SimNet and Raymarine’s SeaTalk NG are essentially NMEA2k with different cabling (adaptors exist).