This is an old revision of the document!
PiCAN
The PiCAN is a reimplementation of the interface found here.
Headers
JP1-1 | JP1-2 | JP1-3 |
---|---|---|
CANL | CANH | GND |
JP2-1 | JP2-2 | JP2-3 |
GPIO14 TXD | GPIO15 RXD | GND |
P1-3 | P1-2 | P1-1 |
GPIO14 | GND | 5V |
Install
Append the following to boot/config.txt and reboot.
dtparam=spi=on dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25 dtoverlay=spi-bcm2835
dmesg
CAN device driver interface mcp251x spi0.0 can0: MCP2515 successfully initialized.
Configure
ip link set can0 up type can bitrate 250000 ip link set can0 txqueuelen 1024 ip -s -d link show can0
Termination
There is a termination resistor closed using JP3.
Test
apt install can-utils
Host 1
candump can0
Host 2
cansend can0 123#DEADBEEF cangen can0
Pinout
5 4 3 2 1 9 8 7 6 OBDII 2 CAN L 2 GND SJ1 3 GND 3 CAN H SJ2 6 GND 5 CAN L SJ3 7 CAN H Solder bridges