Skip to content

RaspberryPi CAN Interfaces

jhofstee edited this page Sep 23, 2022 · 70 revisions

This document is part of the instruction on running Venus OS on a RaspberryPi.

Main document is here.

Since Venus v2.90 CAN-bus interfaces will be automatically be recognized and services are created for them. There is no longer a need to up them manually.

make sure to use the Candelight software, see https://github.com/candle-usb/candleLight_fw

The Peak driver is included in the RPi Venus image, it is recognized automatically.

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

PiCAN HATs

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. And 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

Clone this wiki locally