PLEASE NOTE: This site is no longer being actively maintained. For frequently updated BeagleBone resources please visit Beaglebone.org.

Tuesday, June 3, 2014

On 6:54 PM by Unknown

Overview

Logic Supply's CBB-Serial cape includes an isolated CAN interface, which makes it easy to snoop on your vehicle's OBD-II bus.

What You Will Need

Wiring the Connector

The first step is to cut the OBD-II cable so you can wire it to the serial cape. You'll need the male end (with the pins inside) to connect to a vehicle, so cut the cable close to the female end to keep as much length as you can. Only three of the wires are needed to connect to the serial capes CAN interface: GND, CANH and CANL.


The color coding in my cable was GND -> solid yellow, CANH -> solid green, and CANL -> orange with a black stripe. You should check your cable with a continuity meter to be sure. Strip the wires and connect them to the screw terminals (I also connected the chassis pin to ground, which was solid orange):


Find the OBD-II connector in your vehicle; it was right under the steering column in my Chevy Colorado. Just to be safe, it is recommended that you plug the cable in while both the vehicle and the BeagleBone are powered off, then power the BeagleBone first. In reality the isolated transceiver on the serial cape should be just fine if you turn the vehicle on first. You will need to power the BeagleBone from the DC barrel jack, as not enough current can be supplied through the USB port to power it and the CAN transceiver.


Software

SSH into the BeagleBone and start by setting up the CAN interface:
  # ip link set can0 type can bitrate 500000 listen-only on
  # ifconfig can0 up

Next, install the can-utils package:
  # apt-get update && apt-get install git
  # cd /tmp
  # git clone git://gitorious.org/linux-can/can-utils.git
  # cd can-utils/
  # make
  # make install
  # cd ~

Now run the candump tool to start logging can packets to the terminal:
  # candump -cae can0,0:0,#FFFFFFFF
The above candump command will log all data and error packets to the terminal, reporting known error packets in human readable form, use color coding (if supported by your terminal), and will include ascii decoding. Run # candump --help' to see all the available options.

At this point if you turn your vehicle's ignition you should start to see CAN packets appear in the terminal like this:
  can0  0F9   [8]  02 0F 40 00 00 00 00 1B   '..@.....'
  can0  199   [8]  CF FF 0F FF EF FE 00 FF   '........'
  can0  0F9   [8]  02 0F 40 00 00 00 00 1B   '..@.....'
  can0  199   [8]  0F FF 0F FF F0 01 00 FF   '........'
  can0  19D   [8]  80 00 3F FE 00 00 00 FF   '..?.....'
  can0  1F5   [7]  0F 0F 00 01 00 00 03      '.......'
  can0  299   [2]  00 FF                     '..'
  can0  0F9   [8]  02 0F 40 00 00 00 00 1B   '..@.....'
  can0  199   [8]  4F FF 0F FF F0 00 00 FF   'O.......'
  can0  0F9   [8]  02 0F 40 00 00 00 00 1B   '..@.....'
  can0  199   [8]  8F FF 0F FF EF FF 00 FF   '........'
  can0  19D   [8]  C0 00 3F FD 00 00 00 FF   '..?.....'
  can0  1F5   [7]  0F 0F 00 01 00 00 03      '.......'
  can0  299   [2]  00 FF                     '..'
  can0  0F9   [8]  02 0F 40 00 00 00 00 1B   '..@.....'
  can0  199   [8]  CF FF 0F FF EF FE 00 FF   '........'
  can0  0F9   [8]  02 0F 40 00 00 00 00 1B   '..@.....'
  can0  199   [8]  0F FF 0F FF F0 01 00 FF   '........'
  can0  19D   [8]  00 00 00 00 00 00 00 FF   '........'
  can0  1F5   [7]  0F 0F 00 01 00 00 03      '.......'
  can0  299   [2]  00 FF                     '..'
  can0  0F9   [8]  02 0F 40 00 00 00 00 1B   '..@.....'
  can0  199   [8]  4F FF 0F FF F0 00 00 FF   'O.......'
  can0  0F9   [8]  02 0F 40 00 00 00 00 1B   '..@.....'
  can0  199   [8]  8F FF 0F FF EF FF 00 FF   '........'
  can0  19D   [8]  40 00 3F FF 00 00 00 FF   '@.?.....'
  can0  1F5   [7]  0F 0F 00 01 00 00 03      '.......'
  can0  299   [2]  00 FF                     '..'
If you don't see any output you'll need to stop candump by pressing , then change the bitrate for the CAN interface:
  # ifconfig can0 down
  # ip link set can0 type can bitrate 125000 listen-only on
  # ifconfig can0 up

and restart candump. You may need to try a few different bitrates before you find the right one for your vehicle. Standard rates include 125000, 250000, 500000 and 1000000. A Google search may also turn up the correct bitrate for you make and model.