Installing Raspian and enabling CAN bus
micro SD card setup
- Download Raspian Lite from: https://www.raspberrypi.org/downloads/raspbian/
- Flash image to micro SD card, for example using: Etcher
- Add empty text file named
ssh
to the boot partition of the micro SD card, this enables ssh communication with the Pi.
Basic Raspian setup
- Insert the micro SD card to the Raspberry Pi and power it on. Use an ethernet cable to connect.
- Access ssh on the Raspberry. Default username is
pi
, password israspberry
, and hostname israspberrypi
. - Run
sudo raspi-config
and change password and timezone. Perhaps also run an update.
CAN setup for StratoPi CAN
- Run
sudo raspi-config
and enable SPI - Add these lines to the end of
/boot/config.txt
:
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25 dtoverlay=spi-bcm2835-overlay
- Add these lines to the end of
/etc/network/interfaces
for CAN to automatically start at boot with bitrate 125kbps(used by Torqeedo Interface Card):
auto can0 iface can0 inet manual pre-up /sbin/ip link set can0 type can bitrate 125000 up /sbin/ifconfig can0 up down /sbin/ifconfig can0 down
- Reboot
Non-root access to serial ports
- Add user to
dialout
group
sudo usermod -a -G dialout $USER
- May also need to add user to
tty
group.
sudo usermod -a -G tty $USER