diff options
Diffstat (limited to 'recipes-connectivity/lora')
16 files changed, 1242 insertions, 11 deletions
diff --git a/recipes-connectivity/lora/lora-gateway/lora-gateway-add-fpga-version-28.patch b/recipes-connectivity/lora/lora-gateway/lora-gateway-add-fpga-version-28.patch new file mode 100644 index 0000000..c5f47dd --- /dev/null +++ b/recipes-connectivity/lora/lora-gateway/lora-gateway-add-fpga-version-28.patch @@ -0,0 +1,13 @@ +diff --git a/libloragw/src/loragw_reg.c b/libloragw/src/loragw_reg.c +index 7fe0f67..dc90d93 100644 +--- a/libloragw/src/loragw_reg.c ++++ b/libloragw/src/loragw_reg.c +@@ -48,7 +48,7 @@ Maintainer: Sylvain Miermont + #define PAGE_ADDR 0x00 + #define PAGE_MASK 0x03 + +-const uint8_t FPGA_VERSION[] = { 27 }; /* several versions could be supported */ ++const uint8_t FPGA_VERSION[] = { 27, 28 }; /* several versions could be supported */ + + /* + auto generated register mapping for C code : 11-Jul-2013 13:20:40 diff --git a/recipes-connectivity/lora/lora-gateway_4.0.1.bb b/recipes-connectivity/lora/lora-gateway_4.0.1.bb index 5175c1f..4c91642 100644 --- a/recipes-connectivity/lora/lora-gateway_4.0.1.bb +++ b/recipes-connectivity/lora/lora-gateway_4.0.1.bb @@ -6,10 +6,11 @@ SECTION = "console/utils" LICENSE = "SEMTECH" LIC_FILES_CHKSUM = "file://LICENSE;md5=a2bdef95625509f821ba00460e3ae0eb" DEPENDS = "" -PR = "r1" +PR = "r4" SRCREV = "v${PV}" SRC_URI = "git://github.com/Lora-net/lora_gateway.git;protocol=git \ + file://lora-gateway-add-fpga-version-28.patch \ file://library_4.0.cfg \ " @@ -37,18 +38,18 @@ do_install() { install -m 0644 libloragw/inc/* ${D}${includedir}/lora install -m 0644 libloragw/readme.md ${D}${libdir}/lora - install -d ${D}/opt/lora - install -m 0755 libloragw/test_* ${D}/opt/lora/ - install -m 0755 util_pkt_logger/util_pkt_logger ${D}/opt/lora/ - install -m 0755 util_spectral_scan/util_spectral_scan ${D}/opt/lora/ - install -m 0755 util_spi_stress/util_spi_stress ${D}/opt/lora/ - install -m 0755 util_tx_test/util_tx_test ${D}/opt/lora/ + install -d ${D}/opt/lora/gateway-utils + install -m 0755 libloragw/test_* ${D}/opt/lora/gateway-utils/ + install -m 0755 util_pkt_logger/util_pkt_logger ${D}/opt/lora/gateway-utils/ + install -m 0755 util_spectral_scan/util_spectral_scan ${D}/opt/lora/gateway-utils/ + install -m 0755 util_spi_stress/util_spi_stress ${D}/opt/lora/gateway-utils/ + install -m 0755 util_tx_test/util_tx_test ${D}/opt/lora/gateway-utils/ } PACKAGES += "${PN}-utils ${PN}-utils-dbg" -FILES_${PN}-utils = "/opt/lora/*" -FILES_${PN}-utils-dbg = "/opt/lora/.debug" +FILES_${PN}-utils = "/opt/lora/gateway-utils/*" +FILES_${PN}-utils-dbg = "/opt/lora/gateway-utils/.debug" FILES_${PN}-dev = "${includedir}/lora ${libdir}/lora/library.cfg" FILES_${PN}-staticdev = "${libdir}/lora/libloragw.a" diff --git a/recipes-connectivity/lora/lora-network-server-mtp/local_conf.json b/recipes-connectivity/lora/lora-network-server-mtp/local_conf.json new file mode 100644 index 0000000..3c2af80 --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server-mtp/local_conf.json @@ -0,0 +1,7 @@ +{ + "gateway_conf": { + "server_address": "localhost", + "serv_port_up": 1780, + "serv_port_down": 1782 + } +} diff --git a/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.default b/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.default new file mode 100644 index 0000000..be7dcd5 --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.default @@ -0,0 +1,2 @@ +# set to "yes" or "no" to control starting on boot +ENABLED="yes" diff --git a/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.init b/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.init new file mode 100755 index 0000000..86d731b --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.init @@ -0,0 +1,80 @@ +#!/bin/bash + +NAME="lora-network-server" +ENABLED="yes" + +START_STOP_DAEMON="/usr/sbin/start-stop-daemon" + +[ -f /etc/default/$NAME ] && source /etc/default/$NAME + +run_dir=/var/run/lora +conf_dir=/var/config/lora +conf_file=/opt/lora/lora-network-server.conf +conf_db=$conf_dir/lora-network-server.db + +net_server=/opt/lora/lora-network-server +net_server_log=/var/log/lora-network-server.log +net_server_pidfile=$run_dir/$NAME.pid + +pkt_fwd=/opt/lora/lora_pkt_fwd +pkt_fwd_pidfile=$run_dir/lora-pkt-fwd-1.pid + +do_start() { + if ! [ -f $conf_file ]; then + echo "$0: $conf_file missing" + exit 1 + fi + + echo -n "Starting $NAME: " + mkdir -p $run_dir/1 + # start network server + $START_STOP_DAEMON --start --background --make-pidfile \ + --pidfile $net_server_pidfile --startas /bin/bash \ + --chdir "/opt/lora" -- -c "exec $net_server \ + -c $conf_file --lora-path $run_dir --db $conf_db \ + --noconsole -l $net_server_log >> $net_server_log 2>&1" + sleep 2 + # start packet forwarder + $START_STOP_DAEMON --start --background --make-pidfile \ + --pidfile $pkt_fwd_pidfile --exec $pkt_fwd --chdir "/opt/lora/" + + renice -n -20 -p $(pgrep lora-network-se) + renice -n -20 -p $(pgrep $(basename $pkt_fwd)) + + echo "OK" +} + +do_stop() { + echo -n "Stopping $NAME: " + $START_STOP_DAEMON --stop --quiet --oknodo --pidfile $net_server_pidfile --retry 15 + $START_STOP_DAEMON --stop --quiet --oknodo --pidfile $pkt_fwd_pidfile --retry 5 + rm -f $net_server_pidfile $pkt_fwd_pidfile + echo "OK" +} + +if [ "$ENABLED" != "yes" ]; then + echo "$NAME: disabled in /etc/default" + exit +fi + +case "$1" in + "start") + do_start + ;; + "stop") + do_stop + ;; + "restart") + ## Stop the service and regardless of whether it was + ## running or not, start it again. + do_stop + do_start + ;; + *) + ## If no parameters are given, print which are avaiable. + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac + + diff --git a/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.logrotate.conf b/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.logrotate.conf new file mode 100644 index 0000000..d2b6c9a --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.logrotate.conf @@ -0,0 +1,7 @@ +/var/log/lora-pkt-fwd*.log /var/log/lora-network-server.log { + size 512k + rotate 4 + compress + copytruncate + missingok +} diff --git a/recipes-connectivity/lora/lora-network-server-mtp_1.0.13.bb b/recipes-connectivity/lora/lora-network-server-mtp_1.0.13.bb new file mode 100644 index 0000000..898e2ec --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server-mtp_1.0.13.bb @@ -0,0 +1,48 @@ +# THIS RECIPE FOR PICOCELL USES PATCHED LORA NETWORK SERVER THAT SUPPORTS +# MTP HARDWARE AND V2 PACKET FORWARDER PROTOCOL +DESCRIPTION = "MultiTech LoRa Network Server" +PRIORITY = "optional" +SECTION = "console/utils" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE;md5=7ffae4666a986c4ccf45e99e464f8402" +DEPENDS = "jsoncpp libmts mosquitto sqlite3" +RDEPENDS_${PN} += "lora-packet-forwarder logrotate" +PR = "r1" + +SRC_URI = "http://multitech.net/downloads/lora-network-server_${TUNE_PKGARCH}_${PV}-mtp.tar.gz \ + file://lora-network-server.init \ + file://lora-network-server.default \ + file://lora-network-server.logrotate.conf \ + file://local_conf.json \ + " + +SRC_URI[md5sum] = "d21cab149a81938da7728f38d0baa3e4" +SRC_URI[sha256sum] = "b1147b63ecd3afcfc259929c3f63a1dcb44b32c53ce0ebc7d8f0b59f465e0bf6" + +# binaries are already stripped, so suppress warning +INSANE_SKIP_${PN} = "already-stripped" + +S = "${WORKDIR}" + +LORA_DIR = "/opt/lora" + +do_compile() { +} + +do_install() { + install -d ${D}${LORA_DIR} + install -m 0755 lora-network-server ${D}${LORA_DIR}/ + install -m 0644 lora-network-server.conf ${D}${LORA_DIR}/ + install -m 0755 ${WORKDIR}/local_conf.json ${D}${LORA_DIR}/ + + install -d ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/lora-network-server.default ${D}${sysconfdir}/default/lora-network-server + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/lora-network-server.init ${D}${sysconfdir}/init.d/lora-network-server + install -d ${D}${sysconfdir}/logrotate.d + install -m 0644 ${WORKDIR}/lora-network-server.logrotate.conf ${D}${sysconfdir}/logrotate.d/lora-network-server.conf +} + +CONFFILES_${PN} = "${sysconfdir}/default/lora-network-server" +FILES_${PN} += "${LORA_DIR}" +FILES_${PN}-dbg += "${LORA_DIR}/.debug" diff --git a/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.PCB_E286.EU868.basic.clksrc0 b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.PCB_E286.EU868.basic.clksrc0 new file mode 100644 index 0000000..fc14309 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.PCB_E286.EU868.basic.clksrc0 @@ -0,0 +1,216 @@ +{ + "SX1301_conf": { + "lorawan_public": true, + "clksrc": 0, /* radio_1 provides clock to concentrator */ + "antenna_gain": 0, /* antenna gain, in dBi */ + "radio_0": { + "enable": true, + "type": "SX1257", + "freq": 867500000, + "rssi_offset": -166.0, + "tx_enable": true, + "tx_freq_min": 863000000, + "tx_freq_max": 870000000 + }, + "radio_1": { + "enable": true, + "type": "SX1257", + "freq": 868500000, + "rssi_offset": -166.0, + "tx_enable": false + }, + "chan_multiSF_0": { + /* Lora MAC channel, 125kHz, all SF, 868.1 MHz */ + "enable": true, + "radio": 1, + "if": -400000 + }, + "chan_multiSF_1": { + /* Lora MAC channel, 125kHz, all SF, 868.3 MHz */ + "enable": true, + "radio": 1, + "if": -200000 + }, + "chan_multiSF_2": { + /* Lora MAC channel, 125kHz, all SF, 868.5 MHz */ + "enable": true, + "radio": 1, + "if": 0 + }, + "chan_multiSF_3": { + /* Lora MAC channel, 125kHz, all SF, 867.1 MHz */ + "enable": true, + "radio": 0, + "if": -400000 + }, + "chan_multiSF_4": { + /* Lora MAC channel, 125kHz, all SF, 867.3 MHz */ + "enable": true, + "radio": 0, + "if": -200000 + }, + "chan_multiSF_5": { + /* Lora MAC channel, 125kHz, all SF, 867.5 MHz */ + "enable": true, + "radio": 0, + "if": 0 + }, + "chan_multiSF_6": { + /* Lora MAC channel, 125kHz, all SF, 867.7 MHz */ + "enable": true, + "radio": 0, + "if": 200000 + }, + "chan_multiSF_7": { + /* Lora MAC channel, 125kHz, all SF, 867.9 MHz */ + "enable": true, + "radio": 0, + "if": 400000 + }, + "chan_Lora_std": { + /* Lora MAC channel, 250kHz, SF7, 868.3 MHz */ + "enable": true, + "radio": 1, + "if": -200000, + "bandwidth": 250000, + "spread_factor": 7 + }, + "chan_FSK": { + /* FSK 50kbps channel, 868.8 MHz */ + "enable": true, + "radio": 1, + "if": 300000, + "bandwidth": 125000, + "datarate": 50000 + }, + "tx_lut_0": { + /* TX gain table, index 0 */ + "pa_gain": 0, + "mix_gain": 8, + "rf_power": -6, + "dig_gain": 0 + }, + "tx_lut_1": { + /* TX gain table, index 1 */ + "pa_gain": 0, + "mix_gain": 10, + "rf_power": -3, + "dig_gain": 0 + }, + "tx_lut_2": { + /* TX gain table, index 2 */ + "pa_gain": 0, + "mix_gain": 12, + "rf_power": 0, + "dig_gain": 0 + }, + "tx_lut_3": { + /* TX gain table, index 3 */ + "pa_gain": 1, + "mix_gain": 8, + "rf_power": 3, + "dig_gain": 0 + }, + "tx_lut_4": { + /* TX gain table, index 4 */ + "pa_gain": 1, + "mix_gain": 10, + "rf_power": 6, + "dig_gain": 0 + }, + "tx_lut_5": { + /* TX gain table, index 5 */ + "pa_gain": 1, + "mix_gain": 12, + "rf_power": 10, + "dig_gain": 0 + }, + "tx_lut_6": { + /* TX gain table, index 6 */ + "pa_gain": 1, + "mix_gain": 13, + "rf_power": 11, + "dig_gain": 0 + }, + "tx_lut_7": { + /* TX gain table, index 7 */ + "pa_gain": 2, + "mix_gain": 9, + "rf_power": 12, + "dig_gain": 0 + }, + "tx_lut_8": { + /* TX gain table, index 8 */ + "pa_gain": 1, + "mix_gain": 15, + "rf_power": 13, + "dig_gain": 0 + }, + "tx_lut_9": { + /* TX gain table, index 9 */ + "pa_gain": 2, + "mix_gain": 10, + "rf_power": 14, + "dig_gain": 0 + }, + "tx_lut_10": { + /* TX gain table, index 10 */ + "pa_gain": 2, + "mix_gain": 11, + "rf_power": 16, + "dig_gain": 0 + }, + "tx_lut_11": { + /* TX gain table, index 11 */ + "pa_gain": 3, + "mix_gain": 9, + "rf_power": 20, + "dig_gain": 0 + }, + "tx_lut_12": { + /* TX gain table, index 12 */ + "pa_gain": 3, + "mix_gain": 10, + "rf_power": 23, + "dig_gain": 0 + }, + "tx_lut_13": { + /* TX gain table, index 13 */ + "pa_gain": 3, + "mix_gain": 11, + "rf_power": 25, + "dig_gain": 0 + }, + "tx_lut_14": { + /* TX gain table, index 14 */ + "pa_gain": 3, + "mix_gain": 12, + "rf_power": 26, + "dig_gain": 0 + }, + "tx_lut_15": { + /* TX gain table, index 15 */ + "pa_gain": 3, + "mix_gain": 14, + "rf_power": 27, + "dig_gain": 0 + } + }, + + "gateway_conf": { + "gateway_ID": "AA555A0000000000", + /* change with default server address/ports, or overwrite in local_conf.json */ + "server_address": "localhost", + "serv_port_up": 1680, + "serv_port_down": 1680, + /* adjust the following parameters for your network */ + "keepalive_interval": 10, + "stat_interval": 30, + "push_timeout_ms": 100, + /* forward only valid packets */ + "forward_crc_valid": true, + "forward_crc_error": false, + "forward_crc_disabled": false + } +} + diff --git a/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.PCB_E286.EU868.basic.clksrc1 b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.PCB_E286.EU868.basic.clksrc1 new file mode 100644 index 0000000..e60f583 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.PCB_E286.EU868.basic.clksrc1 @@ -0,0 +1,216 @@ +{ + "SX1301_conf": { + "lorawan_public": true, + "clksrc": 1, /* radio_1 provides clock to concentrator */ + "antenna_gain": 0, /* antenna gain, in dBi */ + "radio_0": { + "enable": true, + "type": "SX1257", + "freq": 867500000, + "rssi_offset": -166.0, + "tx_enable": true, + "tx_freq_min": 863000000, + "tx_freq_max": 870000000 + }, + "radio_1": { + "enable": true, + "type": "SX1257", + "freq": 868500000, + "rssi_offset": -166.0, + "tx_enable": false + }, + "chan_multiSF_0": { + /* Lora MAC channel, 125kHz, all SF, 868.1 MHz */ + "enable": true, + "radio": 1, + "if": -400000 + }, + "chan_multiSF_1": { + /* Lora MAC channel, 125kHz, all SF, 868.3 MHz */ + "enable": true, + "radio": 1, + "if": -200000 + }, + "chan_multiSF_2": { + /* Lora MAC channel, 125kHz, all SF, 868.5 MHz */ + "enable": true, + "radio": 1, + "if": 0 + }, + "chan_multiSF_3": { + /* Lora MAC channel, 125kHz, all SF, 867.1 MHz */ + "enable": true, + "radio": 0, + "if": -400000 + }, + "chan_multiSF_4": { + /* Lora MAC channel, 125kHz, all SF, 867.3 MHz */ + "enable": true, + "radio": 0, + "if": -200000 + }, + "chan_multiSF_5": { + /* Lora MAC channel, 125kHz, all SF, 867.5 MHz */ + "enable": true, + "radio": 0, + "if": 0 + }, + "chan_multiSF_6": { + /* Lora MAC channel, 125kHz, all SF, 867.7 MHz */ + "enable": true, + "radio": 0, + "if": 200000 + }, + "chan_multiSF_7": { + /* Lora MAC channel, 125kHz, all SF, 867.9 MHz */ + "enable": true, + "radio": 0, + "if": 400000 + }, + "chan_Lora_std": { + /* Lora MAC channel, 250kHz, SF7, 868.3 MHz */ + "enable": true, + "radio": 1, + "if": -200000, + "bandwidth": 250000, + "spread_factor": 7 + }, + "chan_FSK": { + /* FSK 50kbps channel, 868.8 MHz */ + "enable": true, + "radio": 1, + "if": 300000, + "bandwidth": 125000, + "datarate": 50000 + }, + "tx_lut_0": { + /* TX gain table, index 0 */ + "pa_gain": 0, + "mix_gain": 8, + "rf_power": -6, + "dig_gain": 0 + }, + "tx_lut_1": { + /* TX gain table, index 1 */ + "pa_gain": 0, + "mix_gain": 10, + "rf_power": -3, + "dig_gain": 0 + }, + "tx_lut_2": { + /* TX gain table, index 2 */ + "pa_gain": 0, + "mix_gain": 12, + "rf_power": 0, + "dig_gain": 0 + }, + "tx_lut_3": { + /* TX gain table, index 3 */ + "pa_gain": 1, + "mix_gain": 8, + "rf_power": 3, + "dig_gain": 0 + }, + "tx_lut_4": { + /* TX gain table, index 4 */ + "pa_gain": 1, + "mix_gain": 10, + "rf_power": 6, + "dig_gain": 0 + }, + "tx_lut_5": { + /* TX gain table, index 5 */ + "pa_gain": 1, + "mix_gain": 12, + "rf_power": 10, + "dig_gain": 0 + }, + "tx_lut_6": { + /* TX gain table, index 6 */ + "pa_gain": 1, + "mix_gain": 13, + "rf_power": 11, + "dig_gain": 0 + }, + "tx_lut_7": { + /* TX gain table, index 7 */ + "pa_gain": 2, + "mix_gain": 9, + "rf_power": 12, + "dig_gain": 0 + }, + "tx_lut_8": { + /* TX gain table, index 8 */ + "pa_gain": 1, + "mix_gain": 15, + "rf_power": 13, + "dig_gain": 0 + }, + "tx_lut_9": { + /* TX gain table, index 9 */ + "pa_gain": 2, + "mix_gain": 10, + "rf_power": 14, + "dig_gain": 0 + }, + "tx_lut_10": { + /* TX gain table, index 10 */ + "pa_gain": 2, + "mix_gain": 11, + "rf_power": 16, + "dig_gain": 0 + }, + "tx_lut_11": { + /* TX gain table, index 11 */ + "pa_gain": 3, + "mix_gain": 9, + "rf_power": 20, + "dig_gain": 0 + }, + "tx_lut_12": { + /* TX gain table, index 12 */ + "pa_gain": 3, + "mix_gain": 10, + "rf_power": 23, + "dig_gain": 0 + }, + "tx_lut_13": { + /* TX gain table, index 13 */ + "pa_gain": 3, + "mix_gain": 11, + "rf_power": 25, + "dig_gain": 0 + }, + "tx_lut_14": { + /* TX gain table, index 14 */ + "pa_gain": 3, + "mix_gain": 12, + "rf_power": 26, + "dig_gain": 0 + }, + "tx_lut_15": { + /* TX gain table, index 15 */ + "pa_gain": 3, + "mix_gain": 14, + "rf_power": 27, + "dig_gain": 0 + } + }, + + "gateway_conf": { + "gateway_ID": "AA555A0000000000", + /* change with default server address/ports, or overwrite in local_conf.json */ + "server_address": "localhost", + "serv_port_up": 1680, + "serv_port_down": 1680, + /* adjust the following parameters for your network */ + "keepalive_interval": 10, + "stat_interval": 30, + "push_timeout_ms": 100, + /* forward only valid packets */ + "forward_crc_valid": true, + "forward_crc_error": false, + "forward_crc_disabled": false + } +} + diff --git a/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.PCB_E336.EU868.basic.clksrc0 b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.PCB_E336.EU868.basic.clksrc0 new file mode 100644 index 0000000..fe81952 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.PCB_E336.EU868.basic.clksrc0 @@ -0,0 +1,225 @@ +{ + "SX1301_conf": { + "lorawan_public": true, + "clksrc": 0, /* radio_1 provides clock to concentrator */ + "lbt_cfg": { + "enable": false, + "rssi_target": 160, /* rssi in dBm = -lbt_rssi_target/2 */ + "nb_channel": 1, + "start_freq": 869525000, + "scan_time_us": 5000, + "tx_delay_1ch_us": 4000000, + "tx_delay_2ch_us": 4000000 + }, + "antenna_gain": 0, /* antenna gain, in dBi */ + "radio_0": { + "enable": true, + "type": "SX1257", + "freq": 867500000, + "rssi_offset": -165.0, + "tx_enable": true, + "tx_freq_min": 863000000, + "tx_freq_max": 870000000 + }, + "radio_1": { + "enable": true, + "type": "SX1257", + "freq": 868500000, + "rssi_offset": -165.0, + "tx_enable": false + }, + "chan_multiSF_0": { + /* Lora MAC channel, 125kHz, all SF, 868.1 MHz */ + "enable": true, + "radio": 1, + "if": -400000 + }, + "chan_multiSF_1": { + /* Lora MAC channel, 125kHz, all SF, 868.3 MHz */ + "enable": true, + "radio": 1, + "if": -200000 + }, + "chan_multiSF_2": { + /* Lora MAC channel, 125kHz, all SF, 868.5 MHz */ + "enable": true, + "radio": 1, + "if": 0 + }, + "chan_multiSF_3": { + /* Lora MAC channel, 125kHz, all SF, 867.1 MHz */ + "enable": true, + "radio": 0, + "if": -400000 + }, + "chan_multiSF_4": { + /* Lora MAC channel, 125kHz, all SF, 867.3 MHz */ + "enable": true, + "radio": 0, + "if": -200000 + }, + "chan_multiSF_5": { + /* Lora MAC channel, 125kHz, all SF, 867.5 MHz */ + "enable": true, + "radio": 0, + "if": 0 + }, + "chan_multiSF_6": { + /* Lora MAC channel, 125kHz, all SF, 867.7 MHz */ + "enable": true, + "radio": 0, + "if": 200000 + }, + "chan_multiSF_7": { + /* Lora MAC channel, 125kHz, all SF, 867.9 MHz */ + "enable": true, + "radio": 0, + "if": 400000 + }, + "chan_Lora_std": { + /* Lora MAC channel, 250kHz, SF7, 868.3 MHz */ + "enable": true, + "radio": 1, + "if": -200000, + "bandwidth": 250000, + "spread_factor": 7 + }, + "chan_FSK": { + /* FSK 50kbps channel, 868.8 MHz */ + "enable": true, + "radio": 1, + "if": 300000, + "bandwidth": 125000, + "datarate": 50000 + }, + "tx_lut_0": { + /* TX gain table, index 0 */ + "pa_gain": 0, + "mix_gain": 8, + "rf_power": -6, + "dig_gain": 3 + }, + "tx_lut_1": { + /* TX gain table, index 1 */ + "pa_gain": 0, + "mix_gain": 10, + "rf_power": -3, + "dig_gain": 3 + }, + "tx_lut_2": { + /* TX gain table, index 2 */ + "pa_gain": 0, + "mix_gain": 10, + "rf_power": 0, + "dig_gain": 1 + }, + "tx_lut_3": { + /* TX gain table, index 3 */ + "pa_gain": 0, + "mix_gain": 14, + "rf_power": 3, + "dig_gain": 2 + }, + "tx_lut_4": { + /* TX gain table, index 4 */ + "pa_gain": 1, + "mix_gain": 10, + "rf_power": 6, + "dig_gain": 3 + }, + "tx_lut_5": { + /* TX gain table, index 5 */ + "pa_gain": 1, + "mix_gain": 12, + "rf_power": 10, + "dig_gain": 2 + }, + "tx_lut_6": { + /* TX gain table, index 6 */ + "pa_gain": 1, + "mix_gain": 12, + "rf_power": 11, + "dig_gain": 1 + }, + "tx_lut_7": { + /* TX gain table, index 7 */ + "pa_gain": 1, + "mix_gain": 12, + "rf_power": 12, + "dig_gain": 0 + }, + "tx_lut_8": { + /* TX gain table, index 8 */ + "pa_gain": 1, + "mix_gain": 14, + "rf_power": 13, + "dig_gain": 2 + }, + "tx_lut_9": { + /* TX gain table, index 9 */ + "pa_gain": 1, + "mix_gain": 13, + "rf_power": 14, + "dig_gain": 0 + }, + "tx_lut_10": { + /* TX gain table, index 10 */ + "pa_gain": 2, + "mix_gain": 9, + "rf_power": 16, + "dig_gain": 2 + }, + "tx_lut_11": { + /* TX gain table, index 11 */ + "pa_gain": 2, + "mix_gain": 11, + "rf_power": 20, + "dig_gain": 1 + }, + "tx_lut_12": { + /* TX gain table, index 12 */ + "pa_gain": 2, + "mix_gain": 13, + "rf_power": 23, + "dig_gain": 1 + }, + "tx_lut_13": { + /* TX gain table, index 13 */ + "pa_gain": 2, + "mix_gain": 15, + "rf_power": 25, + "dig_gain": 2 + }, + "tx_lut_14": { + /* TX gain table, index 14 */ + "pa_gain": 3, + "mix_gain": 10, + "rf_power": 26, + "dig_gain": 2 + }, + "tx_lut_15": { + /* TX gain table, index 15 */ + "pa_gain": 3, + "mix_gain": 10, + "rf_power": 27, + "dig_gain": 1 + } + }, + + "gateway_conf": { + "gateway_ID": "AA555A0000000000", + /* change with default server address/ports, or overwrite in local_conf.json */ + "server_address": "localhost", + "serv_port_up": 1680, + "serv_port_down": 1680, + /* adjust the following parameters for your network */ + "keepalive_interval": 10, + "stat_interval": 30, + "push_timeout_ms": 100, + /* forward only valid packets */ + "forward_crc_valid": true, + "forward_crc_error": false, + "forward_crc_disabled": false + } +} + diff --git a/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.PCB_E336.EU868.basic.clksrc1 b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.PCB_E336.EU868.basic.clksrc1 new file mode 100644 index 0000000..a975861 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.PCB_E336.EU868.basic.clksrc1 @@ -0,0 +1,225 @@ +{ + "SX1301_conf": { + "lorawan_public": true, + "clksrc": 1, /* radio_1 provides clock to concentrator */ + "lbt_cfg": { + "enable": false, + "rssi_target": 160, /* rssi in dBm = -lbt_rssi_target/2 */ + "nb_channel": 1, + "start_freq": 869525000, + "scan_time_us": 5000, + "tx_delay_1ch_us": 4000000, + "tx_delay_2ch_us": 4000000 + }, + "antenna_gain": 0, /* antenna gain, in dBi */ + "radio_0": { + "enable": true, + "type": "SX1257", + "freq": 867500000, + "rssi_offset": -165.0, + "tx_enable": true, + "tx_freq_min": 863000000, + "tx_freq_max": 870000000 + }, + "radio_1": { + "enable": true, + "type": "SX1257", + "freq": 868500000, + "rssi_offset": -165.0, + "tx_enable": false + }, + "chan_multiSF_0": { + /* Lora MAC channel, 125kHz, all SF, 868.1 MHz */ + "enable": true, + "radio": 1, + "if": -400000 + }, + "chan_multiSF_1": { + /* Lora MAC channel, 125kHz, all SF, 868.3 MHz */ + "enable": true, + "radio": 1, + "if": -200000 + }, + "chan_multiSF_2": { + /* Lora MAC channel, 125kHz, all SF, 868.5 MHz */ + "enable": true, + "radio": 1, + "if": 0 + }, + "chan_multiSF_3": { + /* Lora MAC channel, 125kHz, all SF, 867.1 MHz */ + "enable": true, + "radio": 0, + "if": -400000 + }, + "chan_multiSF_4": { + /* Lora MAC channel, 125kHz, all SF, 867.3 MHz */ + "enable": true, + "radio": 0, + "if": -200000 + }, + "chan_multiSF_5": { + /* Lora MAC channel, 125kHz, all SF, 867.5 MHz */ + "enable": true, + "radio": 0, + "if": 0 + }, + "chan_multiSF_6": { + /* Lora MAC channel, 125kHz, all SF, 867.7 MHz */ + "enable": true, + "radio": 0, + "if": 200000 + }, + "chan_multiSF_7": { + /* Lora MAC channel, 125kHz, all SF, 867.9 MHz */ + "enable": true, + "radio": 0, + "if": 400000 + }, + "chan_Lora_std": { + /* Lora MAC channel, 250kHz, SF7, 868.3 MHz */ + "enable": true, + "radio": 1, + "if": -200000, + "bandwidth": 250000, + "spread_factor": 7 + }, + "chan_FSK": { + /* FSK 50kbps channel, 868.8 MHz */ + "enable": true, + "radio": 1, + "if": 300000, + "bandwidth": 125000, + "datarate": 50000 + }, + "tx_lut_0": { + /* TX gain table, index 0 */ + "pa_gain": 0, + "mix_gain": 8, + "rf_power": -6, + "dig_gain": 3 + }, + "tx_lut_1": { + /* TX gain table, index 1 */ + "pa_gain": 0, + "mix_gain": 10, + "rf_power": -3, + "dig_gain": 3 + }, + "tx_lut_2": { + /* TX gain table, index 2 */ + "pa_gain": 0, + "mix_gain": 10, + "rf_power": 0, + "dig_gain": 1 + }, + "tx_lut_3": { + /* TX gain table, index 3 */ + "pa_gain": 0, + "mix_gain": 14, + "rf_power": 3, + "dig_gain": 2 + }, + "tx_lut_4": { + /* TX gain table, index 4 */ + "pa_gain": 1, + "mix_gain": 10, + "rf_power": 6, + "dig_gain": 3 + }, + "tx_lut_5": { + /* TX gain table, index 5 */ + "pa_gain": 1, + "mix_gain": 12, + "rf_power": 10, + "dig_gain": 2 + }, + "tx_lut_6": { + /* TX gain table, index 6 */ + "pa_gain": 1, + "mix_gain": 12, + "rf_power": 11, + "dig_gain": 1 + }, + "tx_lut_7": { + /* TX gain table, index 7 */ + "pa_gain": 1, + "mix_gain": 12, + "rf_power": 12, + "dig_gain": 0 + }, + "tx_lut_8": { + /* TX gain table, index 8 */ + "pa_gain": 1, + "mix_gain": 14, + "rf_power": 13, + "dig_gain": 2 + }, + "tx_lut_9": { + /* TX gain table, index 9 */ + "pa_gain": 1, + "mix_gain": 13, + "rf_power": 14, + "dig_gain": 0 + }, + "tx_lut_10": { + /* TX gain table, index 10 */ + "pa_gain": 2, + "mix_gain": 9, + "rf_power": 16, + "dig_gain": 2 + }, + "tx_lut_11": { + /* TX gain table, index 11 */ + "pa_gain": 2, + "mix_gain": 11, + "rf_power": 20, + "dig_gain": 1 + }, + "tx_lut_12": { + /* TX gain table, index 12 */ + "pa_gain": 2, + "mix_gain": 13, + "rf_power": 23, + "dig_gain": 1 + }, + "tx_lut_13": { + /* TX gain table, index 13 */ + "pa_gain": 2, + "mix_gain": 15, + "rf_power": 25, + "dig_gain": 2 + }, + "tx_lut_14": { + /* TX gain table, index 14 */ + "pa_gain": 3, + "mix_gain": 10, + "rf_power": 26, + "dig_gain": 2 + }, + "tx_lut_15": { + /* TX gain table, index 15 */ + "pa_gain": 3, + "mix_gain": 10, + "rf_power": 27, + "dig_gain": 1 + } + }, + + "gateway_conf": { + "gateway_ID": "AA555A0000000000", + /* change with default server address/ports, or overwrite in local_conf.json */ + "server_address": "localhost", + "serv_port_up": 1680, + "serv_port_down": 1680, + /* adjust the following parameters for your network */ + "keepalive_interval": 10, + "stat_interval": 30, + "push_timeout_ms": 100, + /* forward only valid packets */ + "forward_crc_valid": true, + "forward_crc_error": false, + "forward_crc_disabled": false + } +} + diff --git a/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.US902.basic b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.US902.basic new file mode 100644 index 0000000..3914956 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.US902.basic @@ -0,0 +1,104 @@ +{ + "SX1301_conf": { + "lorawan_public": true, + "clksrc": 1, /* radio_1 provides clock to concentrator */ + "antenna_gain": 0, /* antenna gain, in dBi */ + "radio_0": { + "enable": true, + "type": "SX1257", + "freq": 902700000, + "rssi_offset": -166.0, + "tx_enable": true, + "tx_freq_min": 902000000, + "tx_freq_max": 928000000 + }, + "radio_1": { + "enable": true, + "type": "SX1257", + "freq": 903400000, + "rssi_offset": -166.0, + "tx_enable": false + }, + "chan_multiSF_0": { + /* Lora MAC channel, 125kHz, all SF, 902.3 MHz */ + "enable": true, + "radio": 0, + "if": -400000 + }, + "chan_multiSF_1": { + /* Lora MAC channel, 125kHz, all SF, 902.5 MHz */ + "enable": true, + "radio": 0, + "if": -200000 + }, + "chan_multiSF_2": { + /* Lora MAC channel, 125kHz, all SF, 902.7 MHz */ + "enable": true, + "radio": 0, + "if": 0 + }, + "chan_multiSF_3": { + /* Lora MAC channel, 125kHz, all SF, 902.9 MHz */ + "enable": true, + "radio": 0, + "if": 200000 + }, + "chan_multiSF_4": { + /* Lora MAC channel, 125kHz, all SF, 903.1 MHz */ + "enable": true, + "radio": 1, + "if": -300000 + }, + "chan_multiSF_5": { + /* Lora MAC channel, 125kHz, all SF, 903.3 MHz */ + "enable": true, + "radio": 1, + "if": -100000 + }, + "chan_multiSF_6": { + /* Lora MAC channel, 125kHz, all SF, 903.5 MHz */ + "enable": true, + "radio": 1, + "if": 100000 + }, + "chan_multiSF_7": { + /* Lora MAC channel, 125kHz, all SF, 903.7 MHz */ + "enable": true, + "radio": 1, + "if": 300000 + }, + "chan_Lora_std": { + /* Lora MAC channel, 500kHz, SF8, 903.0 MHz */ + "enable": true, + "radio": 0, + "if": 300000, + "bandwidth": 500000, + "spread_factor": 8 + }, + "chan_FSK": { + /* FSK 100kbps channel, 903.0 MHz */ + "enable": false, + "radio": 0, + "if": 300000, + "bandwidth": 250000, + "datarate": 100000 + } + }, + + "gateway_conf": { + "gateway_ID": "AA555A0000000000", + /* change with default server address/ports, or overwrite in local_conf.json */ + "server_address": "localhost", + "serv_port_up": 1680, + "serv_port_down": 1680, + /* adjust the following parameters for your network */ + "keepalive_interval": 10, + "stat_interval": 30, + "push_timeout_ms": 100, + /* forward only valid packets */ + "forward_crc_valid": true, + "forward_crc_error": false, + "forward_crc_disabled": false + } +} + diff --git a/recipes-connectivity/lora/lora-packet-forwarder/local_conf.json b/recipes-connectivity/lora/lora-packet-forwarder/local_conf.json new file mode 100644 index 0000000..6576072 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/local_conf.json @@ -0,0 +1,7 @@ +{ + "gateway_conf": { + "server_address": "iot.semtech.com", + "serv_port_up": 1680, + "serv_port_down": 1680 + } +} diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.default b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.default new file mode 100644 index 0000000..be7dcd5 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.default @@ -0,0 +1,2 @@ +# set to "yes" or "no" to control starting on boot +ENABLED="yes" diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init new file mode 100755 index 0000000..259243e --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init @@ -0,0 +1,62 @@ +#!/bin/bash + +NAME="lora-packet-forwarder" +ENABLED="yes" + +START_STOP_DAEMON="/usr/sbin/start-stop-daemon" + +[ -f /etc/default/$NAME ] && source /etc/default/$NAME + +run_dir=/var/run/lora +pkt_fwd=/opt/lora/lora_pkt_fwd +pkt_fwd_pidfile=$run_dir/lora-pkt-fwd-1.pid +log_file=/var/log/lora-pkt-fwd.log + +do_start() { + echo -n "Starting $NAME: " + + mkdir -p $run_dir + + # start packet forwarder + $START_STOP_DAEMON --start --background --make-pidfile \ + --pidfile $pkt_fwd_pidfile --startas /bin/bash --chdir "/opt/lora/" \ + -- -c "exec $pkt_fwd > $log_file 2>&1" + + renice -n -20 -p $(pgrep $(basename $pkt_fwd)) + + echo "OK" +} + +do_stop() { + echo -n "Stopping $NAME: " + $START_STOP_DAEMON --stop --quiet --oknodo --pidfile $pkt_fwd_pidfile --retry 5 + rm -f $pkt_fwd_pidfile + echo "OK" +} + +if [ "$ENABLED" != "yes" ]; then + echo "$NAME: disabled in /etc/default/$NAME" + exit +fi + +case "$1" in + "start") + do_start + ;; + "stop") + do_stop + ;; + "restart") + ## Stop the service and regardless of whether it was + ## running or not, start it again. + do_stop + do_start + ;; + *) + ## If no parameters are given, print which are avaiable. + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac + + diff --git a/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb b/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb index ba5aa40..4c23e1c 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb +++ b/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb @@ -6,12 +6,17 @@ SECTION = "console/utils" LICENSE = "SEMTECH" LIC_FILES_CHKSUM = "file://LICENSE;md5=22af7693d7b76ef0fc76161c4be76c45" DEPENDS = "lora-gateway" -PR = "r0" +PR = "r3" SRCREV = "v${PV}" SRC_URI = "git://github.com/Lora-net/packet_forwarder.git;protocol=git \ file://README.md \ + file://lora-packet-forwarder.init \ + file://lora-packet-forwarder.default \ + file://global_conf.json.3.0.0.PCB_E286.EU868.basic.clksrc0 \ + file://global_conf.json.3.0.0.PCB_E286.EU868.basic.clksrc1 \ + file://local_conf.json \ " S = "${WORKDIR}/git" @@ -30,7 +35,14 @@ do_compile() { do_install() { install -d ${D}${LORA_DIR} install -m 755 lora_pkt_fwd/lora_pkt_fwd ${D}${LORA_DIR}/ - install -m 755 lora_pkt_fwd/cfg/global_conf.json.PCB_E336.EU868.basic ${D}${LORA_DIR}/global_conf.json +# This file may be overwritten with a do_install_append_<MACHINE> function + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.PCB_E286.EU868.basic.clksrc1 ${D}${LORA_DIR}/global_conf.json + install -m 755 ${WORKDIR}/local_conf.json ${D}${LORA_DIR}/ + + install -d ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/lora-packet-forwarder.default ${D}${sysconfdir}/default/lora-packet-forwarder + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/lora-packet-forwarder.init ${D}${sysconfdir}/init.d/lora-packet-forwarder install -m 755 util_sink/util_sink ${D}${LORA_DIR}/ install -m 755 util_ack/util_ack ${D}${LORA_DIR}/ @@ -38,6 +50,10 @@ do_install() { install -m 755 ${WORKDIR}/README.md ${D}${LORA_DIR}/ } +do_install_append_mtp() { + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.PCB_E286.EU868.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json +} + FILES_${PN} += "${LORA_DIR}" FILES_${PN}-dbg += "${LORA_DIR}/.debug" |