Stable version of the mDot library for mbed 5. This version of the library is suitable for deployment scenarios. See lastest commit message for version of mbed-os library that has been tested against.

Dependents:   mdot_two_way unh-hackathon-example unh-hackathon-example-raw TelitSensorToCloud ... more

Fork of libmDot-dev-mbed5-deprecated by MultiTech

The Dot library provides a LoRaWan certified stack for LoRa communication using MultiTech mDot and xDot devices. The stack is compatible with mbed 5.

The name of the repository can be used to determine which device the stack was compiled for and if it's a development or production-ready build:

A changelog for the Dot library can be found here.

The Dot library version and the version of mbed-os it was compiled against can both be found in the commit message for that revision of the Dot library. Building your application with the same version of mbed-os as what was used to build the Dot library is highly recommended!

The Dot-Examples repository demonstrates how to use the Dot library in a custom application.

The mDot and xDot platform pages have lots of platform specific information and document potential issues, gotchas, etc, and provide instructions for getting started with development. Please take a look at the platform page before starting development as they should answer many questions you will have.

FOTA

Full FOTA support is only available with mDot, xDot does not have the required external flash. xDot can use the FOTA example to dynamically join a multicast session only. After joining the multicast session the received Fragmentation packets could be handed to a host MCU for processing and at completion the firmware can be loaded into the xDot using the bootloader and y-modem. See xDot Developer Guide.

  • Add the following code to allow Fota to use the Dot instance

main.cpp

    // Initialize FOTA singleton
    Fota::getInstance(dot);
  • Add fragmentation handling the the PacketRx event

RadioEvent.h

    virtual void PacketRx(uint8_t port, uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr, lora::DownlinkControl ctrl, uint8_t slot, uint8_t retries, uint32_t address, bool dupRx) {
        mDotEvent::PacketRx(port, payload, size, rssi, snr, ctrl, slot, retries, address, dupRx);

#if ACTIVE_EXAMPLE == FOTA_EXAMPLE
        if(port == 200 || port == 201 || port == 202) {
            Fota::getInstance()->processCmd(payload, port, size);
        }
#endif
    }

A definition is needed to enable Fragmentation support on mDot and save fragments to flash. This should not be defined for xDot and will result in a compiler error.

mbed_app.json

{
    "macros": [
        "FOTA=1"
    ]
}

The FOTA implementation has a few differences from the LoRaWAN Protocol

  • Fragmentation Indexing starts at 0
  • McKEKey is 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
  • Start Time is a count-down in seconds to start of session
Revision:
60:7985b4783af9
Parent:
26:17479e0039f6
Child:
64:64982192a2af
--- a/Lora.h	Thu May 04 14:39:35 2017 -0500
+++ b/Lora.h	Thu Jul 27 10:30:24 2017 -0500
@@ -209,18 +209,6 @@
     const uint8_t FRAME_OVERHEAD = 13;                          //!< Bytes of network info overhead in a frame
 
     /**
-     * Settings to choose ChannelPlan
-     */
-    enum FrequencyBand {
-        EU868,      //!< EU 863-870 16 channel uplink
-        US915,      //!< US 902-928 64-125k/8-500k uplink and 8-500k downlink channels
-        AU915,      //!< US 915-928 64-125k/8-500k uplink and 8-500k downlink channels
-        CN779,      //!<
-        CN470,      //!<
-        EU433,      //!<
-    };
-
-    /**
      * Settings for type of network
      * PUBLIC - defaults to 5/6 second join windows and 0x34 sync word
      * PRIVATE - defaults to 1/2 second join windows and 0x12 sync word
@@ -261,7 +249,8 @@
         LORA_NO_FREE_CHAN = 15,
         LORA_AGGREGATED_DUTY_CYCLE = 16,
         LORA_MAC_COMMAND_ERROR = 17,
-        LORA_MAX_PAYLOAD_EXCEEDED = 18
+        LORA_MAX_PAYLOAD_EXCEEDED = 18,
+        LORA_LBT_CHANNEL_BUSY = 19
     };
 
     /**
@@ -396,7 +385,7 @@
             uint8_t Key[16];            //!< Network Key or AppKey
             uint8_t JoinDelay;          //!< Number of seconds to wait before 1st RX Window
             uint8_t RxDelay;            //!< Number of seconds to wait before 1st RX Window
-            uint8_t ChannelGroup;       //!< ChannelGroup used for US915 hybrid operation 0:72 channels, 1:1-8 channels ...
+            uint8_t FrequencySubBand;   //!< FrequencySubBand used for US915 hybrid operation 0:72 channels, 1:1-8 channels ...
             uint8_t AckAttempts;        //!< Number of attempts to send packet and receive an ACK from server
             uint8_t Retries;            //!< Number of times to resend a packet without receiving an ACK, redundancy
             uint8_t ADREnabled;         //!< Enable adaptive datarate
@@ -451,6 +440,10 @@
             bool DataPending;                   //!< Indicator of data pending at server
             uint8_t RxTimingSetupReqReceived;   //!< Indicator that RxTimingSetupAns should be included in uplink
             uint8_t RxParamSetupReqAnswer;      //!< Indicator that RxParamSetupAns should be included in uplink
+            uint8_t DlChannelReqAnswer;         //!< Indicator that DlChannelAns should be included in uplink
+            uint8_t DownlinkDwelltime;          //!< On air dwell time for downlink packets 0:NONE,1:400ms
+            uint8_t UplinkDwelltime;            //!< On air dwell time for uplink packets 0:NONE,1:400ms
+            uint8_t Max_EIRP;                   //!< Maximum allowed EIRP for uplink
     } NetworkSession;
 
     /**
@@ -608,13 +601,15 @@
         MOTE_MAC_DEV_STATUS_ANS = 0x06,
         MOTE_MAC_NEW_CHANNEL_ANS = 0x07,
         MOTE_MAC_RX_TIMING_SETUP_ANS = 0x08,
+        MOTE_MAC_TX_PARAM_SETUP_ANS = 0x09,
+        MOTE_MAC_DL_CHANNEL_ANS = 0x0A,
 
         /* Class B */
-        MOTE_MAC_PING_SLOT_INFO_REQ = 0x09,
-        MOTE_MAC_PING_SLOT_FREQ_ANS = 0x0a,
-        MOTE_MAC_PING_SLOT_CHANNEL_ANS = 0x0a,
-        MOTE_MAC_BEACON_TIMING_REQ = 0x0b,
-        MOTE_MAC_BEACON_FREQ_ANS = 0x0c,
+        MOTE_MAC_PING_SLOT_INFO_REQ = 0x0B,
+        MOTE_MAC_PING_SLOT_FREQ_ANS = 0x0C,
+        MOTE_MAC_PING_SLOT_CHANNEL_ANS = 0x0D,
+        MOTE_MAC_BEACON_TIMING_REQ = 0x0E,
+        MOTE_MAC_BEACON_FREQ_ANS = 0x0F,
 
         /* Multitech */
         MOTE_MAC_PING_REQ = 0x80,
@@ -638,13 +633,15 @@
         SRV_MAC_DEV_STATUS_REQ = 0x06,
         SRV_MAC_NEW_CHANNEL_REQ = 0x07,
         SRV_MAC_RX_TIMING_SETUP_REQ = 0x08,
+        SRV_MAC_TX_PARAM_SETUP_REQ = 0x09,
+        SRV_MAC_DL_CHANNEL_REQ = 0x0A,
 
         /* Class B */
-        SRV_MAC_PING_SLOT_INFO_ANS = 0x09,
-        SRV_MAC_PING_SLOT_FREQ_REQ = 0x0a,
-        SRV_MAC_PING_SLOT_CHANNEL_REQ = 0x0a,
-        SRV_MAC_BEACON_TIMING_ANS = 0x0b,
-        SRV_MAC_BEACON_FREQ_REQ = 0x0c,
+        SRV_MAC_PING_SLOT_INFO_ANS = 0x0B,
+        SRV_MAC_PING_SLOT_FREQ_REQ = 0x0C,
+        SRV_MAC_PING_SLOT_CHANNEL_REQ = 0x0D,
+        SRV_MAC_BEACON_TIMING_ANS = 0x0E,
+        SRV_MAC_BEACON_FREQ_REQ = 0x0F,
 
         /* Multitech */
         SRV_MAC_PING_ANS = 0x80,