LoRaWAN MAC layer implementation

Dependents:   LoRaWAN-demo-72_tjm LoRaWAN-demo-72_jlc LoRaWAN-demo-elmo frdm_LoRa_Connect_Woodstream_Demo_tjm ... more

LoRAWAN-lib is a port of the GitHub LoRaMac-node LoRaWAN MAC layer implementation.

This library depends on the SX1276Lib or SX1272Lib radio drivers depending on the used mbed component shield.

This library depends also on some cryptographic helper functions as well as helper functions for the timers management. These can be found on the example projects under the system directory.

The example projects are:

  1. LoRaWAN-demo-72
  2. LoRaWAN-demo-76
  3. LoRaWAN-demo-NAMote72

The LoRaWAN specification specifies different ISM bands operating parameters. These are all implemented under the LoRaMac-board.h file.

In order to select which band to use, please change line 24 of board.h file provided on the examples projects as follows:


EU868

board.h

#define USE_BAND_868


US915

board.h

#define USE_BAND_915


US915 - Hybrid

board.h

#define USE_BAND_915_HYBRID


CN780

board.h

#define USE_BAND_780


EU433

board.h

#define USE_BAND_433
Revision:
3:b9d87593a8ae
Parent:
2:14a5d6ad92d5
Child:
4:37c12dbc8dc7
--- a/LoRaMac.h	Tue Jan 05 16:41:54 2016 +0000
+++ b/LoRaMac.h	Mon Mar 14 09:09:54 2016 +0000
@@ -674,10 +674,26 @@
      */
     int8_t Datarate;
     /*!
-     * Number of attempts to transmit the frame, if frame could not be send, or
-     * if the LoRaMAC layer did not receive an acknowledgment
+     * Number of trials to transmit the frame, if the LoRaMAC layer did not
+     * receive an acknowledgment. The MAC performs a datarate adaptation,
+     * according to the LoRaWAN Specification V1.0, chapter 18.4, according
+     * to the following table:
+     *
+     * Transmission nb | Data Rate
+     * ----------------|-----------
+     * 1 (first)       | DR
+     * 2               | DR
+     * 3               | max(DR-1,0)
+     * 4               | max(DR-1,0)
+     * 5               | max(DR-2,0)
+     * 6               | max(DR-2,0)
+     * 7               | max(DR-3,0)
+     * 8               | max(DR-3,0)
+     *
+     * Note, that if NbTrials is set to 1 or 2, the MAC will not decrease
+     * the datarate, in case the LoRaMAC layer did not receive an acknowledgment
      */
-    uint8_t nbRetries;
+    uint8_t NbTrials;
 }McpsReqConfirmed_t;
 
 /*!
@@ -958,6 +974,7 @@
  * \ref MIB_NWK_SKEY                 | YES | YES
  * \ref MIB_APP_SKEY                 | YES | YES
  * \ref MIB_PUBLIC_NETWORK           | YES | YES
+ * \ref MIB_REPEATER_SUPPORT         | YES | YES
  * \ref MIB_CHANNELS                 | YES | NO
  * \ref MIB_RX2_CHANNEL              | YES | YES
  * \ref MIB_CHANNELS_MASK            | YES | YES
@@ -1341,6 +1358,18 @@
      */
     LORAMAC_STATUS_PARAMETER_INVALID,
     /*!
+     * Service not started - invalid frequency
+     */
+    LORAMAC_STATUS_FREQUENCY_INVALID,
+    /*!
+     * Service not started - invalid datarate
+     */
+    LORAMAC_STATUS_DATARATE_INVALID,
+    /*!
+     * Service not started - invalid frequency and datarate
+     */
+    LORAMAC_STATUS_FREQ_AND_DR_INVALID,
+    /*!
      * Service not started - the device is not in a LoRaWAN
      */
     LORAMAC_STATUS_NO_NETWORK_JOINED,