This blog shows the steps required to install the software on the Raspberry 2 Model for use with PiCAN board
All the previous kernel modules will not work with the current Raspbian (2015-02-16) for the Raspberry Pi 2. However the next version of the kernel will have the mcp251x driver compiled in. We can upgrade the firmware now with the new driver. These instruction will also work on the Raspberry B+.
Start by installing a brand new version of Raspbian (2015-02-16) kernel 3.18
Enable the SPI interface by running raspi-config.
Select Advanced Options.
Select A6 SPI
Confirm you want the SPI interface enabled. Confirm you want the SPI kernel module to be loaded by default, then exit.
Do an update first.
sudo apt-get update
sudo apt-get upgrade
Add the overlays by:
sudo nano /boot/config.txt
Add these 3 lines to the end of file:
You can now bring the CAN interface up:
sudo /sbin/ip link set can0 up type can bitrate 500000
Download and copy the CAN test programs to the Pi.
To send a CAN message use :
./cansend can0 7DF#0201050000000000
This will send a CAN ID of 7DF. Data 02 01 05 – coolant temperature request.
To write your own CAN-Bus program follow this blog.