diff options
5 files changed, 116 insertions, 2 deletions
diff --git a/recipes-connectivity/lora/lora-gateway.inc b/recipes-connectivity/lora/lora-gateway.inc index afd68e0..b2dea9a 100644 --- a/recipes-connectivity/lora/lora-gateway.inc +++ b/recipes-connectivity/lora/lora-gateway.inc @@ -6,11 +6,12 @@ SECTION = "console/utils" LICENSE = "SEMTECH" LIC_FILES_CHKSUM = "file://LICENSE;md5=a2bdef95625509f821ba00460e3ae0eb" DEPENDS = "libftdi libmpsse libusb1" -INC_PR = "r8" +INC_PR = "r9" BRANCH ?= "master" SRC_URI = "git://git.multitech.net/lora_gateway;protocol=git;branch=${BRANCH} \ file://lora-gateway-debug.patch \ + file://lora-gateway-sync-word.patch \ file://library.cfg \ " diff --git a/recipes-connectivity/lora/lora-gateway/lora-gateway-sync-word.patch b/recipes-connectivity/lora/lora-gateway/lora-gateway-sync-word.patch new file mode 100644 index 0000000..e51e02a --- /dev/null +++ b/recipes-connectivity/lora/lora-gateway/lora-gateway-sync-word.patch @@ -0,0 +1,40 @@ +diff --git a/libloragw/inc/loragw_hal.h b/libloragw/inc/loragw_hal.h +index 1516b65..24c5969 100644 +--- a/libloragw/inc/loragw_hal.h ++++ b/libloragw/inc/loragw_hal.h +@@ -302,6 +312,11 @@ struct lgw_pkt_tx_s { + + /* -------------------------------------------------------------------------- */ + /* --- PUBLIC FUNCTIONS PROTOTYPES ------------------------------------------ */ ++/** ++ * @brief Configure the lora synch word ++ * @param word for synch ++ */ ++void lgw_conf_lora_synch_word(uint8_t word); + + /** + @brief Configure an RF chain (must configure before start) +diff --git a/libloragw/src/loragw_hal.c b/libloragw/src/loragw_hal.c +index 5dbdf45..d0fe288 100644 +--- a/libloragw/src/loragw_hal.c ++++ b/libloragw/src/loragw_hal.c +@@ -827,6 +851,19 @@ void lgw_constant_adjust(void) { + /* -------------------------------------------------------------------------- */ + /* --- PUBLIC FUNCTIONS DEFINITION ------------------------------------------ */ + ++void lgw_conf_lora_synch_word(uint8_t word) { ++ uint8_t peak1 = word >> 4; ++ uint8_t peak2 = word & 0x0F; ++ ++ lgw_reg_w(LGW_FRAME_SYNCH_PEAK1_POS, peak1); /* default 1 */ ++ lgw_reg_w(LGW_FRAME_SYNCH_PEAK2_POS, peak2); /* default 2 */ ++ lgw_reg_w(LGW_MBWSSF_FRAME_SYNCH_PEAK1_POS, peak1); /* default 1 */ ++ lgw_reg_w(LGW_MBWSSF_FRAME_SYNCH_PEAK2_POS, peak2); /* default 2 */ ++ lgw_reg_w(LGW_TX_FRAME_SYNCH_PEAK1_POS, peak1); /* default 1 */ ++ lgw_reg_w(LGW_TX_FRAME_SYNCH_PEAK2_POS, peak2); /* default 2 */ ++} ++ ++ + int lgw_rxrf_setconf(uint8_t rf_chain, struct lgw_conf_rxrf_s conf) { + + /* check if the concentrator is running */ diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-no-header-option.patch b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-no-header-option.patch new file mode 100644 index 0000000..ca8d106 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-no-header-option.patch @@ -0,0 +1,30 @@ +From 03c697f2bcf538407ca6a0821dbbb65ab7679aff Mon Sep 17 00:00:00 2001 +From: Jason Reiss <jreiss@multitech.com> +Date: Thu, 16 Jul 2015 13:31:20 -0500 +Subject: [PATCH] feature: add option to send packets with no header + +--- + basic_pkt_fwd/src/basic_pkt_fwd.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/basic_pkt_fwd/src/basic_pkt_fwd.c b/basic_pkt_fwd/src/basic_pkt_fwd.c +index e20dfc1..2223b4a 100644 +--- a/basic_pkt_fwd/src/basic_pkt_fwd.c ++++ b/basic_pkt_fwd/src/basic_pkt_fwd.c +@@ -1276,6 +1276,13 @@ void thread_down(void) { + if (val != NULL) { + txpkt.no_crc = (bool)json_value_get_boolean(val); + } ++ ++ /* Parse "No Header" flag (optional field) */ ++ val = json_object_get_value(txpk_obj,"nhdr"); ++ if (val != NULL) { ++ txpkt.no_header = (bool)json_value_get_boolean(val); ++ } ++ + + /* parse target frequency (mandatory) */ + val = json_object_get_value(txpk_obj,"freq"); +-- +1.7.10.4 + diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-synch-word.patch b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-synch-word.patch new file mode 100644 index 0000000..8da6273 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-synch-word.patch @@ -0,0 +1,41 @@ + +diff --git a/basic_pkt_fwd/src/basic_pkt_fwd.c b/basic_pkt_fwd/src/basic_pkt_fwd.c +index 2223b4a..2db6e26 100644 +--- a/basic_pkt_fwd/src/basic_pkt_fwd.c ++++ b/basic_pkt_fwd/src/basic_pkt_fwd.c +@@ -103,7 +104,8 @@ static bool fwd_error_pkt = false; /* packets with PAYLOAD CRC ERROR are NOT for + static bool fwd_nocrc_pkt = false; /* packets with NO PAYLOAD CRC are NOT forwarded */ + + /* network configuration variables */ ++static uint8_t synch_word = 0x12; + static uint64_t lgwm = 0; /* Lora gateway MAC address */ + static char serv_addr[64] = STR(DEFAULT_SERVER); /* address of the server (host name or IPv4/IPv6) */ + static char serv_port_up[8] = STR(DEFAULT_PORT_UP); /* server port for upstream traffic */ + static char serv_port_down[8] = STR(DEFAULT_PORT_DW); /* server port for downstream traffic */ +@@ -404,7 +415,14 @@ static int parse_gateway_configuration(const char * conf_file) { + snprintf(serv_port_down, sizeof serv_port_down, "%u", (uint16_t)json_value_get_number(val)); + MSG("INFO: downstream port is configured to \"%s\"\n", serv_port_down); + } +- ++ ++ val = json_object_get_value(conf_obj, "synch_word"); ++ if (val != NULL) { ++ synch_word = (uint8_t)json_value_get_number(val); ++ MSG("INFO: synch word is configured to %02x\n", synch_word); ++ } ++ ++ + /* get keep-alive interval (in seconds) for downstream (optional) */ + val = json_object_get_value(conf_obj, "keepalive_interval"); + if (val != NULL) { +@@ -637,7 +721,9 @@ int main(void) + MSG("ERROR: [main] failed to start the concentrator\n"); + exit(EXIT_FAILURE); + } +- ++ ++ lgw_conf_lora_synch_word(synch_word); ++ + /* spawn threads to manage upstream and downstream */ + i = pthread_create( &thrid_up, NULL, (void * (*)(void *))thread_up, NULL); + if (i != 0) { diff --git a/recipes-connectivity/lora/lora-packet-forwarder_1.4.1.bb b/recipes-connectivity/lora/lora-packet-forwarder_1.4.1.bb index 56fdbe6..f7bd52e 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder_1.4.1.bb +++ b/recipes-connectivity/lora/lora-packet-forwarder_1.4.1.bb @@ -6,16 +6,18 @@ SECTION = "console/utils" LICENSE = "SEMTECH" LIC_FILES_CHKSUM = "file://LICENSE;md5=22af7693d7b76ef0fc76161c4be76c45" DEPENDS = "lora-gateway" -PR = "r7" +PR = "r8" # tag v1.4.1 SRCREV = "0011a60759a7d81656a5393e97089daab1ff1a81" SRC_URI = "git://github.com/Lora-net/packet_forwarder.git;protocol=git \ + file://lora-packet-forwarder-add-no-header-option.patch \ file://lora-packet-forwarder-set-spi-path.patch \ file://lora-packet-forwarder-skip-bad-packets.patch \ file://lora-packet-forwarder-fixb64.patch \ file://lora-packet-forwarder-mts-enhancements.patch \ + file://lora-packet-forwarder-synch-word.patch \ " S = "${WORKDIR}/git" |