From d2a470344c7cbf2455c9a6770189a7d911b4c763 Mon Sep 17 00:00:00 2001
From: mgreiff <marcusgreiff.93@hotmail.com>
Date: Mon, 18 Dec 2017 14:36:25 +0100
Subject: [PATCH] Verified the installation instructions with a new BB

---
 docs/src/installation.md          | 64 +++++++++++++++++++++----------
 src/BeagleBone/startup/README.md  | 18 +++++----
 src/BeagleBone/startup/install.sh |  2 +-
 3 files changed, 54 insertions(+), 30 deletions(-)

diff --git a/docs/src/installation.md b/docs/src/installation.md
index 4b62693..29905d4 100644
--- a/docs/src/installation.md
+++ b/docs/src/installation.md
@@ -1,41 +1,63 @@
 # Installation Instructions
 
-## On the HOST
-To get started, first install julia v0.6.X on the PC running a Linux distribution by following the instructions specified [here](https://github.com/JuliaLang/julia/blob/master/README.md). So far, the system has only been testen on Ubuntu 14.* and 16.*.
+## On the BBB
+On the BeagleBone, first flash it with a Debian image for 32 bit ARM processors
+(BeagleBoard.org Debian Image 2017-03-19) using a micro-SD by following [this guide](http://derekmolloy.ie/write-a-new-image-to-the-beaglebone-black/).
+You may also include a Julia v0.6 tarball, alternatively transferring it
+using after an installation.
 
-Once julia is installed julia, run
+If using the provided SD card, flash the BB by holding down S2 for about 5
+seconds while connecting the BB to 5V power. Keep the button pressed until the
+four system LEDs (D2/D3/D4/D5) start blinking in a periodical sequence. Leave
+the BB alone for 15-20 minutes while flashing, until all four lights are turned
+off (or on). Power off the BB, remove the SD card, and power it on again.
 
-    `Pkg.clone(https://gitlab.control.lth.se/labdev/LabConnections.jl)'
-    `Pkg.add("YAML")'
+Log on to the BB via SSH by
 
-in the julia prompt to install all dependencies on the HOST.
+    `ssh debian@192.168.7.2'
 
-## On the BeagleBone
-On the BeagleBone, first install Debian for 32 bit ARM processors using a micro-SD by following [this guide](http://derekmolloy.ie/write-a-new-image-to-the-beaglebone-black/). You may also include a julia v0.6 tarball, alternatively transferring it using after an installation.
+an unpack the tarball. Julia should now be operational by running
 
-If chosing the latter, connect the BB and download the julia tarball for ARM (ARMv7 32-bit hard float) from [here](https://julialang.org/downloads/) and scp it to /home/debian/ on the BB. Run
+    `/home/debian/julia-<distro specific tag>/bin/julia'
 
-    `cd ~/Downloads'
-    `scp -r julia-0.6.0-linux-arm.tar.gz debian@192.168.7.2:/home/debian'
+and before leaving the BB, remove the distibution specific tag by renaming
 
-next, log on to the BB via SSH by running
+    `mv /home/debian/julia-<distro specific tag>/bin/julia /home/debian/julia/bin/julia'
 
-    `ssh debian@192.168.7.2'
+## On the HOST
+To get started, first install Julia v0.6.X on the PC running a Linux
+distribution by following the instructions specified
+[here](https://github.com/JuliaLang/julia/blob/master/README.md). So far, the
+system has only been tested on Ubuntu 14.04 and 16.04.
 
-an unpack the tarball. Julia should now be operational by running
+Once Julia is installed, run
 
-    `/home/debian/julia-<distro specific tag>/bin/julia'
+    `Pkg.clone(https://gitlab.control.lth.se/labdev/LabConnections.jl)'
 
-Next, open a new terminal on the HOST and cd to the /util directory of the LabConnection package by running in the julia package folder
+in the Julia prompt to install all dependencies on the HOST, the source code
+is then located in `./julia/v0.6/LabCOnnections'.
 
-    `cd && cd .julia/v0.6/LabConnection/util'
+If you plan on working with the SPI devices to debug the ADC/DAC, then you will
+need a forked `serbus' repository which wraps the `linux/spi/spidev'. Simply
+
+    `cd && cd .julia/v0.6'
+    `git clone https://github.com/mgreiff/serbus'
 
-This directory contains some nice utility files to operate the BB from the host. To flash it with the current revision of the software, including all dependencies, simply execut the shells cript `flash.sh'.
+to get the latest revision of the serbus fork.
+
+To update the BB with the latest revision of the code,  
+
+    `cd && cd .julia/v0.6/LabConnection/util'
+    `./flash_BB.sh'
 
-![block diagram](flashBB.png)
+This scripts bundles the current code in LabCOnnections and serbus on the host
+computer and transfers it to the /home/debian/juliapackages directory on the BB.
 
-## Setting up automatic communication between the BB and the HOST via TCP
-To setup automatic start of Julia server on the BB, make sure to have completed all prior installation instructions. SSH to the BeagleBone and copy the julilaserver.service to the systemd/system
+## Setting up automatic communication
+To setup automatic start of Julia server on the BB, make sure to have completed
+all prior installation instructions, and that the lates revision of the
+LabConnections package is located on the BB. SSH to the BeagleBone and copy the
+julilaserver.service to the systemd/system
 
     `ssh debian@192.168.7.2'
     `sudo cp -r /home/debian/juliapackets/LabConnections/src/BeagleBone/startup/juliaserver.service /lib/systemd/system/juliaserver.service` (on the BeagleBone)
diff --git a/src/BeagleBone/startup/README.md b/src/BeagleBone/startup/README.md
index 569c38e..56ded3d 100644
--- a/src/BeagleBone/startup/README.md
+++ b/src/BeagleBone/startup/README.md
@@ -1,10 +1,12 @@
 To setup automatic start of julia server on the beagle bone
-1. Make sure that julia is installed in `/home/debian/julia/bin/julia` on the BeagleBone or edit `juliaserver.service` accordingly
-2. Create the folder `/home/debian/juliapackages/` on the BeagleBone
-3. On the computer, go to `LabConnections/util` and run `./copyfoldertobb.sh`
-    - If this failes, make sure that there is not already a folder `/home/debian/juliapackages/LabConnections`
-1. Run `install.sh` on the BB
+1. Make sure that julia is installed in `/home/debian/julia/bin/julia` on the
+BeagleBone or edit `juliaserver.service` accordingly
+2. Create the folder `/home/debian/juliapackages/` on the BeagleBone (if it
+    doesn't exist already)
+3. On the HOST, go to `LabConnections/util` and transfer the latest revision of
+the LabConnections package to the BB
+4. Run `install.sh` on the BB
 
-After a while, the BeagleBone should start blinking on SysLED 2: on-off-on-sleep-repeat
-
-The server should now start automatically on restart of the BeagleBone.
+After a while, the BeagleBone should start blinking on SysLED 2, with
+on-off-on-sleep-repeat. The server should now start automatically on restart of
+the BeagleBone.
diff --git a/src/BeagleBone/startup/install.sh b/src/BeagleBone/startup/install.sh
index 55a10d4..3d8585f 100644
--- a/src/BeagleBone/startup/install.sh
+++ b/src/BeagleBone/startup/install.sh
@@ -1,4 +1,4 @@
 #!/bin/bash
-sudo cp LabConnections/src/BeagleBone/startup/juliaserver.service /lib/systemd/system/juliaserver.service
+sudo cp /home/debian/juliapackages/LabConnections/src/BeagleBone/startup/juliaserver.service /lib/systemd/system/juliaserver.service
 sudo systemctl enable juliaserver
 sudo systemctl start juliaserver
-- 
GitLab