Conduit mLinux: Convert to Basic Packet Forwarder
For Conduit mLinux models
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
Examples of global_conf.json
Copy one of the following to the /var/config/lora/ directory renamed as global_conf.json.
- Conduit with MTAC-LORA accessory cards:
- Conduit AP:
- Conduit with MTAC-003 accessory cards:
- Conduit MTCAP3:
- Conduit IP67 with v2.1 Gateway Card
- See /opt/lora/ directory for example config files
Enabling start-up on boot
$ update-rc.d lora-packet-forwarder defaults 80 30
Setting up the Conduit
mLinux >= 3.2.4
- /etc/init.d/lora-network-server stop
- Edit /etc/default/lora-network-server
- ENABLED=”no”
- Edit /etc/default/lora-packet-forwarder
- ENABLED=”yes”
- Copy global_conf.json to /var/config/lora/ directory
- Be sure to set “gateway_id” and server settings.
- 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
- The colon separators must be removed 00:80:00:00:00:00:00:97 => 0080000000000097
- /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.
- mLinux >= 4.1.6
- Set “gps”: “true” in global_conf.json “gateway_conf” section
- Reboot
- 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.- Edit /etc/default/gpsd
- Set Enabled=”no” and Save
- 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
- Set “gps_tty_path”: “/dev/ttyXRUSB2” in global_conf.json “gateway_conf” section
- 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
- Install the LoRa mCard. Refer to Installing an mCard Accessory Card.
- Attach the LoRa antenna to the LoRa mCard.
- Use the power cable to connect power to the Conduit and wait for the Conduit to boot up.
- Login to the console and configure the Conduit for internet access over Ethernet or cellular. Refer to Getting Started with mLinux if needed.
- 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
- Edit
/var/config/lora/lora-network-server.conf
and modify these settings as needed (usevi
ornano
).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 - Restart the network server. This will generate a configuration file for the packet forwarder.
$ /etc/init.d/lora-network-server restart
- Copy the generated packet forwarder configuration to the config partition.
$ cp /var/run/lora/1/global_conf.json /var/config/lora/global_conf.json
- 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.
- 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
- Comment out the Lora network server start code
- Restart the packet forwarder.
$ /etc/init.d/lora-network-server restart
- 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
- Establish a serial connection to the mDot
- Connect your PC to the DB9 serial connector on the UDK
- Open a terminal session using an application such as TeraTerm with baud rate 115,200
- 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)- 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.
- If
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.