This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
wiki:loraloc [2017/04/10 18:07] mpe |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== LoRa Modem management ====== | ||
- | ===== Packet forwarder ===== | ||
- | |||
- | ==== What is the packet forwarder ==== | ||
- | |||
- | The packet forwarder is a program running on the host of a Lora gateway that forwards RF packets received by the gateway to a server through a IP/UDP link, and emits RF packets that are sent by the server.\\ | ||
- | |||
- | Every X seconds the program display statistics on the RF packets received and sent, and the network datagrams received and sent. The program also send some statistics to the server in JSON format.\\ | ||
- | |||
- | For a full packet forwarder description and the way it works, read the "Semtech readme file" available [[wiki:ressources#semtech_packet_forwarder_v2_loraloc1|here]] | ||
- | |||
- | ==== Installing the packet forwarder ==== | ||
- | |||
- | You can download the packet forwarder package from the [[wiki:ressources#semtech_packet_forwarder_v2_loraloc1|resource page]]. \\ | ||
- | Follow the instructions of the [[wiki:upgrade|update page]] to install it. Just replace the “.ipk” file of this example by your own. | ||
- | |||
- | |||
- | <note important> | ||
- | Make sure your FPGA firmware version is compatible with the packet forwarder you want to install. Refer to the resource page to know which packet forwarder is compatible whith which FPGA. | ||
- | </note> | ||
- | |||
- | |||
- | ==== Configuring the packet forwarder ==== | ||
- | |||
- | * Pick the config.json file from the [[wiki:ressources#semtech_packet_forwarder_v2_loraloc1|resource page]] that fits with your platform, region and feature need. | ||
- | * Update the JSON configuration file, as explained below. | ||
- | * The way the program 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. | ||
- | | ||
- | * In each configuration file, the program looks for a JSON object named: | ||
- | - "SX1301_array_conf" that should contain the parameters for the Lora concentrator board (RF channels definition, modem parameters, etc) | ||
- | - "gateway_conf" that should contain the gateway parameters (gateway MAC address, IP address of the server, keep-alive time, etc). | ||
- | - "gps_conf" | ||
- | |||
- | There are many configuration fields among these files, but most of them are by default correctly filled. The configuration you might want to change are the following: | ||
- | |||
- | === 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": 907800000, | ||
- | "chip_rf_chain": 0, | ||
- | "chan_multiSF_0": { "chan_rx_freq": 907100000 , "spread_factor": "7-10" }, | ||
- | "chan_multiSF_1": { "chan_rx_freq": 907300000 , "spread_factor": "7-10" }, | ||
- | "chan_multiSF_2": { "chan_rx_freq": 907500000 , "spread_factor": "7-10" }, | ||
- | "chan_multiSF_3": { "chan_rx_freq": 907700000 , "spread_factor": "7-10" }, | ||
- | "chan_multiSF_4": { "chan_rx_freq": 907900000 , "spread_factor": "7-10" }, | ||
- | "chan_multiSF_5": { "chan_rx_freq": 908100000 , "spread_factor": "7-10" }, | ||
- | "chan_multiSF_6": { "chan_rx_freq": 908300000 , "spread_factor": "7-10" }, | ||
- | "chan_multiSF_7": { "chan_rx_freq": 908500000 , "spread_factor": "7-10" }, | ||
- | "chan_LoRa_std" : { "chan_rx_freq": 907800000 , "bandwidth": 500000, "spread_factor": 8 }, | ||
- | "chan_FSK" : { "chan_rx_freq": 907800000 , "bandwidth": 125000, "bit_rate": 50000 } | ||
- | },{ | ||
- | "chip_enable": true, | ||
- | "chip_center_freq": 909400000, | ||
- | "chip_rf_chain": 0, | ||
- | "chan_multiSF_0": { "chan_rx_freq": 908700000 , "spread_factor": "7-10" }, | ||
- | "chan_multiSF_1": { "chan_rx_freq": 908900000 , "spread_factor": "7-10" }, | ||
- | "chan_multiSF_2": { "chan_rx_freq": 909100000 , "spread_factor": "7-10" }, | ||
- | "chan_multiSF_3": { "chan_rx_freq": 909300000 , "spread_factor": "7-10" }, | ||
- | "chan_multiSF_4": { "chan_rx_freq": 909500000 , "spread_factor": "7-10" }, | ||
- | "chan_multiSF_5": { "chan_rx_freq": 909700000 , "spread_factor": "7-10" }, | ||
- | "chan_multiSF_6": { "chan_rx_freq": 909900000 , "spread_factor": "7-10" }, | ||
- | "chan_multiSF_7": { "chan_rx_freq": 910100000 , "spread_factor": "7-10" }, | ||
- | "chan_LoRa_std" : { "chan_rx_freq": 909400000 , "bandwidth": 500000, "spread_factor": 8 }, | ||
- | "chan_FSK" : { "chan_rx_freq": 909400000 , "bandwidth": 125000, "bit_rate": 50000 } | ||
- | }], | ||
- | </code> | ||
- | |||
- | === Antennas configuration === | ||
- | |||
- | To understand all antennas configuration possibilities read the chapter 4.6.2.4 of the Installation manual. | ||
- | |||
- | * “tx_lut”, "rssi_offset", "rssi_offset_coeff_a" and "rssi_offset_coeff_b" fields are used to calibrate the antennas. These values are overwritten by the local.json. No need to change them. | ||
- | * "rx_enable" and "tx_enable" 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. | ||
- | |||
- | <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> | ||
- | |||
- | |||
- | === Gateway Configuration === | ||
- | |||
- | * “server_address” is the address of the server to which the packets will be forwarded | ||
- | * “serv_port_up” and “serv_port_down” are the ports used by the packet forwarder to communicate with the LoRa server | ||
- | * “stat_interval” is the period (in second) at which the statistics of the packet forwarder are logged. | ||
- | * "forward_crc_valid", "forward_crc_error" and "forward_crc_disabled" are Boolean that defines whether invalids packets should be forwarded to the server or not. | ||
- | * "keepalive_interval" is the period (in second) at which the packet forwarder will send a PUSH_DATA frame to the server | ||
- | |||
- | <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> | ||
- | |||
- | |||
- | ===== HALv2 (Loraloc / sx1301 array) ===== | ||
- | |||
- | The downloadable source tarball is available in dedicated [[wiki:ressources|resources]] page. | ||
- | |||
- | The HAL provided by Kerlink is based on new Semtech HAL **lora_gateway_v2**. \\ | ||
- | Main modifications aim to adapt HAL to Kerlink boards: | ||
- | * Multi-board support | ||
- | * Calibration parameters can now be parsed as an overload config file (similarly to local_conf.json) named /tmp/calib_loraloc.json | ||
- | |||
- | |||
- | As Loraloc architecture is much more complex, this HAL is quite different from HAL v1. \\ | ||
- | |||
- | ==== Compilation ==== | ||
- | |||
- | To simplify deployment on board, Kerlink provides a script called **build_package.sh**. It must be modified to set correct the toolchain according to the platform used: Change the YOCTO_TOOLCHAIN_ENV variable at begin of this script.\\ | ||
- | This tool script make all tools and prepare an OPKG package including them. | ||
- | |||
- | === HALv2 v3.3.0 === | ||
- | |||
- | To compile it, please use following commands: | ||
- | <code bash> | ||
- | cd lora_gateway_v2 | ||
- | source /opt/toolchains/loraV2/environment-setup-cortexa9hf-neon-poky-linux-gnueabi | ||
- | make SPI_HOST=imx | ||
- | </code> | ||
- | |||
- | === HALv2 v3.5.0 === | ||
- | |||
- | To compile it, please use following commands: | ||
- | <code bash> | ||
- | cd lora_gateway_v2_3.5.0-klk5 | ||
- | source /opt/toolchains/loraV2/environment-setup-cortexa9hf-neon-poky-linux-gnueabi | ||
- | make | ||
- | </code> | ||
- | |||
- | ==== Usage ==== | ||
- | |||
- | The main modification in tools since HALv1 is the '-d' argument. \\ | ||
- | As this HAL is mainly designed to handle multiple RF chips, this optional argument allows to specify which spidevice to use. | ||
- | |||
- | Kerlink provides a automatic discovery script at startup to handle correctly plugged boards. | ||
- | |||
- | By default, if a WAN module is provided, loraloc modules are mapped from slot 2. | ||
- | |||
- | So to use tools with this Loraloc module, please specify on tool's command-line **-d /dev/slot/2/spidev0**. \\ | ||
- | For example: | ||
- | <code bash> | ||
- | ./pkt_logger -d /dev/slot/2/spidev0 | ||
- | </code> | ||
- | |||
- | ==== Configuration ==== | ||
- | |||
- | Due to architecture, the configuration is quite more complex than HAL v1: | ||
- | * **board** keyword means "Loraloc board" or "LoraLoc module" (one "board" by slot) | ||
- | * each board includes 2 **chip** configs (i.e. sx1301 configs) | ||
- | * each board includes 2 **rfchain** configs | ||
- | |||
- | === Chip config === | ||
- | |||
- | This configuration must include SX1301 channel config. \\ | ||
- | These channels can be configured through "sx1301ar_conf_chan" function. \\ | ||
- | Please note that this function takes as "channel number" the concatenation of chip number and channel. (see function description in sx1301ar_hal.h) | ||
- | |||
- | === RF Chain config === | ||
- | |||
- | This configuration is mainly used to correct RSSI and TX power values. \\ | ||
- | Corresponding calibration values are set in Production by Kerlink and extracted during board startup in ///tmp/calib_loraloc.json// file. | ||
- | |||
- | Thanks to ad9361 transceiver chip. We are able to get +-0.25 dBm precision on real TX power. \\ | ||
- | As a consequence, up to 32 power steps (tx_lut) are generated and calibrated in production. | ||
- | |||
- | === JSON Config === | ||
- | |||
- | The JSON configuration file has been improved to simplify software by using JSON tables. \\ | ||
- | Indeed: | ||
- | * The main Radio config object "SX1301_array_conf" is now a table to support multiple boards | ||
- | * "rf_chain_conf" is also a 2-objects-sized table | ||
- | * "SX1301_conf" is a 2-objects-sized table | ||
- | * "tx_lut" is a variable table (up to 32 objects) | ||
- | |||
- | <ifauth @admin,@klk> | ||
- | ===== Radio scanning ===== | ||
- | The radio scanner can be addressed by a serial port from host CPU. The COM port can be retreived in the platform json description file /tmp/sys_startup_status.json, modem COM port is contained inside the field “module”.“acm_path”. The modem is identified by its physical location given in the field “module”.“position”.\\ | ||
- | |||
- | The command to enable an spectrum scanning is **sx1239** with the following parameters: | ||
- | * scan mode : need to be **fl** | ||
- | * number of path : need to be 1 for Lora Dual modem | ||
- | * start frequency in Hertz | ||
- | * stop frequency in Hertz | ||
- | * frequency step in Hertz (should be 62500) | ||
- | * frequency bandwith in Hertz (should be 62500) | ||
- | * Bitrate (should be 600) | ||
- | * loop number, set to **0** for an infinite scanning | ||
- | |||
- | Example: | ||
- | <code bash> | ||
- | sx1239 fl 1 863000000 870000000 62500 62500 600 0\r | ||
- | </code> | ||
- | |||
- | |||
- | The spectrum data are returned line by line separated by a \r\n, each line correspond to a complete scan of the band. The format is ASCII and respects the following protocol: | ||
- | <code> | ||
- | [PATH] : [DURATION] : [DATA] [FIN] | ||
- | </code> | ||
- | |||
- | Where : | ||
- | * [PATH] : radio path number : 0 or 1 (always 0 for Lora Dual modem) | ||
- | * [DURATION] : duration of the scan of the full band expressed in milli-seconds coded as a decimal | ||
- | * [DATA] : N x data coded as hexascii between 00 and FF, it expresses the opposite of the received power (-RSSI) | ||
- | * [FIN] : synchro character: \r\n (0x0D 0x0A) | ||
- | |||
- | Exemple | ||
- | <code> | ||
- | 0:915:7F7F807F80807F80807F7F7F7F7F7E7E777E7F7E7F7F807F7F7F7F80807F7F7F807F7F7F807F7F7F807F7F7F807F7F80807F7F7F7F807F807F7F7F7F807F7F7F7F807F7F7F7F7F7F7F7F7F7F80807F7F7F7F7F7F7F7F7F807F7F7F807F807F7F7F7F7F7F7F7F7F807F807F807F7F7F7F7E | ||
- | 0:915:7F7F8080807F7F7F7F807F7F7F7F7E7E777E7F7F7E7F7F7F807F7F807F807E807F7F7F7F7F7F7F7F7F807F7F7F7F7F80807F7F80807F807F80807F7F807F807F807F7F7F807F7F7F7F7F80807F7F7F7F7F807F7F7F80807F7F7F7F7F7F807F7F807F7F7F7F7F7F7F807F7F7F807F7F7F7F | ||
- | 0:915:7F807F807F7F80807F807F7F7F7F7F7E787E7E7F7F7F807F7F7F7F80808080807F7F7F7F8080807F8080807F808080807F80807F807F80807F7F7F8080807F7F807F7F80807F7F807F8080808080807F7F80807F80807F7F7F807F7F7F7F7E807F7F7F7F807F807F7F7F7F807F7F7F7F7F | ||
- | 0:915:7F7F807F807F7F7F7F7F7F7F807F7F7E777E7E7E7F7F7F7F7E7F7E807F8080807F7F7F7F807F7F7F80807F807F8080807F7F7F7F7F7F7F7F7F80807F7F7F7F7F807F7F80807F7F7F7F807F7F8080807F7F7F807F7F80807F7F80807F7F7F7F7F807F808080807F7F7F807F7F807F807F7E | ||
- | 0:915:7F807F7F807F807F7F8080807F7F7E7F777E7E7F7F7F7F80807F7F8080807F8080807F7F7F7E8080807F807F7F80807F7F807F7F807F8080807F7F7F80807F7F807F807F7F7F807F7F7F8080807F807F7F7F80807F7F7F7F7F7F807F7F7F7F807F7F7F7F7F7F80807F7F807F807F7F7F7F | ||
- | 0:915:7F7F807F7F7F7F7F7F7F7F7F7F7E7F7F777E7E7F7E7F7F7F807F7F7F807F808080808080807F7F7F80807F7F807F80807F7F7F7F807F807F7F8080807F7F807F807F7F7F7F7F7F7F807F7F7F807F807F80807F807F7F7F7F807F7F7F7F8080807F7F7F7F7F7F7F7F7F7F7F7F807F807F7F | ||
- | 0:915:7F7F7F7F807F807F80807F7F7F7F7E7E777E7E7E7F7F7F7F7F807F7F807F807F7F80808080807F80807F7F8080807F807F7F807F7F7F7F7F7F80807F7F807F7F7F7F807F807F7F7F807F7F7F80807F8080807F7F7F807F7F80807F7F7F807F807F7F7F7F80807F7F80807F7F807F7F7F7F | ||
- | </code> | ||
- | |||
- | To stop a scan, simply enter CTRL-C value. | ||
- | </ifauth> |