Setup CAN board - Stu-emhTrade/sailmate GitHub Wiki

Set up Canbus

Wire the NMEA 2000 network to the board. CAN-hi = White, CAN-lo = blue, ground = black, don't wire in the 12v network power.

Instructions here: http://skpang.co.uk/catalog/images/raspberrypi/pican/PICAN3_UGA_10.pdf

download CAN Utils sudo apt-get install can-utils open a CAN bus socket sudo /sbin/ip link set can0 up type can bitrate 250000

test that the pi is on the network using candump can0

This should output a stream of network data. Note: at least one other device needs to be on the network obviously.

Once the drivers are installed, edit the startup script to include setting up the CANbus socket on startup.

sudo nano /etc/rc.local

Add sudo /sbin/ip link set can0 up type can bitrate 250000 to the bottom.

Set up the RTC

Install the i2c-tools by: sudo apt-get install i2c-tools Then check the RTC: sudo i2cdetect -y 1 You should see 68 or UU on address 0x68:

Add the overlays with sudo nano /boot/config.txt

Add these lines to the end of file:

dtparam=i2c_arm=on
dtoverlay=i2c-rtc,pcf8523

Reboot Pi: sudo reboot

Now you need to disable the "fake hwclock" which interferes with the 'real' hwclock

sudo apt-get -y remove fake-hwclock
sudo update-rc.d -f fake-hwclock remove
sudo systemctl disable fake-hwclock

Start the original hw clock script by: sudo nano /lib/udev/hwclock-set

and comment out these three lines:

#if [ -e /run/systemd/system ] ; then
# exit 0
#fi

and these two lines:

#/sbin/hwclock --rtc=$dev --systz --badyear
#/sbin/hwclock --rtc=$dev --systz

reboot sudo reboot

check the RTC has set itself from the network (need a network connected). sudo timedatectl status

set the system timezone to NZ sudo timedatectl set-timezone Pacific/Auckland