Stable version of the xDot library for mbed 5. This version of the library is suitable for deployment scenarios.

Dependents:   Dot-Examples XDOT-Devicewise Dot-Examples-delujoc Dot-Examples_receive ... more

Fork of libxDot-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

examples/src/fota_example.cpp

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

examples/inc/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
    }

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

Files at this revision

API Documentation at this revision

Comitter:
Jenkins@KEILDM1.dc.multitech.prv
Date:
Fri Nov 08 09:29:24 2019 -0600
Parent:
19:aa5b1fcd05be
Child:
21:f062567a28ae
Commit message:
xdot-library revision 3.2.5 and mbed-os revision mbed-os-5.13.4

Changed in this revision

ChannelPlan.h Show annotated file Show diff for this revision Revisions of this file
Fota/Fota.h Show annotated file Show diff for this revision Revisions of this file
Fota/MulticastGroup/MulticastGroup.h Show annotated file Show diff for this revision Revisions of this file
Lora.h Show annotated file Show diff for this revision Revisions of this file
MacEvents.h Show annotated file Show diff for this revision Revisions of this file
Mote.h Show annotated file Show diff for this revision Revisions of this file
SxRadio.h Show annotated file Show diff for this revision Revisions of this file
SxRadioEvents.h Show annotated file Show diff for this revision Revisions of this file
libxDot-GCC_ARM.a Show annotated file Show diff for this revision Revisions of this file
mDot.h Show annotated file Show diff for this revision Revisions of this file
mDotEvent.h Show annotated file Show diff for this revision Revisions of this file
plans/ChannelPlans.h Show annotated file Show diff for this revision Revisions of this file
--- a/ChannelPlan.h	Thu Aug 29 12:21:40 2019 -0500
+++ b/ChannelPlan.h	Fri Nov 08 09:29:24 2019 -0600
@@ -77,7 +77,7 @@
              * ChannelPlan destructor
              */
             virtual ~ChannelPlan();
-            
+
             /**
              * Checks that at least one channel exist for the data rate
              */
@@ -565,7 +565,7 @@
             virtual void DefaultLBT();
 
             virtual bool ListenBeforeTalk();
-        
+
             /**
              * use to clear downlink channels on join
              */
@@ -595,6 +595,11 @@
              * Get default number of channels for a plan
              */
             virtual uint8_t GetNumDefaultChans();
+
+            /*
+             * Search enabled channels for lowest available datarate
+             */
+            virtual uint8_t GetMinEnabledDatarate();
         protected:
 
             SxRadio* GetRadio();                //!< Get pointer to the SxRadio object or assert if it is null
@@ -639,7 +644,7 @@
             uint8_t _numChans125k;              //!< Number of 125K  channels in plan
             uint8_t _numChans500k;              //!< Number of 500K channels in plan
             uint8_t _numDefaultChans;           //!< Number of default channels in plan
-            
+
             uint16_t _LBT_TimeUs;               //!< Sample time in us for LBT
             int8_t _LBT_Threshold;              //!< Threshold in dBm for LBT
 
--- a/Fota/Fota.h	Thu Aug 29 12:21:40 2019 -0500
+++ b/Fota/Fota.h	Fri Nov 08 09:29:24 2019 -0600
@@ -1,3 +1,20 @@
+/**********************************************************************
+* COPYRIGHT 2018 MULTI-TECH SYSTEMS, INC.
+*
+* ALL RIGHTS RESERVED BY AND FOR THE EXCLUSIVE BENEFIT OF
+* MULTI-TECH SYSTEMS, INC.
+*
+* MULTI-TECH SYSTEMS, INC. - CONFIDENTIAL AND PROPRIETARY
+* INFORMATION AND/OR TRADE SECRET.
+*
+* NOTICE: ALL CODE, PROGRAM, INFORMATION, SCRIPT, INSTRUCTION,
+* DATA, AND COMMENT HEREIN IS AND SHALL REMAIN THE CONFIDENTIAL
+* INFORMATION AND PROPERTY OF MULTI-TECH SYSTEMS, INC.
+* USE AND DISCLOSURE THEREOF, EXCEPT AS STRICTLY AUTHORIZED IN A
+* WRITTEN AGREEMENT SIGNED BY MULTI-TECH SYSTEMS, INC. IS PROHIBITED.
+*
+***********************************************************************/
+
 #ifndef FOTA_H
 #define FOTA_H
 #include "mDot.h"
--- a/Fota/MulticastGroup/MulticastGroup.h	Thu Aug 29 12:21:40 2019 -0500
+++ b/Fota/MulticastGroup/MulticastGroup.h	Fri Nov 08 09:29:24 2019 -0600
@@ -1,3 +1,20 @@
+/**********************************************************************
+* COPYRIGHT 2018 MULTI-TECH SYSTEMS, INC.
+*
+* ALL RIGHTS RESERVED BY AND FOR THE EXCLUSIVE BENEFIT OF
+* MULTI-TECH SYSTEMS, INC.
+*
+* MULTI-TECH SYSTEMS, INC. - CONFIDENTIAL AND PROPRIETARY
+* INFORMATION AND/OR TRADE SECRET.
+*
+* NOTICE: ALL CODE, PROGRAM, INFORMATION, SCRIPT, INSTRUCTION,
+* DATA, AND COMMENT HEREIN IS AND SHALL REMAIN THE CONFIDENTIAL
+* INFORMATION AND PROPERTY OF MULTI-TECH SYSTEMS, INC.
+* USE AND DISCLOSURE THEREOF, EXCEPT AS STRICTLY AUTHORIZED IN A
+* WRITTEN AGREEMENT SIGNED BY MULTI-TECH SYSTEMS, INC. IS PROHIBITED.
+*
+***********************************************************************/
+
 #ifndef MULTICASTGROUP_H
 #define MULTICASTGROUP_H
 #include "mDot.h"
@@ -39,7 +56,7 @@
             int32_t class_c_start;
             time_t time_setup;
         } mcgroup;
-        
+
         bool* _filled;
         uint8_t _groupId;
         uint8_t _ans;
@@ -49,8 +66,8 @@
         uint32_t _freq;
         uint32_t _frame_count;
         time_t _now;
-        
-        mDot* _dot; 
+
+        mDot* _dot;
         Thread _event_thread;
         EventQueue _switch_class_queue;
         mcgroup _mcGroup[MULTICAST_SESSIONS];
--- a/Lora.h	Thu Aug 29 12:21:40 2019 -0500
+++ b/Lora.h	Fri Nov 08 09:29:24 2019 -0600
@@ -343,14 +343,16 @@
             uint8_t Class;              //!< Operating class of device
             uint8_t EUI[8];             //!< Network ID or AppEUI
             uint8_t Key[16];            //!< Network Key or AppKey
+            uint8_t GenAppKey[16];      //!< Generic App Key, will be AppKey for LW 1.1.x
+            uint8_t McKEKey[16];        //!< Multicast Key Encryption Key
             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 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
-            uint16_t AdrAckLimit;       //!< Number of uplinks without a downlink to allow before setting ADRACKReq
-            uint16_t AdrAckDelay;       //!< Number of downlinks to expect ADR ACK Response within
+            uint8_t AdrAckLimit;       //!< Number of uplinks without a downlink to allow before setting ADRACKReq
+            uint8_t AdrAckDelay;       //!< Number of downlinks to expect ADR ACK Response within
             uint8_t CADEnabled;         //!< Enable listen before talk/channel activity detection
             uint8_t RepeaterMode;       //!< Limit payloads to repeater compatible sizes
             uint8_t TxPower;            //!< Default radio output power in dBm
--- a/MacEvents.h	Thu Aug 29 12:21:40 2019 -0500
+++ b/MacEvents.h	Fri Nov 08 09:29:24 2019 -0600
@@ -29,17 +29,17 @@
             virtual void TxDone(uint8_t dr) = 0;
             virtual void TxTimeout(void) = 0;
 
-            virtual void JoinAccept(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr) = 0;
-            virtual void JoinFailed(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr) = 0;
-            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=0, uint32_t address=0, bool dupRx=false) = 0;
-            virtual void RxDone(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr, lora::DownlinkControl ctrl, uint8_t slot) = 0;
+            virtual void JoinAccept(uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr) = 0;
+            virtual void JoinFailed(uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr) = 0;
+            virtual void PacketRx(uint8_t port, uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr, lora::DownlinkControl ctrl, uint8_t slot, uint8_t retries=0, uint32_t address=0, bool dupRx=false) = 0;
+            virtual void RxDone(uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr, lora::DownlinkControl ctrl, uint8_t slot) = 0;
 
-            virtual void BeaconRx(const BeaconData_t& beacon_data, int16_t rssi, int8_t snr) = 0;
+            virtual void BeaconRx(const BeaconData_t& beacon_data, int16_t rssi, int16_t snr) = 0;
             virtual void BeaconLost() = 0;
             virtual void ServerTime(uint32_t seconds, uint8_t sub_seconds) = 0;
 
-            virtual void Pong(int16_t m_rssi, int8_t m_snr, int16_t s_rssi, int8_t s_snr) = 0;
-            virtual void NetworkLinkCheck(int16_t m_rssi, int8_t m_snr, int8_t s_snr, uint8_t s_gateways) = 0;
+            virtual void Pong(int16_t m_rssi, int16_t m_snr, int16_t s_rssi, int16_t s_snr) = 0;
+            virtual void NetworkLinkCheck(int16_t m_rssi, int16_t m_snr, int16_t s_snr, uint8_t s_gateways) = 0;
 
             virtual void RxTimeout(uint8_t slot) = 0;
             virtual void RxError(uint8_t slot) = 0;
--- a/Mote.h	Thu Aug 29 12:21:40 2019 -0500
+++ b/Mote.h	Fri Nov 08 09:29:24 2019 -0600
@@ -56,7 +56,7 @@
              * @param rssi of received packet
              * @param snr of received packet
              */
-            virtual void JoinAccept(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr);
+            virtual void JoinAccept(uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr);
 
             /**
              * Fired when JoinAccept message is received and MIC is not valid
@@ -65,7 +65,7 @@
              * @param rssi of received packet
              * @param snr of received packet
              */
-            virtual void JoinFailed(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr);
+            virtual void JoinFailed(uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr);
 
             /**
              * Fired when packet is received and MIC is valid
@@ -80,7 +80,7 @@
              * @param address of the end device
              * @param dupRx set if this packet has already been received
              */
-            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 = 0, uint32_t address = 0, bool dupRx=false);
+            virtual void PacketRx(uint8_t port, uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr, lora::DownlinkControl ctrl, uint8_t slot, uint8_t retries = 0, uint32_t address = 0, bool dupRx=false);
 
             /**
              * Fired when radio has received a packet, packet is not validated
@@ -91,7 +91,7 @@
              * @param ctrl Downlink control field of packet
              * @param slot rx window packet was received
              */
-            virtual void RxDone(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr, lora::DownlinkControl ctrl, uint8_t slot);
+            virtual void RxDone(uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr, lora::DownlinkControl ctrl, uint8_t slot);
 
             /**
              * Fired when a beacon is received
@@ -99,7 +99,7 @@
              * @param rssi of received beacon
              * @param snr of received beacon
              */
-            virtual void BeaconRx(const BeaconData_t& beacon_data, int16_t rssi, int8_t snr);
+            virtual void BeaconRx(const BeaconData_t& beacon_data, int16_t rssi, int16_t snr);
 
             /**
              * Fired upon losing beacon synchronization (120 minutes elapsed from last beacon reception)
@@ -125,7 +125,7 @@
              * @param s_rssi of received packet at server
              * @param s_snr of received packet at server
              */
-            virtual void Pong(int16_t m_rssi, int8_t m_snr, int16_t s_rssi, int8_t s_snr);
+            virtual void Pong(int16_t m_rssi, int16_t m_snr, int16_t s_rssi, int16_t s_snr);
 
             /**
              * Fired if network link check answer is received
@@ -134,7 +134,7 @@
              * @param s_snr margin of received packet at server
              * @param s_gateways number of gateways reporting the packet
              */
-            virtual void NetworkLinkCheck(int16_t m_rssi, int8_t m_snr, int8_t s_snr, uint8_t s_gateways);
+            virtual void NetworkLinkCheck(int16_t m_rssi, int16_t m_snr, int16_t s_snr, uint8_t s_gateways);
 
             /**
              * Fired upon receiving a server time answer
--- a/SxRadio.h	Thu Aug 29 12:21:40 2019 -0500
+++ b/SxRadio.h	Fri Nov 08 09:29:24 2019 -0600
@@ -43,6 +43,7 @@
         RF_RX_RUNNING,
         RF_TX_RUNNING,
         RF_CAD,
+        RF_LBT
     }RadioState_t;
 
     SxRadio(uint32_t WakeupTime) : WakeupTime(WakeupTime), freq_offset(0), State(RF_IDLE), Modem(MODEM_LORA) { }
@@ -87,7 +88,7 @@
      *
      * \retval isFree         [true: Channel is free, false: Channel is not free]
      */
-    virtual bool IsChannelFree( RadioModems_t modem, uint32_t freq, uint8_t datarate, int16_t rssiThresh, uint8_t bandwidth, uint32_t timeout = 5000, int16_t *rssiVal = NULL ) = 0;
+    virtual bool IsChannelFree( RadioModems_t modem, uint32_t freq, int16_t rssiThresh, uint32_t timeout = 5000, int16_t *rssiVal = NULL ) = 0;
     /*!
      * \brief Generates a 32 bits random value based on the RSSI readings
      *
--- a/SxRadioEvents.h	Thu Aug 29 12:21:40 2019 -0500
+++ b/SxRadioEvents.h	Fri Nov 08 09:29:24 2019 -0600
@@ -43,7 +43,7 @@
      *                     FSK : N/A ( set to 0 )
      *                     LoRa: SNR value is two's complement in 1/4 dB
      */
-    virtual void RxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ) {}
+    virtual void RxDone( uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr ) {}
     /*!
      * \brief  Rx Timeout callback prototype.
      */
Binary file libxDot-GCC_ARM.a has changed
--- a/mDot.h	Thu Aug 29 12:21:40 2019 -0500
+++ b/mDot.h	Fri Nov 08 09:29:24 2019 -0600
@@ -1080,18 +1080,17 @@
          *
          * AU915 Datarates
          * ---------------
-         * DR0 - SF10BW125
-         * DR1 - SF9BW125
-         * DR2 - SF8BW125
-         * DR3 - SF7BW125
-         * DR4 - SF8BW500
+         * DR0 - SF12BW125
+         * DR1 - SF11BW125
+         * DR2 - SF10BW125
+         * DR3 - SF9BW125
+         * DR4 - SF8BW125
+         * DR5 - SF7BW125
+         * DR6 - SF8BW500
          *
          * @returns spreading factor and bandwidth
          */
         std::string getDataRateDetails(uint8_t rate);
-        MBED_DEPRECATED("Will be removed in 3.3.0")
-        std::string getDateRateDetails(uint8_t rate);
-
 
         /**
          * Set TX power output of radio before antenna gain, default: 14 dBm
@@ -1234,26 +1233,28 @@
         /**
          * Set the ADR ACK Limit
          * @param limit - ADR ACK limit
+         * @returns MDOT_OK if success
          */
-        void setAdrAckLimit(uint16_t limit);
+        int32_t setAdrAckLimit(uint8_t limit);
 
         /**
          * Get the ADR ACK Limit
          * @returns ADR ACK limit
          */
-        uint16_t getAdrAckLimit();
+        uint8_t getAdrAckLimit();
 
         /**
          * Set the ADR ACK Delay
          * @param delay - ADR ACK delay
+         * @returns MDOT_OK if success
          */
-        void setAdrAckDelay(uint16_t delay);
+        int32_t setAdrAckDelay(uint8_t delay);
 
         /**
          * Get the ADR ACK Delay
          * @returns ADR ACK delay
          */
-        uint16_t getAdrAckDelay();
+        uint8_t getAdrAckDelay();
 
         /**
          * Enable/disable CRC checking of packets
--- a/mDotEvent.h	Thu Aug 29 12:21:40 2019 -0500
+++ b/mDotEvent.h	Fri Nov 08 09:29:24 2019 -0600
@@ -189,7 +189,7 @@
             Notify();
         }
 
-        virtual void JoinAccept(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr) {
+        virtual void JoinAccept(uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr) {
             logDebug("mDotEvent - JoinAccept");
 
             _flags.Bits.Tx = 0;
@@ -199,7 +199,7 @@
 
         }
 
-        virtual void JoinFailed(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr) {
+        virtual void JoinFailed(uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr) {
             logDebug("mDotEvent - JoinFailed");
 
             _flags.Bits.Tx = 0;
@@ -215,7 +215,7 @@
             _info.TxNbRetries = retries;
         }
 
-        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) {
+        virtual void PacketRx(uint8_t port, uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr, lora::DownlinkControl ctrl, uint8_t slot, uint8_t retries, uint32_t address, bool dupRx) {
             logDebug("mDotEvent - PacketRx ADDR: %08x", address);
             RxPort = port;
             PacketReceived = true;
@@ -250,12 +250,12 @@
             Notify();
         }
 
-        virtual void RxDone(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr, lora::DownlinkControl ctrl, uint8_t slot) {
+        virtual void RxDone(uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr, lora::DownlinkControl ctrl, uint8_t slot) {
             logDebug("mDotEvent - RxDone");
 
         }
 
-        virtual void BeaconRx(const lora::BeaconData_t& beacon_data, int16_t rssi, int8_t snr) {
+        virtual void BeaconRx(const lora::BeaconData_t& beacon_data, int16_t rssi, int16_t snr) {
             logDebug("mDotEvent - BeaconRx");
             BeaconLocked = true;
             BeaconData = beacon_data;
@@ -266,7 +266,7 @@
             BeaconLocked = false;
         }
 
-        virtual void Pong(int16_t m_rssi, int8_t m_snr, int16_t s_rssi, int8_t s_snr) {
+        virtual void Pong(int16_t m_rssi, int16_t m_snr, int16_t s_rssi, int16_t s_snr) {
             logDebug("mDotEvent - Pong");
             PongReceived = true;
             PongRssi = s_rssi;
@@ -284,7 +284,7 @@
             ServerTimeMillis = static_cast<uint16_t>(current_server_time_ms % 1000);
         }
 
-        virtual void NetworkLinkCheck(int16_t m_rssi, int8_t m_snr, int8_t s_snr, uint8_t s_gateways) {
+        virtual void NetworkLinkCheck(int16_t m_rssi, int16_t m_snr, int16_t s_snr, uint8_t s_gateways) {
             logDebug("mDotEvent - NetworkLinkCheck");
             LinkCheckAnsReceived = true;
             DemodMargin = s_snr;
--- a/plans/ChannelPlans.h	Thu Aug 29 12:21:40 2019 -0500
+++ b/plans/ChannelPlans.h	Fri Nov 08 09:29:24 2019 -0600
@@ -1,3 +1,20 @@
+/**********************************************************************
+* COPYRIGHT 2018 MULTI-TECH SYSTEMS, INC.
+*
+* ALL RIGHTS RESERVED BY AND FOR THE EXCLUSIVE BENEFIT OF
+* MULTI-TECH SYSTEMS, INC.
+*
+* MULTI-TECH SYSTEMS, INC. - CONFIDENTIAL AND PROPRIETARY
+* INFORMATION AND/OR TRADE SECRET.
+*
+* NOTICE: ALL CODE, PROGRAM, INFORMATION, SCRIPT, INSTRUCTION,
+* DATA, AND COMMENT HEREIN IS AND SHALL REMAIN THE CONFIDENTIAL
+* INFORMATION AND PROPERTY OF MULTI-TECH SYSTEMS, INC.
+* USE AND DISCLOSURE THEREOF, EXCEPT AS STRICTLY AUTHORIZED IN A
+* WRITTEN AGREEMENT SIGNED BY MULTI-TECH SYSTEMS, INC. IS PROHIBITED.
+*
+***********************************************************************/
+
 #include "ChannelPlan_AS923.h"
 #include "ChannelPlan_AU915.h"
 #include "ChannelPlan_US915.h"