[riot-notifications] [RIOT-OS/RIOT] gnrc_lorawan: add initial support for GNRC based LoRaWAN stack (v2) (#11022)

Francisco notifications at github.com
Wed Mar 13 22:26:20 CET 2019


fjmolinas commented on this pull request.



> +USEMODULE += $(DRIVER)
+
+# Required for the cipher module */
+CFLAGS += -DCRYPTO_AES
+
+########################### COMPILE TIME CONFIGURATION ########################
+# NOTE: The following options can be configured on runtime as well using
+# `ifconfig`
+
+# OTAA compile time configuration keys
+CFLAGS += -DLORAMAC_APP_KEY_DEFAULT=\{0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\}
+CFLAGS += -DLORAMAC_APP_EUI_DEFAULT=\{0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\}
+CFLAGS += -DLORAMAC_DEV_EUI_DEFAULT=\{0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\}
+
+# Uncomment and replace with proper keys for joining with ABP
+#CFLAGS += -DLORAMAC_DEV_ADDR_DEFAULT=\{0x00\,0x00\,0x00\,0x00\}

Why comment this? If using OTA these will just get overriten once join is completed.

> +#CFLAGS += -DLORAMAC_DEV_ADDR_DEFAULT=\{0x00\,0x00\,0x00\,0x00\}
+#CFLAGS += -DLORAMAC_NWK_SKEY_DEFAULT=\{0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\}
+#CFLAGS += -DLORAMAC_APP_SKEY_DEFAULT=\{0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\}
+
+# Comment/uncomment as necessary
+CFLAGS += -DLORAMAC_DEFAULT_JOIN_PROCEDURE=LORAMAC_JOIN_OTAA
+#CFLAGS += -DLORAMAC_DEFAULT_JOIN_PROCEDURE=LORAMAC_JOIN_ABP
+
+# Set to the highest DR for the EU868 in order to maximize the throughput
+CFLAGS += -DLORAMAC_DEFAULT_DR=LORAMAC_DR_5
+
+# Set the default RX2 datarate to DR3 (used by The Things Network)
+CFLAGS += -DLORAMAC_DEFAULT_RX2_DR=LORAMAC_DR_3
+
+# Set default messages to unconfirmable
+CFLAGS += -DLORAMAC_DEFAULT_TX_MODE=LORAMAC_TX_UNCNF

If this is a test application shouldnt it be confirmed messages by default?

> +{
+    /* This is the longest key */
+    uint8_t key[LORAMAC_APPKEY_LEN];
+
+    size_t key_len = fmt_hex_bytes(key, key_str);
+    size_t expected_len;
+    switch(opt) {
+        case NETOPT_APPKEY:
+        case NETOPT_APPSKEY:
+        case NETOPT_NWKSKEY:
+            /* All keys have the same length as the APP KEY */
+            expected_len = LORAMAC_APPKEY_LEN;
+            break;
+        default:
+            /* Same rationale here */
+            expected_len = LORAMAC_DEVEUI_LEN;

why is expected_len default LORAMAC_DEVEUI_LEN (8u) and not LORAMAC_APPKEY_LEN(16U)

> @@ -497,13 +551,15 @@ static void _netif_list(kernel_pid_t iface)
     line_thresh = _netif_list_flag(iface, NETOPT_CSMA, "CSMA  ",
                                    line_thresh);
     line_thresh += _LINE_THRESHOLD + 1; /* enforce linebreak after this option */
-    line_thresh = _netif_list_flag(iface, NETOPT_AUTOCCA, "AUTOCCA",
+    line_thresh = _netif_list_flag(iface, NETOPT_AUTOCCA, "AUTOCCA ",

remove white sapce

>                                     line_thresh);
-    line_thresh = _netif_list_flag(iface, NETOPT_IQ_INVERT, "IQ_INVERT",
+    line_thresh = _netif_list_flag(iface, NETOPT_IQ_INVERT, "IQ_INVERT ",

same as up

>                                     line_thresh);
-    line_thresh = _netif_list_flag(iface, NETOPT_SINGLE_RECEIVE, "RX_SINGLE",
+    line_thresh = _netif_list_flag(iface, NETOPT_SINGLE_RECEIVE, "RX_SINGLE ",

same as up

>                                     line_thresh);
-    line_thresh = _netif_list_flag(iface, NETOPT_CHANNEL_HOP, "CHAN_HOP",
+    line_thresh = _netif_list_flag(iface, NETOPT_CHANNEL_HOP, "CHAN_HOP ",

same as up.

> +
+#include "gnrc_lorawan_internal.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief maximum timer drift (in %)
+ */
+#ifndef CONFIG_GNRC_LORAWAN_TIMER_DRIFT
+#define CONFIG_GNRC_LORAWAN_TIMER_DRIFT 1
+#endif
+
+/**
+ * @brief the minimum symbols to detect a LoRa preamble */

drop */ one line

> + */
+#ifndef CONFIG_GNRC_LORAWAN_TIMER_DRIFT
+#define CONFIG_GNRC_LORAWAN_TIMER_DRIFT 1
+#endif
+
+/**
+ * @brief the minimum symbols to detect a LoRa preamble */
+#ifndef CONFIG_GNRC_LORAWAN_MIN_SYMBOLS_TIMEOUT
+#define CONFIG_GNRC_LORAWAN_MIN_SYMBOLS_TIMEOUT 50
+#endif
+
+#define GNRC_LORAWAN_REQ_STATUS_SUCCESS (0)     /**< MLME or MCPS request successful status */
+#define GNRC_LORAWAN_REQ_STATUS_DEFERRED (1)    /**< the MLME or MCPS confirm message is asynchronous */
+
+/**
+ * @brief MAC (sub) Layer Management Entity request representation

Since this is the only mention of what MLME means, maybe explicitly put "MAC (sub) Layer Management Entity (MLME)", same for MCPS

> @@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2017 Freie Universit├Ąt Berlin

fix copyright

> @@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2017 Freie Universit├Ąt Berlin

fix copyright

> + */
+#include <stdio.h>
+#include <string.h>
+#include "net/gnrc/netif.h"
+#include "net/lora.h"
+#include "net/gnrc/lorawan/lorawan.h"
+#include "errno.h"
+#include "net/gnrc/pktbuf.h"
+
+#include "net/lorawan/hdr.h"
+#include "net/gnrc/lorawan/region.h"
+
+#define ENABLE_DEBUG    (0)
+#include "debug.h"
+
+#define _DRIFT_FACTOR (1000000 * 100 / (100 + CONFIG_GNRC_LORAWAN_TIMER_DRIFT))

Magic numbers, why these factor for calculating drift?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11022#pullrequestreview-212596637
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190313/94fd2c14/attachment-0001.html>


More information about the notifications mailing list