This article shows the required steps to install the software for the PiCAN2 board on the Raspberry Pi.
Download the latest Raspbian Jessie and create a SD image.
On first bootup it normally boots to Desktop. Click Raspberry Pi Configuration icon and change the Boot to "To CLI", click OK and reboot the Pi.
It should now boot to the CLI. Do an update first.
sudo apt-get update sudo apt-get upgrade sudo reboot
Add the overlays by:
sudo nano /boot/config.txt
Add these 3 lines to the end of file:
dtparam=spi=on dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25 dtoverlay=spi-bcm2835-overlay
Reboot Pi:
sudo reboot
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.
Install the can-tools.
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.