From 8af69a5d1ba61fbbdcbac6a8887631f852309a86 Mon Sep 17 00:00:00 2001 From: Alex Shepherd Date: Sun, 20 Oct 2019 00:45:58 -0400 Subject: [PATCH] Added SocketCAN support to the hub application on the Raspberry Pi --- applications/hub/targets/linux.rpi1/README.md | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 applications/hub/targets/linux.rpi1/README.md diff --git a/applications/hub/targets/linux.rpi1/README.md b/applications/hub/targets/linux.rpi1/README.md new file mode 100644 index 000000000..b2c866806 --- /dev/null +++ b/applications/hub/targets/linux.rpi1/README.md @@ -0,0 +1,36 @@ +# Adding SocketCAN support on the Raspberry Pi 4 + +These are my notes from adding SocketCAN support and building the **hub** application in a Raspberry Pi. + +- Start with the pre-built JMRI - RPI disk image from: [M Steve Todd's - JMRI RaspberryPi as Access Point](https://mstevetodd.com/rpi) + +- Install the MCP2517 CAN interface hardware from: [2-Channel CAN-BUS(FD) Shield for Raspberry Pi](https://www.seeedstudio.com/2-Channel-CAN-BUS-FD-Shield-for-Raspberry-Pi-p-4072.html) and followed their instructions for building the MCP2517 kernel device driver on their [Support Wiki](http://wiki.seeedstudio.com/2-Channel-CAN-BUS-FD-Shield-for-Raspberry-Pi/#software) page. + +- Install some needed packages on the RPi: + + `sudo apt install git doxygen libavahi-client-dev` + +- Download the OpenMRN source code to the RPi: + + `cd ~` + + `git clone https://github.com/bakerstu/openmrn.git` + +- Build the **hub** application: + + `cd openmrn/applications/hub/targets/linux.rpi1/` + + `make` + +- Configure the **can0** interface for 125,000 bps and run the **hub** application at system at start-up by creating the file: `/etc/network/interfaces.d/can0` with the following lines: + ``` + allow-hotplug can0 + iface can0 can static + bitrate 125000 + up /home/pi/openmrn/applications/hub/targets/linux.rpi1/hub -s $IFACE & + ``` + +- Configure the LCC Layout Connection in JMRI to use + - System Connection: `CAN via GridConnect Network Interface` + - IP Address/Host Name: `localhost` + - TCP/UDP Port: `12021`