@ismith wrote a bash script that automates a bunch of the software setup to be done if you're using:
- debian trixie
- rpi 3b+
- pican 2
TODO:
the bash script
#!/bin/bash
set -euxo pipefail
# Tested on debian trixie
# Allow sudo with no password
echo 'pi ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/010_pi-nopasswd
sudo chmod 0440 /etc/sudoers.d/010_pi-nopasswd
# Install vim, screen, git (our preferences) and canutils, python3-can (open-rnet's requirements)
# Note: use apt to install python-can, not pip, because python packages on raspbian/trixie default to 'externally managed'.
sudo apt update && sudo apt install -y \
vim screen git \
can-utils python3-can
# Firmware config/overlay for the PiCAN 2
# Note: -overlay suffix not needed in modern kernel, and spi-bcm2835 not needed at all
cat <<EOF >> /boot/firmware/config.txt
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=spi-bcm2835
EOF
# Make the can0 network device work on boot, don't need to manually add each time
touch /etc/systemd/network/80-can0.network
cat <<EOF >> /etc/systemd/network/80-can0.network
[Match]
Name=can0
[CAN]
BitRate=125000
EOF
sudo systemctl enable systemd-networkd
# If we don't already have can2RNET, clone it
[ ! -d ~/can2RNET ] && git clone https://github.com/redragonx/can2RNET.git ~/can2RNET
cat <<EOF
=======================
WHAT'S NEXT?
=======================
1. Reboot:
sudo reboot
2. Check: if you run
dmesg | grep -i can
dmesg | grep -i mcp
You should see messages about mcp251x registering successfully.
=======================
EOF
@ismith wrote a bash script that automates a bunch of the software setup to be done if you're using:
TODO:
the bash script