User Tools

Site Tools


wiki:loraloc_spf-4.0.0

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
wiki:loraloc_spf-4.0.0 [2017/10/31 17:01]
ghi
— (current)
Line 1: Line 1:
-====== iBTS Packet Forwarder v4.0.0 - Instructions ====== 
- 
- 
-  * [[wiki:​loraloc_spf-4.0.0#​i_-_file_structure|I - File structure]] - describes file structure of the packet forwarder. 
-  ​ 
-  ​ 
-  * [[wiki:​loraloc_spf-4.0.0#​ii_-_configuration|II - Configuration]] - describes steps to configure the packet forwarder. 
-  ​ 
-  ​ 
-  * [[wiki:​loraloc_spf-4.0.0#​iii_-_monitoring_and_maintenance|III - Monitoring and maintenance]] - describes : 
-      * how to start / stop the packet forwarder 
-      * the monitoring tools 
-      * how to retrieve packet forwarder'​s informations/​log 
-      * how to uninstall the packet forwarder 
- 
-  * [[wiki:​loraloc_spf-4.0.0#​iv_-_compilation|IV - Compilation]] - describes steps to compile the packet forwarder from sources. 
-\\ 
-Follow the instructions of the [[wiki:​upgrade|update page]] to install the packet forwarder. Just replace the “.ipk” file of this example by your own. 
- 
-\\ \\ 
-===== I - File structure ===== 
- 
-The package installation creates several files in the system.\\ 
-These files are removed when uninstalling the package. ​ 
-{{ :​wiki:​spf2_folders.png |}} 
- 
-The Packet Forwarder installation package creates common API files at runtime (internal usage) : 
-{{ :​wiki:​spf2_folders_2.png | files are also removed when uninstalling (see below).}} 
- 
-\\ \\ 
-===== II - Configuration ===== 
- 
-This chapter describes how to configure the packet Forwarder through <fc #​4682b4>​**6 steps**</​fc>​. 
- 
-\\ 
-==== 1 - JSON files : informations and behaviour ==== 
- 
-__Location :__ ''/​user/​spf2/​etc''​ 
- 
-{{:​wiki:​config.png|}} 
- 
-The packet forwarder uses two configuration files ''​config.json''​ and ''​local.json''​. To simplify the configuration,​ instead of directly using files named this way, two symbolic links are used :  ​ 
-   * **config.json** : Contains the LoRa, the gateway and the GPS parameters. 
-   * **local.json** : Contains the calibration of the frontend. This file must not be modified, it is hardware dependent. 
- 
-The way the packet forwarder takes configuration files into account is the following: 
-     - if there is a ''​config.json''​ parse it, look for the next file 
-     - if there is a ''​local.json''​ parse it. If some parameters are defined in both config and local configuration files, the local definition overwrites the global config definition. 
-     - in our case the ''​local.conf''​ is automatically generated at boot time. It contains antenna configuration. Do not change this file. 
- 
-There are __two kinds of configurations__ files for the iBTS product :  ​ 
-   * **single_antenna** configurations 
-   * **dual_antenna** configurations 
- 
-<note important>​ 
-The default LoRa Radio-Frequency configuration is "​Europe 868MHz"​. This can be changed after the package installation. 
-</​note>​ 
- 
-To check wether you have to use single or dual mode, read the chapter 4.6.2.4 of the [[wiki:​ressources#​wirnet_ibts_installation_and_maintenance_v10| Installation manual. ]] 
- 
-<fc #​4682b4>​**Step 1**</​fc><​fc #4682b4> - Select the correct JSON file.</​fc>​ 
-\\ 
-<fc #​4682b4>​**Step 2**</​fc><​fc #4682b4> - Execute the following commands : </fc> 
-    * <code bash> 
-    rm config.json 
-    # <config file> is the chosen JSON in first step 
-    ln -s <​selected_config_file>​ config.json</​code>​ 
- 
-\\ 
-==== 2 - JSON files : configuration structure ==== 
- 
-Structure of ''​config file.json''​ : 
- 
-{{:​wiki:​overview.png|}} 
- 
-In each configuration file, there are the following arrays : 
- 
-**SX1301 configuration** : that should contain the parameters for the Lora concentrator board (RF channels definition, modem parameters, etc). 
- 
-{{:​wiki:​sx1301.png|}} 
- 
-**gateway_configuration** : that should contain the gateway parameters (gateway MAC address, IP address of the server, keep-alive time, etc). 
- 
-{{:​wiki:​gateway.png|}} 
- 
-**gps_configuration** 
- 
-{{:​wiki:​gps.png|}} 
- 
-There are many configuration fields among these files, but most of them are by default correctly filled. 
- 
-\\ 
-==== 3 - Radio Frequencies configurations ==== 
- 
-Each LoRaLoc module contains two SX1301. Each SX1301 can be configured to use 10 different frequencies. However, these channels needs to be contained within a 2 Mhz bandwidth. 
- 
-  * ''​chip_enable''​ : enable/​disable SX1301. 
- 
-  * ''​chip_center_freq''​ : is used to define the center frequency of the SX1301. All 10 channels will be around this particular frequency (+/- 1Mhz). ​ 
- 
-  * ''​chan_rx_freq''​ : are used to define each channel frequencies. 
- 
-  * ''​chip_rf_chain''​ : define the rf chain used by the SX1301. The front-end board integrates two duplicated TX and Rx paths (RF1 path and RF2 path). Each TX/RX path is connected to one SMB antenna port, referenced as RF1 and RF2 (Installation manual 1.5.4.4 Front-end boards). 
- 
-<​code>​ 
-"​SX1301_conf":​[ 
- { 
-    "​chip_enable":​ true, 
-    "​chip_center_freq":​ 866000000, 
-    "​chip_rf_chain":​ 0, 
-    "​chan_multiSF_0":​ { "​chan_rx_freq":​ 865500000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_multiSF_1":​ { "​chan_rx_freq":​ 865700000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_multiSF_2":​ { "​chan_rx_freq":​ 865900000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_multiSF_3":​ { "​chan_rx_freq":​ 866100000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_multiSF_4":​ { "​chan_rx_freq":​ 866300000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_multiSF_5":​ { "​chan_rx_freq":​ 866500000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_multiSF_6":​ { "​chan_rx_freq":​ 867100000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_multiSF_7":​ { "​chan_rx_freq":​ 867300000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_LoRa_std"​ : { "​chan_rx_freq":​ 867300000, "​bandwidth":​ 250000, "​spread_factor":​ 7 }, 
-    "​chan_FSK" ​     : { "​chan_rx_freq":​ 866900000, "​bandwidth":​ 125000, "​bit_rate":​ 50000 } 
- },{ 
-    "​chip_enable":​ true, 
-    "​chip_center_freq":​ 868000000, 
-    "​chip_rf_chain":​ 0, 
-    "​chan_multiSF_0":​ { "​chan_rx_freq":​ 867500000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_multiSF_1":​ { "​chan_rx_freq":​ 867700000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_multiSF_2":​ { "​chan_rx_freq":​ 867900000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_multiSF_3":​ { "​chan_rx_freq":​ 868100000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_multiSF_4":​ { "​chan_rx_freq":​ 868300000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_multiSF_5":​ { "​chan_rx_freq":​ 868500000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_multiSF_6":​ { "​chan_rx_freq":​ 868700000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_multiSF_7":​ { "​chan_rx_freq":​ 868900000, "​spread_factor":​ "​7-12"​ }, 
-    "​chan_LoRa_std"​ : { "​chan_rx_freq":​ 868300000, "​bandwidth":​ 250000, "​spread_factor":​ 7 }, 
-    "​chan_FSK" ​     : { "​chan_rx_freq":​ 869100000, "​bandwidth":​ 125000, "​bit_rate":​ 50000 } 
-}], 
-</​code>​ 
- 
-<fc #​4682b4>​**Step 3**</​fc><​fc #4682b4> - Update the JSON configuration file with correct parameters for radio frequencies.</​fc>​ 
- 
-\\ 
-==== 4 - Antennas configuration ==== 
- 
-To understand all antennas configuration possibilities read the chapter 4.6.2.4 of the Installation manual. 
- 
-  * Enable fields are used to enable or disable emission and reception of the antennas. In case you only have one antenna, disable both these values for one antenna : 
-      * ''​rx_enable''​ 
-      * ''​tx_enable''​ 
- 
-  * The following fields are used to calibrate the antennas. These values are overwritten by the local.json. No need to change them. 
-      * ''​tx_lut''​ 
-      * ''​rssi_offset''​ 
-      * ''​rssi_offset_coeff_a''​ 
-      * ''​rssi_offset_coeff_b''  ​ 
- 
-<​code>​ 
-"​rf_chain_conf":​[ 
-        { 
-            "​rx_enable":​ true, 
-            "​tx_enable":​ true, 
-            "​rssi_offset":​ -202.5, 
-            "​rssi_offset_coeff_a":​ 20, 
-            "​rssi_offset_coeff_b":​ 2925, 
-            "​tx_lut":​[ 
-                { "​rf_power": ​ 2, "​fpga_dig_ ... 
-                 ... 
-                 ​... ​                           }] 
-        },{ 
-            "​rx_enable":​ true, 
-            "​tx_enable":​ true, 
-            "​rssi_offset":​ -202.5, 
-            "​rssi_offset_coeff_a":​ 20, 
-            "​rssi_offset_coeff_b":​ 2925, 
-            "​tx_lut":​[ 
-                { "​rf_power":​ ...  ​ 
-                 ... 
-                 ​... ​                         }] 
-        }], 
-</​code>​ 
- 
-<fc #​4682b4>​**Step 4**</​fc><​fc #4682b4> - Update the JSON configuration file with correct parameters for antennas.</​fc>​ 
- 
- 
-\\ 
-==== 5 - Listen Before Talk configuration ==== 
- 
-Listen Before Talk (LBT) is a technique used in radiocommunications whereby a radio transmitter first senses its radio environment before starting a transmission. 
- 
-This feature is mandatory in a few countries (such as Japan and Korea). 
- 
-''​enable'':​ enable or disable LBT 
- 
-''​rssi_target'':​ the RSSI threshold to detect if channel is busy or not (dBm) 
- 
-''​rssi_shift'':​** Do not change this value**, this is the value to be applied to RSSI to convert RSSI in dBm to register value 
- 
-''​freq_hz'':​ the LBT channel frequency in Hz. These frequencies needs to be the same as the one in the ''​SX1301_conf''​ array 
- 
-<note important>​ 
-By default the frequencies of these channels are different from the one in the ''​SX1301_conf''​ array. Make sure to change them. 
-</​note>​ 
- 
-''​scan_time_us'':​ the LBT channel scan time to be used (only two available values: 128µs or 5ms) 
- 
- 
-<​code>​ 
-"​lbt_conf":​{ 
-            "​enable":​ true, 
-            "​rssi_target":​ -80, /* dBm */ 
-            "​rssi_shift":​ 142, 
-            "​chan_cfg":​[ /* 16 channels maximum */ 
-                { "​freq_hz":​ 920600000, "​scan_time_us":​ 5000 }, 
-                { "​freq_hz":​ 920800000, "​scan_time_us":​ 5000 }, 
-                { "​freq_hz":​ 921000000, "​scan_time_us":​ 5000 }, 
-                { "​freq_hz":​ 921200000, "​scan_time_us":​ 5000 }, 
-                { "​freq_hz":​ 921400000, "​scan_time_us":​ 5000 }, 
-                { "​freq_hz":​ 921600000, "​scan_time_us":​ 5000 }, 
-                { "​freq_hz":​ 921800000, "​scan_time_us":​ 5000 }, 
-                { "​freq_hz":​ 923200000, "​scan_time_us":​ 5000 }, 
-                { "​freq_hz":​ 923400000, "​scan_time_us":​ 5000 } 
-            ] 
-        }, 
- 
-</​code>​ 
- 
-<fc #​4682b4>​**Step 5**</​fc><​fc #4682b4> - Update the JSON configuration file with correct parameters for LBT.</​fc>​ 
- 
-==== 6 - Gateway configuration ==== 
- 
-  * ''​server_address''​ : is the address of the server to which the packets will be forwarded. 
- 
-  * The following fields describe the ports used by the packet forwarder to communicate with the LoRa server 
-       * ''​serv_port_up''​ 
-       * ''​serv_port_down'' ​ 
- 
-  * ''​stat_interval''​ is the period (in second) at which the statistics of the packet forwarder are logged. 
-  ​ 
-  * The following fields are Boolean that defines whether invalids packets should be forwarded to the server or not : 
-       * ''​forward_crc_valid''​ 
-       * ''​forward_crc_error''​ 
-       * ''​forward_crc_disabled'' ​ 
- 
-  * ''​keepalive_interval''​ is the period (in second) at which the packet forwarder will send a PUSH_DATA frame to the server. 
- 
-  * ''​link_mote''​ is a field to observe debug mote's informations. ​ 
- 
-<​code>​ 
-  "​gateway_conf":​ { 
-    "​gateway_ID":​ "​00AEAEFFFE000000",​ 
-    "​server_address":​ "​iotbeta.semtech.com",​ 
-    "​serv_port_up":​ 1690, 
-    "​serv_port_down":​ 1690, 
-    "​keepalive_interval":​ 10, 
-    "​stat_interval":​ 30, 
-    "​push_timeout_ms":​ 100, 
-    "​forward_crc_valid":​ true, 
-    "​forward_crc_error":​ false, 
-    "​forward_crc_disabled":​ false, 
-    "​link_mote":​ "​00CC01AF"​ 
-  }, 
-</​code>​ 
- 
-<fc #​4682b4>​**Step 6**</​fc><​fc #4682b4> - Update the JSON configuration file with correct parameters for the gateway.</​fc>​ 
- 
-\\ 
-=== Configuration example - Semtech'​s LoRa demonstrator:​ gateway configuration === 
- 
-Send the following shell commands (debug probe or SSH connection) to configure the packet forwareder to work with the Semtech'​s LoRa Demonstrator LoRaWAN server [[http://​iot.semtech.com]]:​ 
- 
-''<​config_file>''​ is the JSON file you have already defined to work on your station according to the [[wiki:​loraloc_spf-4.0.0#​json_filesinformations_and_behaviour | First step]]. 
- 
-<​code>​ 
-sed -r -i -e "​s;​(\"​server_address\":​\ ).*$;​\1\"​iot.semtech.com\",;"​ /​user/​spf2/​etc/<​config_file>​ 
-sed -r -i -e "​s;​(\"​serv_port_up\":​\ ).*$;​\11690,;"​ /​user/​spf2/​etc/<​config_file>​ 
-sed -r -i -e "​s;​(\"​serv_port_down\":​\ ).*$;​\11690,;"​ /​user/​spf2/​etc/<​config_file>​ 
- 
-monit restart spf2 
- 
-</​code>​ 
- 
-The initialisation scripts installed on the gateway will open the firewall ports to allow the packet forwarder to communicate with the Semtech'​s LoRaWAN server. 
- 
- 
-\\ \\ 
-===== III - Monitoring and maintenance ===== 
- 
-==== 1 - Starting and stopping the packet forwarder ==== 
- 
-<note warning> 
-The semtech'​s packet forwarder (process "​spf2"​) will be restarted in loop until the access to the LoRaWAN server is correct. 
-</​note>​ 
- 
-=== Monit process === 
-Use the ''​Monit''​ process start or stop the packet forwarder. 
- 
-''​Monit <start | stop | restart> <​service>''​ 
- 
-  * Check whether packet forwarder process is present or not 
-  * <​code>​ ps ww | grep spf2 </​code>​ 
-  * If packet forwarder is not launched : 
-  * <​code>​monit start spf2</​code>​ 
-  * If packet forwarder is launched : 
-  * <​code>​monit stop spf2</​code>​ 
-  * Restart the packet forwarder : 
-  * <​code>​monit restart spf2</​code>​ 
- 
-\\ 
-==== 2 - Process and resources monitoring ==== 
-Once your packet forwarder is configured you can check its status using ps command. 
- 
-<​code>​ 
- 1000 root     13220 S    /​usr/​bin/​monit -c /​etc/​monitrc 
- 1009 root      2744 S    {start_getty} /bin/sh /​bin/​start_getty 115200 ttymxc0 
- 1010 root      2976 S    -sh 
- 1012 root      2596 S    /​sbin/​watchdog -t 30 /​dev/​watchdog 
- 1026 root      2740 S    {execute_spf2.sh} /bin/sh -e /​user/​spf2/​bin/​execute_spf2.sh 
- 1028 root     52136 S    /​user/​spf2/​bin/​spf2 -g /dev/nmea1 -y 
- 1029 root      2964 S    logger -p local1.notice -t spf2 
-</​code>​ 
- 
-For more detailed information with ''​monit''​ you can use these commands : 
- 
- 
-<​code>​ 
-# monit -v : Gives basic information on the SPF2 process 
-# ====================================================== 
-monit -v | grep -A 2 spf2 
-Process Name          = spf2 
- Pid file             = /​var/​run/​packet_forwarder.pid 
- ​Monitoring mode      = active 
--- 
- Start program ​       = '/​user/​spf2/​bin/​execute_spf2.sh'​ timeout 30 s 
- Stop program ​        = '/​usr/​bin/​killall -q spf2' timeout 30 s 
- ​Existence ​           = if does not exist then restart 
- 
-# monit status : Gives informations about resources consumption,​ pid files and monitoring status. 
-# =============================================================================================== 
-monit status | grep -A 18 spf2 
-Process '​spf2'​ 
-  status ​                      ​Running 
-  monitoring status ​           Monitored 
-  monitoring mode              active 
-  on reboot ​                   nostart 
-  pid                          1028 
-  parent pid                   1026 
-  uid                          0 
-  effective uid                0 
-  gid                          0 
-  uptime ​                      13m 
-  threads ​                     7 
-  children ​                    0 
-  cpu                          0.8% 
-  cpu total                    0.8% 
-  memory ​                      0.8% [1.9 MB] 
-  memory total                 0.8% [1.9 MB] 
-  data collected ​              Tue, 04 Jul 2017 07:42:59 
-</​code>​ 
- 
-\\ 
-==== 3 - Log monitoring ==== 
- 
-__Location__ : ''/​user/​spf2/​var/​log''​ 
- 
-{{:​wiki:​log.png|}} 
- 
-While deploying packet forwarder on your board, the package installer configures syslogd to manage SPF logs in the ''/​user/​spf/​var/​log''​ directory. This folder will contain activity traces of the packet forwarder. A logrotate feature is used to limit disk space used :    
-  * maximum files : ''​10''​. ​ 
-  * maximum size per file : ''​200Kb''​. 
-  * most recent file : ''​spf2.log''​ 
-  * less recent file : ''​spf2.log.9''​ 
- 
- 
-To survey the log files: ​ 
-<​code>​ 
-tail -f /​user/​spf2/​var/​log/​spf2.log 
-</​code>​ 
- 
-\\ 
-==== 4 - Uninstall the packet forwarder ==== 
- 
-Opkg packages (.ipk) can be removed thanks to dedicated procedure: ​ 
-[[wiki:​upgrade#​package_removal|Software updates:​package removal]]. 
- 
  
wiki/loraloc_spf-4.0.0.1509465718.txt.gz · Last modified: 2019/01/17 10:01 (external edit)