QUAD CAN BUS adapter for Raspberry CanBerry

Quad CAN BUS is an open hardware to connect a couple of canberry boards to Raspberry Pi. In this way it is possible to have 4 CAN interfaces: can0, can1, can2 and can3. The adapter is very very simple, it is a PCB with three 40 ways connectors, see the following scheme.

Quad Canberry adapter CAD Files

The Canberry 1 uses the standard pins (SPI 0) and it is identified as can0 and can1 with standard overlay files present in /boot/overlays, instead the Canberry 2 is remapped on the SPI1. In order to enable the intercaces can2 and can3 we must copy the can2 and can3 overlay in /boot/overlays as super user (If you want edit and ricompile the overlay files dtbo download can2 and can3 dts files).

After that edit /boot/config.txt modify the following row

dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=22
dtoverlay=mcp2515-can1,oscillator=16000000,interrupt=25
#In this way the SPI 1 is enabled with one chip select pin only for a canberry one channel
#dtoverlay=spi1-1cs
dtoverlay=mcp2515-can2,oscillator=16000000,interrupt=23
#In this way the SPI 1 is enabled with two chip select pins
dtoverlay=spi1-2cs
dtoverlay=mcp2515-can3,oscillator=16000000,interrupt=24

 

 

For the Canberry 1 the interface can0 is located in SPI0.1(X2 connector) and can1 in SPI0.0(X1 connector), instead for the Canberry 2 the interface can2 is located in SPI1.1(X2 connector) and can3 in SPI1.0(X1 connector).

Run sudo reboot 

after your raspberry has been booted, go to home directory:

cd /home/pi/
nano can-start.sh

add these lines to the script

#!/bin/sh
#Can

ip link set can0 up type can bitrate 1000000
ip link set can1 up type can bitrate 1000000
ip link set can2 up type can bitrate 1000000
ip link set can3 up type can bitrate 1000000

 

Run the script:

sudo sh can-start.sh

run ifconfig

now you can see the 4 can interfaces

So the system is ready, then you can use standard canbus command to use the peripheral:

candump can0 -> to monitoring can bus traffic

cansend can0 7DF#0201050000000000 -> to send canbus commands

candump can1 -> to monitoring can bus traffic

 

can1_dump

 

cansend can1 7DF#0201050000000000 -> to send canbus commands

To use both interface simultaneously open 2 different telnet sessions.

The QUAD CAN ADAPTER is available on our shop at a price of 15€

How to use RTC DS1307Z (DS3231)

 

Certification Disclaimer