Setting up CAN on Beaglebone Black

This tutorial is based on a Debian wheezy distribution from 2015-03-01 on the Beaglebone Black. The description is independent of the used CAN cape.

I used this CAN cape: BeagleBone Serial Cape from Logic Supply

SocketCAN drivers

The BeagleBone should already have the SocketCAN drivers installed, so to use the CAN bus you just need to set the bitrate 125 kBit/s and bring up the CAN0 interface. This this with:

ip link set can0 up type can bitrate 125000
ifconfig

You should see the can0 interface.

CAN Utilities

Get some useful CAN utilities for the command line:

  1. cd can-utils
  2. apt-get install automake
  3. ./autogen.sh
  4. ./configure
  5. make
  6. make install

Start can0 at startup

  1. Update the network interface for CAN: nano /etc/network/interfaces
    # CAN 0 interface
    auto can0
    iface can0 inet manual
        pre-up /sbin/ip link set $IFACE type can bitrate 125000 listen-only off
        up /sbin/ifconfig $IFACE up
        down /sbin/ifconfig $IFACE down
  2. Bring all interfaces up at startup: nano ~/.bashrc
    # Start can0 interface at startup
    ifup -a

CAN bus test

Dump all CAN messages to the console:

candump can0

Go back

 
howto/setting_up_can_on_beaglebone_black.txt · Last modified: 2015/09/22 15:41 by akhe
[unknown button type]
 
Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki