Conduit mLinux: Convert to Basic Packet Forwarder

For Conduit mLinux models

WARNING: This is only for people who need to disable the on-board LoRa network server for gateway only functionality. Most people should follow the general getting started guide.
When forwarding packets to another Conduit be sure the receiving end has the firewall opened to receive incoming connections.
A process monitor such as monit should be used to ensure the packet forwarder remains running in case of error. See Monit Instructions
SPI device paths with mPower >= 6.0.0
  • In the global_conf.json
  • AP1
        
        "gateway_conf": {
            "spi_device" : "/dev/spidev0.2",
  • AP2
        
        "gateway_conf": {
            "spi_device" : "/dev/spidev1.2",
SPI device paths with mPower = 5.2.1
  • In the global_conf.json
  • AP1
        
        "gateway_conf": {
            "spi_device" : "/dev/spidev32766.2",
  • AP2
        
        "gateway_conf": {
            "spi_device" : "/dev/spidev32765.2",

Links

Troubleshooting Help

Examples of global_conf.json

Copy one of the following to the /var/config/lora/ directory renamed as global_conf.json.

Enabling start-up on boot

$ update-rc.d lora-packet-forwarder defaults 80 30

Setting up the Conduit

mLinux >= 3.2.4

  1. /etc/init.d/lora-network-server stop
  2. Edit /etc/default/lora-network-server
  3. ENABLED=”no”
  4. Edit /etc/default/lora-packet-forwarder
  5. ENABLED=”yes”
  6. Copy global_conf.json to /var/config/lora/ directory
  7. Be sure to set “gateway_id” and server settings.
  8. If you need a value for “gateway_id” the lora card value can be used
    $ mts-io-sysfs show lora/eui
    00:80:00:00:00:00:00:97
  9. The colon separators must be removed 00:80:00:00:00:00:00:97 => 0080000000000097
  10. /etc/init.d/lora-packet-forwarder start
For Conduits with GNSS module installed

As of mLinux 4.1.6 the packet forwarder will get GPS data via libgpsd, set gps property to true.

  1. mLinux >= 4.1.6
    1. Set “gps”: “true” in global_conf.json “gateway_conf” section
    2. Reboot
  2. mLinux < 4.1.6
    gpsd usage of the GPS is not compatible with lora-packet-forwarder. It is not possible to use the Multitech supplied Lora-Packet-Forwarder with the GNSS port, and GPSD at the same time.

    1. Edit /etc/default/gpsd
    2. Set Enabled=”no” and Save
    3. ntpd must be disabled or configured to not use gpsd
      • Edit /etc/default/ntpd, set Enabled=”no” and Save

      Or

      • Edit /etc/default/ntpd, set GPSD_REQUIRED=0 and Save
      • Configure NTP time server in /etc/ntp.conf
    4. Set “gps_tty_path”: “/dev/ttyXRUSB2” in global_conf.json “gateway_conf” section
    5. Reboot
For Geolocation v2.1 Conduits IP67
  • GPS data is available on /dev/gps0 and /dev/ttyXRUSB0
  • GPS antenna should be connected to port 3
  • Generate AES key to unlock the fine timestamp using the hardware chip-id
    • $ sudo /opt/lora/lora-v21-keygen $(sudo /opt/lora/gateway-utils-geo/chip_id | grep -oe '0x.*' | sed -r 's/0x//g' | sed 'N;s/\\n/ /')

mLinux < 3.2.4

  1. Install the LoRa mCard. Refer to Installing an mCard Accessory Card.
  2. Attach the LoRa antenna to the LoRa mCard.
  3. Use the power cable to connect power to the Conduit and wait for the Conduit to boot up.
  4. Login to the console and configure the Conduit for internet access over Ethernet or cellular. Refer to Getting Started with mLinux if needed.
  5. Issue these commands on the Conduit:
    $ mkdir /var/config/lora
    $ cp /opt/lora/lora-network-server.conf.sample /var/config/lora/lora-network-server.conf
  6. Edit /var/config/lora/lora-network-server.conf and modify these settings as needed (use vi or nano).
    Field MTAC-LORA-915 (NA) MTAC-LORA-868 (EU)
    lora[“frequencyBand”]: “915” “868”
    lora[“channelPlan”]: “US915” or “AU915” “EU868”
    lora[“frequencySubBand”]: (integer: 1 to 8) Not applicable
    lora[“frequencyEU”]: Not applicable default: 869500000
    range: [863500000 – 867500000]
    and [869100000 – 869500000]
    network[“public”]: true
  7. Restart the network server. This will generate a configuration file for the packet forwarder.
    $ /etc/init.d/lora-network-server restart
  8. Copy the generated packet forwarder configuration to the config partition.
    $ cp /var/run/lora/1/global_conf.json /var/config/lora/global_conf.json
  9. Edit /var/config/lora/global_conf.json and modify these settings.
    Field Description Example
    gateway_conf[“server_address”]: Network IP or URL of your LoRa network server “lora.mydomain.com”
    gateway_conf[“serv_port_down”]: The LoRa network server’s downstream UDP port 1700
    gateway_conf[“serv_port_up”]: The LoRa network server’s upstream UDP port 1700

    *If you have mLinux firmware version 3.2.4 or greater, skip steps 10-12, and see below for further instructions.

  10. Edit /etc/init.d/lora-network-server as follows :
    • Comment out the Lora network server start code
      # start network server                  
      #start-stop-daemon --start --background --make-pidfile \
      #    --pidfile $net_server_pidfile --exec $net_server -- \
      #    -c $conf_file --lora-eui $lora_eui --lora-path $run_dir --db $conf_db \
      #    --noconsole -l $net_server_log                      
      #sleep 1
    • On line 65, change the -c option for packet forwarder from -c $run_dir to -c $conf_dir
      # start packet forwarder            
      start-stop-daemon --start --background --make-pidfile \
           --pidfile $pkt_fwd_pidfile --exec $pkt_fwd -- \
           -c $conf_dir -l $pkt_fwd_log           
      echo "OK"
    • Comment out the Lora network server stop code
      #start-stop-daemon --stop --quiet --oknodo --pidfile $net_server_pidfile --retry 15
      start-stop-daemon --stop --quiet --oknodo --pidfile $pkt_fwd_pidfile --retry 5
  11. Restart the packet forwarder.
    $ /etc/init.d/lora-network-server restart
  12. For debugging, you can view the packet forwarder log with this command:
    $ tail -f /var/log/lora-pkt-fwd.log

*If you have mLinux firmware version 3.2.4 or greater, continue with steps 13-16 after step 9  from above (If not, stop here after step #12. You are done.)

13. Stop the network server using this command:


nbsp;/etc/init.d/lora-network-server stop

14. Edit /etc/default/lora-network-server:

ENABLED ="no"

15. Edit /etc/default/lora-packet-forwarder:

ENABLED = "yes"

16. Start packet forwarder using this command:


nbsp;/etc/init.d/lora-packet-forwarder start

Setting Up the mDot Using Manual Join

  1. Establish a serial connection to the mDot
    1. Connect your PC to the DB9 serial connector on the UDK
    2. Open a terminal session using an application such as TeraTerm with baud rate 115,200
  2. Issue these commands:
    • AT+NJM=0 (manual join mode)
    • AT+PN=1 (public network mode)
    • AT+FSB=value (915 NA only | value = frequencySubBand from your Conduit)
    • AT+NSK=value (value = Network session key given by your network server operator)
    • AT+DSK=value (value = Data (application) session key for your application)
    • AT+NA=value (value = 4-byte device address)
    • AT&W (save settings)
    • ATZ (restart)
  3. Send data without requesting an ACK:
    • AT+ACK=0
    • AT+SEND=hello world

Troubleshooting

  • The packet forwarder starts but immediately stops
    • If /var/config/lora/global_conf.json is not in proper json format (extra or missing comma), the packet forwarder cannot run.

Packet Forwarder Configuration Options

Two sections are available in the configuration: radio settings (SX1301_conf) and server settings (gateway_conf).

SX1301_conf

  • lorawan_public – set sync word to false: 0x12 or true: 0x34
  • clksrc – must be 0 for Multitech gateway hardware
  • antenna_gain – configure the installed antenna gain if the network server sends EIRP value with downlinks. The Multitech network server will account for antenna gain before sending tx power to the forwarder.

Radios

The radio_0 and radio_1 settings configure the two front-end radios on the MTAC cards.
enable – true if radio is enabled for use

  • type – type of radio chip installed SX1257 or SX1255, frequency range differs
  • freq – center frequency the radio is configured to listen for packets
  • tx_enable – true if radio can be used for transmissions
  • tx_freq_min – minimum frequency to be allowed for transmissions
  • tx_freq_max – maximum frequency to be allowed for transmissions
  • rssi_offset – offset in dBm to adjust the radio RSSI reading

Channels

Eight channels can be configured to receive LoRa packets using 125 kHz bandwith. These channels are configured in the chan_multiSF_x settings. Each channel has an enable boolean, a selected radio and an intermediate frequency. The channel frequency will freq setting of the radio plus the if setting of the channel.

  • enable – true if this channel is enabled for use
  • radio – selected radio to listen for packets
  • if – intermediate frequency offset applied to the selected radio “freq” setting

Two additional channels can be configured with the chan_Lora_std and chan_FSK settings.

  • enable – true if this channel is enabled for use
  • radio – selected radio to listen for packets
  • if – intermediate frequency offset applied to the selected radio “freq” setting
  • bandwidth – channel bandwidth
  • spread_factor (LoRa) – channel spreading factor (7-12)
  • datarate (FSK) – channel datarate in bps

Look-up-table (LUT)

There are sixteen power settings that can be configured, these settings have been selected during calibration for each hardware. The power sent from the network server is looked up in this table by the rf_power setting. The corresponding pa_gain, mix_gain and dig_gain settings are then input into the radio for the transmission. These settings should not be adjusted.

gateway_conf

  • gateway_ID – gateway identifier sent in each message to the network server
  • server_address – address of the network server
  • serv_port_up – port for sending uplink packets to the network server
  • serv_port_down – port to communicate to receive downlink packet from the network server
  • keepalive_interval – interval to ping the network server
  • stat_interval – interval to send stat messages to the network server
  • push_timeout_ms – socket timeout when publishing messages to the network server
  • autoquit_threshold – number of keepalive messages without response to wait before quitting
  • forward_crc_valid – enable to forward valid packets to the network server, default: true
  • forward_crc_error – enable to forward CRC failed packets to the network server, default: true. The network server will reject packets with failed CRC, it may not be necessary to forward the packets except for a statistic of local RF quality or to monitor the gateway performance over time. Some random CRC failed packets are expected to be received from random noise.
  • forward_crc_disabled – enable to forward packets without CRC enabled to the network server, default: false. LoRaWAN protocol expects uplink packets to have CRC enabled.

Listen Before Talk configuration