RaspberryPi CAN Interfaces - victronenergy/venus GitHub Wiki
Main document for running Venus OS on a RaspberryPi is here.
Since Venus v2.90 CAN-bus interfaces will be automatically recognized and services are created for them. There is no longer a need to set them up manually.
CANable
make sure to use the Candelight software, see https://github.com/candle-usb/candleLight_fw or visit https://canable.io/updater/
Peak PCAN-USB (Also Victron CANUSB Interface)
The Peak driver is included in the RPi Venus image, it is recognized automatically.
WAVESHARE
WARNING: These boards use the MCP2515, which only has 2 RX buffers which is not enough to guarantee a loss-free CAN connection. Boards using MCP2518 are better.
This is a RPi HAT board that connects to the SPI bus via the GPIO header. The RPi Venus image includes kernel drivers for the MCP2515 chip used by the WaveShare, as well as a device tree overlay to configure it.
To activate this device, the file /u-boot/config.txt should have the following lines at the end:
[all]
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25,spimaxfrequency=2000000
if the crystal on the board is the old 8MHz and not the 12MHz, the dtoverlay should be:
dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=25,spimaxfrequency=1000000
The Waveshare isolated 2-CH CAN HAT (https://www.waveshare.com/wiki/2-CH_CAN_HAT), uses a 16MHz crystal with interrupts 23 & 25. Add the following two dtoverlay lines to support both channels on this board:
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=23,spimaxfrequency=2000000
dtoverlay=mcp2515-can1,oscillator=16000000,interrupt=25,spimaxfrequency=2000000
PiCAN HATs
WARNING: This board uses MCP2515, which only has 2 RX buffers which is not enough to guarantee a loss-free CAN connection. Boards using MCP2518 are better.
The PiCANs are a series of RPi HATs available in single and dual port versions, some with isolation that connects to the SPI bus via the GPIO header. It is available from a number of resellers. Reference this dual port example: http://skpang.co.uk/catalog/pican2-duo-canbus-board-for-raspberry-pi-23-p-1480.html or https://copperhilltech.com/raspberry-pi/
The RPi Venus image includes kernel drivers for the MCP2515 chip used by the PiCANs, as well as a device tree overlay to configure it.
To activate edit the file /u-boot/config.txt and add the following lines at the end:
[all]
dtparam=spi=on
# Bring up the PiCAN controllers.
dtoverlay=mcp2515-can0-overlay,oscillator=16000000,interrupt=25
dtoverlay=mcp2515-can1-overlay,oscillator=16000000,interrupt=24
dtoverlay=spi-bcm2835-overlay
(Omit "...can1..." line if single port HAT is begin used)
Multiple CAN interfaces
Linux will simply number the interfaces in the order it found them, don't be surprised if they change after a reboot. An udev rule is needed to assign a fixed name. Venus OS only does that for onboard CAN-devices, but there isn't one on a Raspberry PI.
SLCAN
Reprogram them to use gsusb or don't use them. While the rpi hardware in itself is already unsupported - but works quite well in many cases - the slcan protocol is next level: it is not supported because it doesn't work for VE.Can / NMEA2000 and/or similar higher load and more complex CAN protocols.