User Tools

Site Tools


rocnet:rocnetnode-build-en

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

rocnet:rocnetnode-build-en [2018/11/12 08:56] (current)
Line 1: Line 1:
 +====== RocNetNode Build from source======
 +[[:​english#​command_stations|{{ ​ :​interface.png}}]][[:​english|{{ ​ :​rocrail-logo-35.png}}]][[:​rocnet:​rocnetnode-en|{{ :​rocnet:​rocnet-hw.png}}]]
 +[[:​rocnet:​rocnetnode-en|{{ icons:​uk.png}}]][[:​rocnet:​rocnetnode-de|{{ icons:​de.png}}]]
 +[[:​english|Content]] -> [[:​english#​command_stations|Command Stations]] ->  **[[rocnet:​rocnet-prot-en|RocNet]]** ​
 +  * [[rocnet:​rocnet-prot-en|RocNet Protocol]] | **[[:​rocnet:​rocnetnode-en|RocNetNode]]**
 +    * [[:​rocnet:​rocnetnode-hwsetup-en|RocNetNode Setup]] | [[:​rocnet:​rocnetnode-setup-en|RocNetNode Configuration]] | [[:​rocnet:​rocnetnode-img-en|Installer package]]
 +  * [[:​gca:​gca-index-en#​raspbery_pi_rocnet_boards|Raspberry Pi Boards]]
 +    * [[:​gca1-pi01-en|GCA-Pi01]] | [[:​gca_pi02-en|GCA-Pi02]] | [[:​gca-pi03-en|GCA-PI03]] | [[:​gca-pi04-en|GCA-PI04]] | [[:​GCA-PI06-en|GCA-PI06]] | [[:​GCA-PI07-en|GCA-PI07]] | [[:​gca107-en|GCA107 Relay board]]
 +  * **[[:​rocnet:​rocnetnode-build-en|Build from source]]** | [[:​raspi:​raspi-dev-en|RasPi as Rocrail server]]
 +
 +
 + \\
 +
 +===== Build =====
 +Read first: __**[[:​raspi:​raspi-dev-en|RasPi Dev]]**__\\
 +:!: Do **not** install libi2c-dev; It will break the build process and the needed C-Headers and libraries are already available in the RaspBian image.\\
 +The Rocrail Server build also includes the RocNetNode:
 +<​code>​
 +make server
 +sudo make install
 +</​code>​
 +The binary is written in //​Rocrail/​unxbin//​.\\
 +The rocnetnode.ini can be copied from //​Rocrail/​rocnetnode/​package/​rocnetnode.ini//​.\\
 +
 +====Install====
 +<​code>​
 +cd rocnetnode
 +sudo make install
 +</​code>​
 +This will copy following files to **/​opt/​rocnet**:​
 +  * rocnetnode
 +  * rocnetnode.ini
 +  * rocnetnode.sh
 +
 + \\
 +
 +===== Startup =====
 +  - The rocnetnode.ini and dcc232 library must reside in the working directory.
 +  - To be able to access the **/​dev/​mem** and **/​dev/​i2c-x** the program must be started with sudo:
 +
 +<​code>​
 +20130825.214751.623 r9999I main     ​raspi ​   0068 setup RasPi I/O 0x00000001
 +20130825.214751.624 r9999E main     ​raspi ​   0072 can't open /dev/mem
 +</​code>​
 +
 +Sudo startup in the unxbin directory:
 +<​code>​
 +sudo ./​rocnetnode
 +</​code>​
 +
 + \\
 +
 +
 +==== rocnetnode.ini ====
 +See: __**[[:​gca1-pi01-en#​mapping|Port mapping]]**__\\
 +<code xml>
 +<​rnnode>​
 +  <rocnet id="​4711"​ addr="​224.0.0.1"​ port="​4321">​
 +    <​rocnetnodeoptions iotype="​0"​ sack="​true"/>​
 +    <​portsetup port="​1"​ type="​1"​ delay="​200"/>​
 +    <​portsetup port="​2"​ type="​1"​ delay="​200"/>​
 +    <​portsetup port="​3"​ type="​1"​ delay="​200"/>​
 +    <​portsetup port="​4"​ type="​1"​ delay="​200"/>​
 +    <​portsetup port="​5"​ type="​1"​ delay="​200"/>​
 +    <​portsetup port="​6"​ type="​1"​ delay="​200"/>​
 +    <​portsetup port="​7"​ type="​1"​ delay="​200"/>​
 +    <​portsetup port="​8"​ type="​1"​ delay="​200"/>​
 +    <​portsetup port="​9"​ type="​0"​ delay="​0"/>​
 +    <​portsetup port="​10"​ type="​0"​ delay="​0"/>​
 +    <​portsetup port="​11"​ type="​0"​ delay="​0"/>​
 +    <​portsetup port="​12"​ type="​0"​ delay="​0"/>​
 +    <​portsetup port="​13"​ type="​1"/>​
 +    <​portsetup port="​14"​ type="​1"/>​
 +    <​portsetup port="​15"​ type="​1"/>​
 +    <​portsetup port="​16"​ type="​1"/>​
 +  </​rocnet>​
 +  <trace rfile="​rocnetnode"​ protpath=""​ debug="​false"​ info="​false"​ calc="​true"​ byte="​false"/>  ​
 +  <digint lib="​dcc232"​ iid="​dcc-1"​ device="/​dev/​ttyUSB0"/>​
 +</​rnnode>​
 +</​code>​
 +=== rocnet ===
 +^ Attribute ^ Description ^ Range ^ Default ^
 +| id | RocNet ID | 0-65535 | 0 |
 +| addr | Multicast address | * | 224.0.0.1 |
 +| port | Multicast port | 0-65535 | 4321 |
 +\\
 +
 +=== rocnetnodeoptions ===
 +^ Attribute ^ Description ^ Range ^ Default ^
 +| iotype | I/O type | 0=i2c-1, 1=i2c-0 | 0 |
 +| sack | Sensor acknowledge | true/false | false |
 +| rfid | Activate ID-12 reading | true/false | false |
 +For Raspberry Pi Rev. 1 use I2C-0 as device.\\
 +\\
 +
 +=== portsetup ===
 +^ Attribute ^ Description ^ Range ^ Default ^ Remark ^
 +| port | logical port number to be used for Rocrail addressing | 1-128 | 1 | |
 +| type | I/O type | 0=output, 1=input | 0 | |
 +| delay | Input delayed off for occupancy((Minimal pulse length 100ms.)), or output pulse time. | 0-255 | 0 | 10ms units, 0=not used |
 +| state | saved output state | 0=off, 1=on | 0 | Saved at a Power Off command. |
 +
 +
 + \\
 +
 +==== DCC232 Device ====
 +To be able to generate a usable DCC signal the internal RS232 cannot be used.\\
 +The best way is to attach a __**[[:​dcc232-en#​ubuntu_10.10|FDTI USB-RS232]]**__ converter to the USB connector.\\
 +<​code>​
 +Bus 001 Device 004: ID 0403:6001 Future Technology Devices International,​ Ltd FT232 USB-Serial (UART) IC 
 +crw-rw---T 1 root dialout 188, 0 Jan  1  1970 /​dev/​ttyUSB0
 +</​code>​
 + 
 + \\
 +
 +=====Shutdown=====
 +====Terminal====
 +If the program is running in a console it can be stopped with CTRL+C.\\
 +In all other cases **kill** must be used.\\
 +
 + \\
 +
 +=====I2C Preparations=====
 +
 +====Enable====
 +| This can only be enabled with the **sudo** command. |\\
 +Remove the modules from the **/​etc/​modprobe.d/​raspi-blacklist.conf** by commenting them out (insert # at the beginning of the following lines):
 +<​code>​
 +# blacklist spi and i2c by default (many users don't need them)
 +
 +#blacklist spi-bcm2708
 +#blacklist i2c-bcm2708
 +</​code>​
 +
 +Add them in **/​etc/​modules**:​
 +<​code>​
 +# /​etc/​modules:​ kernel modules to load at boot time.
 +#
 +# This file contains the names of kernel modules that should be loaded
 +# at boot time, one per line. Lines beginning with "#"​ are ignored.
 +# Parameters can be specified after the module name.
 +snd-bcm2835
 +i2c-bcm2708
 +i2c-dev
 +</​code>​
 +
 +\\
 +=====Links & Documentation=====
 +  * {{:​rocnet:​pwm:​pca9685.pdf}}
 +  * {{:​rocnet:​mcp23017.pdf}}
 +  * {{:​rocnet:​af-pca9685-schem.pdf|}}
 +  * {{:​rocnet:​p82b715.pdf|}}
 +  * {{:​rocnet:​pcf8591.pdf|}}
 +
 + \\
 +=====Raspberry Pi and the Serial Port=====
 +  * http://​www.hobbytronics.co.uk/​raspberry-pi-serial-port
 +
 +By default the Raspberry Pi’s serial port is configured to be used for console input/​output. Whilst this is useful if you want to login using the serial port, it means you can't use the Serial Port in your programs. To be able to use the serial port to connect and talk to other devices (e.g. Arduino), the serial port console login needs to be disabled.
 +
 +Needless to say you will need some other way to login to the Raspberry Pi, and we suggest doing this over the network using an SSH connection.
 +
 +====Disable Serial Port Login====
 +
 +To enable the serial port for your own use you need to disable login on the port. There are two files that need to be edited
 +
 +The first and main one is **/​etc/​inittab**
 +
 +This file has the command to enable the login prompt and this needs to be disabled. Edit the file and move to the end of the file. You will see a line similar to
 +
 +**T0:​23:​respawn:/​sbin/​getty -L ttyAMA0 115200 vt100**
 +
 +Disable it by adding a # character to the beginning. Save the file.
 +
 +**#​T0:​23:​respawn:/​sbin/​getty -L ttyAMA0 115200 vt100**
 +
 +====Disable Bootup Info====
 +
 +When the Raspberry Pi boots up, all the bootup information is sent to the serial port. Disabling this bootup information is optional and you may want to leave this enabled as it is sometimes useful to see what is happening at bootup. If you have a device connected (i.e. Arduino) at bootup, it will receive this information over the serial port, so it is up to you to decide whether this is a problem or not.
 +
 +You can disable it by editing the file **/​boot/​cmdline.txt**
 +
 +The contents of the file look like this
 +
 +**dwc_otg.lpm_enable=0 console=ttyAMA0,​115200 kgdboc=ttyAMA0,​115200 console=tty1 root=/​dev/​mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait**
 +
 +Remove all references to ttyAMA0 (which is the name of the serial port). The file will now look like this
 +
 +**dwc_otg.lpm_enable=0 console=tty1 root=/​dev/​mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait**
 +
 +====Reboot====
 +
 +In order you enable the changes you have made, you will need to reboot the Raspberry Pi
 +
 +sudo shutdown -r now
 +
 +
 +
 +
  
rocnet/rocnetnode-build-en.txt · Last modified: 2018/11/12 08:56 (external edit)