BeagleBone Black CAN bus setup
There is concept called device tree overlay and you can think of it as request for specific pin setup on the device itself.

Some pins on the board are by default dedicated for specific purpose, SPI or I2C or just general purpose but some like CAN need to be defined to be used and that's the thing we need to do.

Folder /lib/firmware contains list of pre-configured binary overlay files which could be loaded and that would setup specific list of pins for specific purpose.

At the beginning those file are defined as source file which are regular text file with some specific syntax but in the moment we want to use them we need to compile them with dtc command.This is the reason why we have dts extension for the source and dtbo for binary.

So the process for CAN goes as follows:

Inside /lib/firmware create file BB-DCAN1-00A0.dts :

/dts-v1/;
/plugin/;

/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";

    /* identification */
    part-number = "dcan1pinmux";

    fragment@0 {
        target = &lt;&amp;am33xx_pinmux&gt;;
        __overlay__ {
            dcan1_pins_s0: dcan1_pins_s0 {
                pinctrl-single,pins = &lt;
                    0x180 0x12  /* d_can1_tx, SLEWCTRL_FAST | INPUT_PULLUP | MODE2 */
                    0x184 0x32  /* d_can1_rx, SLEWCTRL_FAST | RECV_ENABLE | INPUT_PULLUP | MODE2 */
                &gt;;
            };
        };
    };

    fragment@1 {
        target = &lt;&amp;dcan1&gt;;
        __overlay__ {
             #address-cells = &lt;1&gt;;
             #size-cells = &lt;0&gt;;

             status = "okay";
             pinctrl-names = "default";
             pinctrl-0 = &lt;&amp;dcan1_pins_s0&gt;;
        };
    };
};


Now it is needed to create overlay binary with the following command in the same directory:

root@host:/lib/firmware# dtc -O dtb -o BB-DCAN1-00A0.dtbo -b 0 -@ BB-DCAN1-00A0.dts


Finally execute:

 root@host:/lib/firmware#echo BB-DCAN1 &gt; /sys/devices/bone_capemgr.*/slots


Now load kernel modules:

root@host# modprobe can
root@host# modprobe can-dev
root@host# modprobe can-raw


Build can tools:

root@host# svn co svn://svn.berlios.de/socketcan/trunk
root@host# cd trunk/can-utils/
root@host# make


Setup bus speed:

root@host# ip link set can0 up type can bitrate 500000
root@host# ifconfig can0 up