Example Linux (Ubuntu) Setup
This setup is for Raspberry Pis running Ubuntu and similar Debian distros.
- Install MCP251XFD required drivers (example showing
can-utils).sudo apt update sudo apt install -y can-utils - Enable SPI and add the MCP2518FD overlay.
sudo nano /boot/firmware/config.txt# Add the following lines to config.txt: dtparam=spi=on dtoverlay=mcp251xfd,spi0-0,oscillator=40000000,interrupt=22,spimaxfrequency=10000000 - Reboot the system.
sudo reboot - Run CAN.
- For CAN classic setup (example for 500 kbps, 87.5% sample point, bus error reporting):
sudo ip link set can0 down 2>/dev/null || true sudo ip link set can0 type can bitrate 500000 sample-point 0.875 berr-reporting on sudo ip link set can0 up - For CAN FD setup (example for 1 Mbps nominal rate, 80% sample point, 4 Mbps data phase rate, bus error reporting):
sudo ip link set can0 down sudo ip link set can0 type can bitrate 1000000 sample-point 0.80 dbitrate 4000000 dsample-point 0.80 fd on berr-reporting on sudo ip link set can0 up
- For CAN classic setup (example for 500 kbps, 87.5% sample point, bus error reporting):