diff --git a/docs/build/index.md b/docs/build/index.md index 9ff9ffcd5e7dd57559cf22888c7e850ea1baef0f..5d7908c7971676338149556688734518be4c825e 100644 --- a/docs/build/index.md +++ b/docs/build/index.md @@ -42,8 +42,8 @@ - [`Base.read`](lib/functions.md#Base.read) - [`Base.read`](lib/functions.md#Base.read) - [`LabConnections.BeagleBone.assert_pwm_write`](lib/functions.md#LabConnections.BeagleBone.assert_pwm_write-Tuple{Int32,String}) -- [`LabConnections.BeagleBone.bbparse`](lib/functions.md#LabConnections.BeagleBone.bbparse-Tuple{Any}) - [`LabConnections.BeagleBone.bbparse`](lib/functions.md#LabConnections.BeagleBone.bbparse-Tuple{Tuple,Any}) +- [`LabConnections.BeagleBone.bbparse`](lib/functions.md#LabConnections.BeagleBone.bbparse-Tuple{Any}) - [`LabConnections.BeagleBone.closedev`](lib/functions.md#LabConnections.BeagleBone.closedev-Tuple{String,Int32}) - [`LabConnections.BeagleBone.export_gpio`](lib/functions.md#LabConnections.BeagleBone.export_gpio-Tuple{Int32}) - [`LabConnections.BeagleBone.export_led`](lib/functions.md#LabConnections.BeagleBone.export_led) diff --git a/docs/build/lib/functions.md b/docs/build/lib/functions.md index 36fff7057d1794b377460b6d2baa49fb8081d2c0..b929ebcaa893bba0ac30bc2a3ef9fe288f8a17e6 100644 --- a/docs/build/lib/functions.md +++ b/docs/build/lib/functions.md @@ -2,8 +2,8 @@ - [`Base.read`](functions.md#Base.read) - [`Base.read`](functions.md#Base.read) - [`LabConnections.BeagleBone.assert_pwm_write`](functions.md#LabConnections.BeagleBone.assert_pwm_write-Tuple{Int32,String}) -- [`LabConnections.BeagleBone.bbparse`](functions.md#LabConnections.BeagleBone.bbparse-Tuple{Any}) - [`LabConnections.BeagleBone.bbparse`](functions.md#LabConnections.BeagleBone.bbparse-Tuple{Tuple,Any}) +- [`LabConnections.BeagleBone.bbparse`](functions.md#LabConnections.BeagleBone.bbparse-Tuple{Any}) - [`LabConnections.BeagleBone.closedev`](functions.md#LabConnections.BeagleBone.closedev-Tuple{String,Int32}) - [`LabConnections.BeagleBone.export_gpio`](functions.md#LabConnections.BeagleBone.export_gpio-Tuple{Int32}) - [`LabConnections.BeagleBone.export_led`](functions.md#LabConnections.BeagleBone.export_led) @@ -56,7 +56,7 @@ Reads the current brightness value from the LED 'SysLED'. ```julia -l = read(pwm::PWM, operation::Int32, debug::Bool=false) +l = read(gpio::GPIO, operation::Int32, debug::Bool=false) ``` Reads the current value from an operation on a GPIO. @@ -67,7 +67,7 @@ Reads the current value from an operation on a GPIO. ```julia -l = read(gpio::GPIO, operation::Int32, debug::Bool=false) +l = read(pwm::PWM, operation::Int32, debug::Bool=false) ``` Reads the current value from an operation on a GPIO. @@ -103,7 +103,7 @@ Parse and execute the command `cmd`. bbparse(l::Tuple, sock) ``` -Parse input on the form `l=(iswrite, ndev, cmd1, cmd2, ..., cmdn)` where if `iswrite` `cmdi = (devname, id, val)` and if not `iswrite` `cmdi = (devname, id)` and send back on socket (vals, timestamps). +Parse input on the form `l=(operation, ndev, cmd1, cmd2, ..., cmdn)` where if `operation==1` (write) `cmdi = (devname, id, val)` and if `operation==0` (read) `cmdi = (devname, id)` and if `operation==2` (initialize) `cmdi = (devname, id)` and send back on socket (vals, timestamps). <a id='LabConnections.BeagleBone.closedev-Tuple{String,Int32}' href='#LabConnections.BeagleBone.closedev-Tuple{String,Int32}'>#</a> **`LabConnections.BeagleBone.closedev`** — *Method*. @@ -199,10 +199,10 @@ Prints all the active devices and writes out specifics of a single devices. ```julia -teardown(led::SysLED, debug::Bool=false) +teardown(gpio::GPIO, debug::Bool=false) ``` -Closes all open filestreams for the SysLED 'led'. +Closes all open streams on the GPIO, and unexports it from the file system. <a id='LabConnections.BeagleBone.teardown' href='#LabConnections.BeagleBone.teardown'>#</a> **`LabConnections.BeagleBone.teardown`** — *Function*. @@ -210,10 +210,10 @@ Closes all open filestreams for the SysLED 'led'. ```julia -teardown(gpio::GPIO, debug::Bool=false) +teardown!(pwd::PWM) ``` -Closes all open streams on the GPIO, and unexports it from the file system. +Closes all open streams on the PWM, and unexports it from the file system <a id='LabConnections.BeagleBone.teardown' href='#LabConnections.BeagleBone.teardown'>#</a> **`LabConnections.BeagleBone.teardown`** — *Function*. @@ -221,10 +221,10 @@ Closes all open streams on the GPIO, and unexports it from the file system. ```julia -teardown!(pwd::PWM) +teardown(led::SysLED, debug::Bool=false) ``` -Closes all open streams on the PWM, and unexports it from the file system +Closes all open filestreams for the SysLED 'led'. <a id='LabConnections.BeagleBone.to_string' href='#LabConnections.BeagleBone.to_string'>#</a> **`LabConnections.BeagleBone.to_string`** — *Function*. @@ -232,7 +232,7 @@ Closes all open streams on the PWM, and unexports it from the file system ```julia -to_string(led::SysLED, debug::Bool=false) +to_string(gpio::GPIO, debug::Bool=false) ``` Generates a string representation of the GPIO device. @@ -243,7 +243,7 @@ Generates a string representation of the GPIO device. ```julia -to_string(gpio::GPIO, debug::Bool=false) +to_string(pwm::PWM,, debug::Bool=false) ``` Generates a string representation of the GPIO device. @@ -254,7 +254,7 @@ Generates a string representation of the GPIO device. ```julia -to_string(pwm::PWM,, debug::Bool=false) +to_string(led::SysLED, debug::Bool=false) ``` Generates a string representation of the GPIO device. @@ -265,10 +265,10 @@ Generates a string representation of the GPIO device. ```julia -write!(gpio::GPIO, args::Tuple{Int32,String}, debug::Bool=false) +write!(led::SysLED, val::Bool, debug::Bool=false) ``` -Writes an entry to an operation on a GPIO, of the form args = (operation, entry). +Turns the LED 'SysLed' on/off for val = true/false respectively. <a id='LabConnections.BeagleBone.write!' href='#LabConnections.BeagleBone.write!'>#</a> **`LabConnections.BeagleBone.write!`** — *Function*. @@ -276,10 +276,10 @@ Writes an entry to an operation on a GPIO, of the form args = (operation, entry) ```julia -write!(led::SysLED, val::Bool, debug::Bool=false) +write!(gpio::GPIO, args::Tuple{Int32,String}, debug::Bool=false) ``` -Turns the LED 'SysLed' on/off for val = true/false respectively. +Writes an entry to an operation on a GPIO, of the form args = (operation, entry). <a id='LabConnections.BeagleBone.write!' href='#LabConnections.BeagleBone.write!'>#</a> **`LabConnections.BeagleBone.write!`** — *Function*. diff --git a/docs/build/man/installation.md b/docs/build/man/installation.md index 3ba1d5f8650b60859ba3601ad86803c4f37c4034..99b697bde7778c835ac18b01c7efb759c5d849da 100644 --- a/docs/build/man/installation.md +++ b/docs/build/man/installation.md @@ -4,12 +4,38 @@ # Installation instructions -In these instructions we explain how to set up a working environment on a host computer and a BeagleBone Black (BBB). If you already have a prepared micro-SD card for flashing a BBB, then you can safely skip the first section of these instructions. +In these instructions we explain how to set up a working environment on a host computer and a BeagleBone Black (BBB). + + +<a id='Host-computer-setup-1'></a> + +## Host computer setup + + +<a id='Installing-Julia-and-LabConnections.jl-1'></a> + +### Installing Julia and LabConnections.jl + + +To get started, first install Julia v1.0.X on the host computer running a Linux distribution by following the instructions specified [here](https://github.com/JuliaLang/julia/blob/master/README.md). Once Julia is installed, open up a Julia REPL and add LabConnections.jl using the package manager by typing + + +``` +] add https://gitlab.control.lth.se/labdev/LabConnections.jl#julia1 +``` + + +You now have the LabConnections.jl package available on the host computer. Note that for Julia v1.0.X it is the branch `julia1` of the package that should be used. + + +<a id='BeagleBone-setup-1'></a> + +## BeagleBone setup <a id='Preparing-a-micro-SD-card-1'></a> -## Preparing a micro-SD card +### Preparing a micro-SD card First, we will prepare a micro-SD card with an image of Debian and a binary of Julia, which we then can flash onto the BBB. @@ -31,15 +57,15 @@ The final step is to make sure that the micro-SD will automatically flash the De <a id='Flashing-the-BeagleBone-1'></a> -## Flashing the BeagleBone +### Flashing the BeagleBone Insert a prepared micro-SD card in the slot on the BBB, and press down the boot button S2 (the button closest to the micro-SD slot) and hold it down while you plug in the USB-cable to the BBB. Keep the S2 button held down for a couple of seconds, until the onboard LEDs start to blink. After a short while the onboard LEDs should start to blink in a wave pattern, indicating that the BBB is being flashed. After a while (can vary between 5-45 minutes) the BBB will be turn off automatically, indicating that the flashing is complete. Remove the micro-SD before powering on the BBB again (otherwise it will start to flash the BBB again). -<a id='Trying-out-the-BeagleBone-1'></a> +<a id='Accessing-the-BeagleBone-1'></a> -## Trying out the BeagleBone +### Accessing the BeagleBone Now your BBB should be ready to use. Log on to the BeagleBone via SSH by opening a terminal and typing @@ -61,79 +87,94 @@ The default password is `temppwd`. You are now logged in to the BBB running Debi If the Julia REPL starts up correctly, then you have a functioning BBB ready for use with the LabConnections.jl package. -<a id='Setting-up-the-host-computer-1'></a> +<a id='Getting-LabConnections.jl-on-the-BeagleBone-1'></a> -## Setting up the host computer +### Getting LabConnections.jl on the BeagleBone -To get started, first install Julia v1.0.X on the host computer running a Linux distribution by following the instructions specified [here](https://github.com/JuliaLang/julia/blob/master/README.md). Once Julia is installed, run +To update the BBB with the latest revision of the code, ``` -using Pkg -`Pkg.clone(https://gitlab.control.lth.se/labdev/LabConnections.jl)' +`cd && cd .julia/v0.6/LabConnection/util' +`./flash_BB.sh' ``` -in the Julia REPL to install all dependencies on the host computer. The source code is then located in `./julia/v1.0/LabConnections'. +This scripts bundles the current code in LabConnections (and serbus, see SPI development below) on the host computer and transfers it to the /home/debian/juliapackages directory on the BBB. + + +<a id='Setting-up-automatic-communication-1'></a> + + +<a id='Setting-up-automatic-communication-1'></a> +### Setting up automatic communication -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 + +To setup automatic start of Julia server on the BB, make sure to have completed all prior installation instructions, and that the latest revision of the LabConnections package is located on the BB. SSH to the BeagleBone and copy the julilaserver.service to the systemd/system ``` -`cd && cd .julia/v0.6' -`git clone https://github.com/mgreiff/serbus' +`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) ``` -to get the latest revision of the serbus fork. +Then execute the commands -To update the BB with the latest revision of the code, +`sudo systemctl enable juliaserver` (on the BeagleBone) `sudo systemctl start juliaserver` (on the BeagleBone) -``` -`cd && cd .julia/v0.6/LabConnection/util' -`./flash_BB.sh' -``` +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, and you should be able to run the examples in in /Examples on the host computer. -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. +<a id='Package-Development-1'></a> +## Package Development -<a id='Setting-up-automatic-communication-1'></a> +<a id='LabConnections.jl-Development-1'></a> -<a id='Setting-up-automatic-communication-1'></a> +### LabConnections.jl Development -## Setting up automatic communication +If you want to develop the code in LabConnections.jl, then this is how you setup a development environment. First, open up a Julia REPL and type -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 + +``` +] dev https://gitlab.control.lth.se/labdev/LabConnections.jl +``` + + +Open a new terminal and navigate to `.julia/dev/LabConnections`, where the package source code is now located. Then type ``` -`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) +git checkout julia1 +git pull ``` -Then execute the commands +to ensure that you are working on the correct development branch for Julia v1.0.X. -`sudo systemctl enable juliaserver` (on the BeagleBone) `sudo systemctl start juliaserver` (on the BeagleBone) +<a id='SPI-Development-1'></a> +### SPI Development -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, and you should be able to run the examples in in /Examples on the host computer. +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 -```@systemConfiguration +``` +`cd && cd .julia/v0.6' +`git clone https://github.com/mgreiff/serbus' ``` -<a id='Debugging-1'></a> +to get the latest revision of the serbus fork. <a id='Debugging-1'></a> diff --git a/docs/src/man/installation.md b/docs/src/man/installation.md index 29ccd1467294819aafd4742fb66fe62c76b02f26..193b545c153b399e8ee2995512d88484c40d8194 100644 --- a/docs/src/man/installation.md +++ b/docs/src/man/installation.md @@ -1,9 +1,20 @@ # Installation instructions In these instructions we explain how to set up a working environment on a host computer and -a BeagleBone Black (BBB). If you already have a prepared micro-SD card for flashing a BBB, -then you can safely skip the first section of these instructions. +a BeagleBone Black (BBB). -## Preparing a micro-SD card +## Host computer setup + +### Installing Julia and LabConnections.jl + +To get started, first install Julia v1.0.X on the host computer running a Linux distribution by following the instructions specified [here](https://github.com/JuliaLang/julia/blob/master/README.md). Once Julia is installed, open up a Julia REPL and add LabConnections.jl using the package manager by typing +``` +] add https://gitlab.control.lth.se/labdev/LabConnections.jl#julia1 +``` +You now have the LabConnections.jl package available on the host computer. Note that for Julia v1.0.X it is the branch `julia1` of the package that should be used. + +## BeagleBone setup + +### Preparing a micro-SD card First, we will prepare a micro-SD card with an image of Debian and a binary of Julia, which we then can flash onto the BBB. Start by downloading the Debian image [here](http://beagleboard.org/latest-images) (Debian 9.5 2018-10-07 4GB SD IoT) and write the image onto a micro-SD card ([this guide](http://derekmolloy.ie/write-a-new-image-to-the-beaglebone-black/) is helpful). @@ -16,10 +27,10 @@ The file structure on the micro-SD now has the correct structure. The final step is to make sure that the micro-SD will automatically flash the Debian image onto the BBB when booting up. To do this, follow the instructions found [here](https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Flashing_eMMC). Congratulations, you now have a prepared micro-SD card ready for flashing a BBB. -## Flashing the BeagleBone +### Flashing the BeagleBone Insert a prepared micro-SD card in the slot on the BBB, and press down the boot button S2 (the button closest to the micro-SD slot) and hold it down while you plug in the USB-cable to the BBB. Keep the S2 button held down for a couple of seconds, until the onboard LEDs start to blink. After a short while the onboard LEDs should start to blink in a wave pattern, indicating that the BBB is being flashed. After a while (can vary between 5-45 minutes) the BBB will be turn off automatically, indicating that the flashing is complete. Remove the micro-SD before powering on the BBB again (otherwise it will start to flash the BBB again). -## Trying out the BeagleBone +### Accessing the BeagleBone Now your BBB should be ready to use. Log on to the BeagleBone via SSH by opening a terminal and typing ``` ssh debian@192.168.7.2 @@ -31,48 +42,20 @@ You can now start a Julia REPL on the BBB by typing ``` If the Julia REPL starts up correctly, then you have a functioning BBB ready for use with the LabConnections.jl package. -## Setting up the host computer - - -To get started, first install Julia v1.0.X on the host computer running a Linux distribution by following the instructions specified [here](https://github.com/JuliaLang/julia/blob/master/README.md). Once Julia is installed, run -``` -using Pkg -`Pkg.clone(https://gitlab.control.lth.se/labdev/LabConnections.jl)' -``` -in the Julia REPL to install all dependencies on the host computer. The source code is then located in `./julia/v1.0/LabConnections'. - - -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' -``` - - -to get the latest revision of the serbus fork. - - -To update the BB with the latest revision of the code, - +### Getting LabConnections.jl on the BeagleBone +To update the BBB with the latest revision of the code, ``` `cd && cd .julia/v0.6/LabConnection/util' `./flash_BB.sh' ``` - - -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. +This scripts bundles the current code in LabConnections (and serbus, see SPI development below) on the host computer and transfers it to the /home/debian/juliapackages directory on the BBB. <a id='Setting-up-automatic-communication-1'></a> -## 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 - +### 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 latest 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' @@ -82,19 +65,33 @@ To setup automatic start of Julia server on the BB, make sure to have completed Then execute the commands - `sudo systemctl enable juliaserver` (on the BeagleBone) `sudo systemctl start juliaserver` (on the BeagleBone) - 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, and you should be able to run the examples in in /Examples on the host computer. +## Package Development -```@systemConfiguration +### LabConnections.jl Development +If you want to develop the code in LabConnections.jl, then this is how you setup a development environment. First, open up a Julia REPL and type +``` +] dev https://gitlab.control.lth.se/labdev/LabConnections.jl +``` +Open a new terminal and navigate to `.julia/dev/LabConnections`, where the package source code is now located. Then type ``` +git checkout julia1 +git pull +``` +to ensure that you are working on the correct development branch for Julia v1.0.X. +### SPI Development -<a id='Debugging-1'></a> +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' +``` +to get the latest revision of the serbus fork. ## Debugging