Bleeding edge development version of the xDot library for mbed 5. This version of the library is not guaranteed to be stable or well tested and should not be used in production or deployment scenarios.

Dependents:   Dot-Examples Dot-AT-Firmware Dot-Examples TEST_FF1705 ... more

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

Dot Library Version 3 Updates

Dot Library versions 3.x.x require a channel plan to be injected into the stack. Channel plans are included with the 3.x.x Dot Library releases. The following code snippet demonstrates how to create a channel plan and inject it into the stack.

#include "mDot.h"
#include "channel_plans.h"

int main() {
    ChannelPlan* plan = new lora::ChannelPlan_US915();
    assert(plan);
    mDot* dot = mDot::getInstance(plan);
    assert(dot);

    // ...
}

Dot devices must not be deployed with software using a different channel plan than the Dot's default plan! This functionality is for development and testing only!

Multicast Sessions

Multicast sessions and packet rx events in library. When in Class C mode Multicast downlinks can be received. Recieved packets should be filtered on address, counter value will be maintained in the session or can be set explicitly depending on Application support to share Multicast Address, Keys and Counters.

mDot.h

        /**
         * Add a multicast session address and keys
         * Downlink counter is set to 0
         * Up to 3 MULTICAST_SESSIONS can be set
         */
        int32_t setMulticastSession(uint8_t index, uint32_t addr, const uint8_t* nsk, const uint8_t* dsk);
 
        /**
         * Set a multicast session counter
         * Up to 3 MULTICAST_SESSIONS can be set
         */
        int32_t setMulticastDownlinkCounter(uint8_t index, uint32_t count);

mDotEvent.h

The address field was added to PacketRx event.

        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);

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.

Files at this revision

API Documentation at this revision

Comitter:
Jenkins@KEILDM1.dc.multitech.prv
Date:
Thu Aug 30 09:06:17 2018 -0500
Parent:
120:77af6791e600
Child:
122:7f150860b6c2
Commit message:
xdot-library revision 3.1.0-class-b-alpha-1-15-g0c33f0a and mbed-os revision mbed-os-5.7.7

Changed in this revision

ChannelPlan.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
libxDot-ARMCC.ar 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/ChannelPlan_AS923.cpp Show annotated file Show diff for this revision Revisions of this file
plans/ChannelPlan_AS923.h Show annotated file Show diff for this revision Revisions of this file
plans/ChannelPlan_AU915.cpp Show annotated file Show diff for this revision Revisions of this file
plans/ChannelPlan_AU915.h Show annotated file Show diff for this revision Revisions of this file
plans/ChannelPlan_EU868.cpp Show annotated file Show diff for this revision Revisions of this file
plans/ChannelPlan_EU868.h Show annotated file Show diff for this revision Revisions of this file
plans/ChannelPlan_IN865.cpp Show annotated file Show diff for this revision Revisions of this file
plans/ChannelPlan_IN865.h Show annotated file Show diff for this revision Revisions of this file
plans/ChannelPlan_KR920.cpp Show annotated file Show diff for this revision Revisions of this file
plans/ChannelPlan_KR920.h Show annotated file Show diff for this revision Revisions of this file
plans/ChannelPlan_US915.cpp Show annotated file Show diff for this revision Revisions of this file
plans/ChannelPlan_US915.h Show annotated file Show diff for this revision Revisions of this file
--- a/ChannelPlan.h	Tue Aug 14 15:45:14 2018 -0500
+++ b/ChannelPlan.h	Thu Aug 30 09:06:17 2018 -0500
@@ -16,6 +16,8 @@
 #ifndef __CHANNEL_STRATEGY_H__
 #define __CHANNEL_STRATEGY_H__
 
+#include "mbed_events.h"
+
 #include "Lora.h"
 #include "SxRadio.h"
 #include <vector>
@@ -96,6 +98,11 @@
             virtual void SetSettings(Settings* settings);
 
             /**
+             * Setter for the event queue
+             */
+            virtual void SetEventQueue(EventQueue* queue);
+
+            /**
              * Get the next channel to use to transmit
              * @return LORA_OK if channel was found
              * @return LORA_NO_CHANS_ENABLED
@@ -256,9 +263,10 @@
              * Set the SxRadio rx config provided window
              * @param window to be opened
              * @param continuous keep window open
+             * @param wnd_growth factor to increase the rx window by
              * @return LORA_OK
              */
-            virtual uint8_t SetRxConfig(uint8_t window, bool continuous) = 0;
+            virtual uint8_t SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth = 1) = 0;
 
             /**
              * Set frequency sub band if supported by plan
@@ -468,8 +476,9 @@
             /**
              * Get time on air with current settings
              * @param bytes number of bytes to be sent
+             * @param cfg for setting up the radio before getting time on air
              */
-            virtual uint32_t GetTimeOnAir(uint8_t bytes);
+            virtual uint32_t GetTimeOnAir(uint8_t bytes, RadioCfg_t cfg = TX_RADIO_CFG);
 
             /**
              * Reset the duty timers with the current time off air
@@ -556,11 +565,34 @@
              * use to clear downlink channels on join
              */
             virtual void ClearChannels();
-    
+
+            /**
+             * Check if this packet is a beacon and if so extract parameters needed
+             * @param payload of potential beacon
+             * @param size of the packet
+             * @param [out] data extracted from the beacon if this packet was indeed a beacon
+             * @return true if this packet is beacon, false if not
+             */
+            virtual bool DecodeBeacon(const uint8_t* payload,
+                                      size_t size,
+                                      BeaconData_t& data) = 0;
+
+            /**
+             * Update class B beacon and ping slot settings if frequency hopping enabled
+             * @param time received in the last beacon
+             * @param period of the beacon
+             * @param devAddr of this end device
+             */
+            virtual void FrequencyHop(uint32_t time, uint32_t period, uint32_t devAddr) { }
+
         protected:
 
             SxRadio* GetRadio();                //!< Get pointer to the SxRadio object or assert if it is null
             Settings* GetSettings();            //!< Get pointer to the settings object or assert if it is null
+            /**
+             * 16 bit ITU-T CRC implementation
+             */
+            uint16_t CRC16(const uint8_t* data, size_t size);
 
             uint8_t _txChannel;                 //!< Current channel for transmit
             uint8_t _txFrequencySubBand;        //!< Current frequency sub band for hybrid operation
@@ -578,9 +610,6 @@
             uint32_t _minFrequency;             //!< Minimum Frequency
             uint32_t _maxFrequency;             //!< Maximum Frequency
 
-            Channel _beaconChannel;             //!< Beacon window settings
-            Channel _beaconRxChannel;           //!< Beacon slot rx window settings
-
             uint8_t _minDatarate;               //!< Minimum datarate to accept in ADR request
             uint8_t _maxDatarate;               //!< Maximum datarate to accept in ADR request
 
@@ -606,11 +635,11 @@
             std::vector<uint16_t> _channelMask; //!< Bit mask for currently enabled channels
 
             Timer _dutyCycleTimer;              //!< Timer for tracking time-off-air
-            RtosTimer _txDutyTimer;             //!< Event timer for expiration of time-off-air
+            int _txDutyEvtId;                   //!< Event ID for expiration of time-off-air
 
             bool _txDutyCyclePending;           //!< Flag for pending duty cycle event
 
-            static void OnTxDutyCycleEvent(const void* arg);    //!< Rtos callback for duty cycle event
+            void OnTxDutyCycleEvent();          //!< Callback for duty cycle event
             void OnTxDutyCycleEventBottom();                    //!< Callback for duty cycle event
 
             static const uint8_t* TX_POWERS;                    //!< List of available tx powers
@@ -625,6 +654,7 @@
 
             SxRadio* _radio;                    //!< Injected SxRadio dependency
             Settings* _settings;                //!< Current settings
+            EventQueue* _evtQueue;              //!< mbed Event Queue
     };
 }
 
--- a/Lora.h	Tue Aug 14 15:45:14 2018 -0500
+++ b/Lora.h	Thu Aug 30 09:06:17 2018 -0500
@@ -103,110 +103,14 @@
     const uint16_t RX2_DELAY_OFFSET = 1000;                     //!< Delay between first and second window
     const uint16_t RXC_OFFSET = 50;                             //!< Time between end of RXC after TX and RX1
 
-    const uint8_t US915_125K_NUM_CHANS = 64;                    //!< Number of 125k channels in US915 channel plan
-    const uint8_t US915_500K_NUM_CHANS = 8;                     //!< Number of 500k channels in US915 channel plan
-
-    const uint32_t US915_125K_FREQ_BASE = 902300000;            //!< Frequency base for 125k US915 uplink channels
-    const uint32_t US915_125K_FREQ_STEP = 200000;               //!< Frequency step for 125k US915 uplink channels
-
-    const uint32_t US915_500K_FREQ_BASE = 903000000;            //!< Frequency base for 500k US915 uplink channels
-    const uint32_t US915_500K_FREQ_STEP = 1600000;              //!< Frequency step for 500k US915 uplink channels
-
-    const uint32_t US915_500K_DBASE = 923300000;                //!< Frequency base for 500k US915 downlink channels
-    const uint32_t US915_500K_DSTEP = 600000;                   //!< Frequency step for 500k US915 downlink channels
-
-    const uint32_t US915_FREQ_MIN = 902000000;
-    const uint32_t US915_FREQ_MAX = 928000000;
-
-    const uint8_t US915_MIN_DATARATE = (uint8_t) DR_0;       //!< Minimum transmit datarate for US915
-    const uint8_t US915_MAX_DATARATE = (uint8_t) DR_4;       //!< Maximum transmit datarate for US915
-
-    const uint8_t US915_MIN_DATARATE_OFFSET = (uint8_t) 0;       //!< Minimum transmit datarate for US915
-    const uint8_t US915_MAX_DATARATE_OFFSET = (uint8_t) 3;       //!< Maximum transmit datarate for US915
-
-    const uint8_t AU915_125K_NUM_CHANS = 64;                    //!< Number of 125k channels in AU915 channel plan
-    const uint8_t AU915_500K_NUM_CHANS = 8;                     //!< Number of 500k channels in AU915 channel plan
-
-    const uint32_t AU915_125K_FREQ_BASE = 915200000;            //!< Frequency base for 125k AU915 uplink channels
-    const uint32_t AU915_125K_FREQ_STEP = 200000;               //!< Frequency step for 125k AU915 uplink channels
-
-    const uint32_t AU915_500K_FREQ_BASE = 915900000;            //!< Frequency base for 500k AU915 uplink channels
-    const uint32_t AU915_500K_FREQ_STEP = 1600000;              //!< Frequency step for 500k AU915 uplink channels
-
-    const uint32_t AU915_500K_DBASE = 923300000;                //!< Frequency base for 500k AU915 downlink channels
-    const uint32_t AU915_500K_DSTEP = 600000;                   //!< Frequency step for 500k AU915 downlink channels
-
-    const uint32_t AU915_FREQ_MIN = 915000000;
-    const uint32_t AU915_FREQ_MAX = 928000000;
-
-    const uint8_t AU915_MIN_DATARATE = (uint8_t) DR_0;       //!< Minimum transmit datarate for AU915
-    const uint8_t AU915_MAX_DATARATE = (uint8_t) DR_6;       //!< Maximum transmit datarate for AU915
-
-    const uint8_t AU915_MIN_DATARATE_OFFSET = (uint8_t) 0;       //!< Minimum transmit datarate for AU915
-    const uint8_t AU915_MAX_DATARATE_OFFSET = (uint8_t) 5;       //!< Maximum transmit datarate for AU915
-
-    const uint8_t EU868_125K_NUM_CHANS = 16;                    //!< Number of 125k channels in EU868 channel plan
-    const uint8_t EU868_DEFAULT_NUM_CHANS = 3;                  //!< Number of default channels in EU868 channel plan
-    const uint32_t EU868_125K_FREQ_BASE = 868100000;            //!< Frequency base for 125k EU868 uplink channels
-    const uint32_t EU868_125K_FREQ_STEP = 200000;               //!< Frequency step for 125k EU868 uplink channels
-    const uint32_t EU868_RX2_FREQ = 869525000;                  //!< Frequency default for second rx window in EU868
-
-    const uint8_t EU868_TX_POWER_MAX = 14;                      //!< Max power for EU868 channel plan
-
-    const uint8_t KR920_125K_NUM_CHANS = 16;                    //!< Number of 125k channels in KR920 channel plan
-    const uint8_t KR920_DEFAULT_NUM_CHANS = 3;                  //!< Number of default channels in KR920 channel plan
-    const uint32_t KR920_125K_FREQ_BASE = 868100000;            //!< Frequency base for 125k KR920 uplink channels
-    const uint32_t KR920_125K_FREQ_STEP = 200000;               //!< Frequency step for 125k KR920 uplink channels
-    const uint32_t KR920_RX2_FREQ = 869525000;                  //!< Frequency default for second rx window in KR920
-
-    const uint8_t KR920_TX_POWER_MAX = 14;                      //!< Max power for KR920 channel plan
-
-    const uint8_t AS923_125K_NUM_CHANS = 16;                    //!< Number of 125k channels in AS923 channel plan
-    const uint8_t AS923_DEFAULT_NUM_CHANS = 2;                  //!< Number of default channels in AS923 channel plan
-    const uint32_t AS923_125K_FREQ_BASE = 868100000;            //!< Frequency base for 125k AS923 uplink channels
-    const uint32_t AS923_125K_FREQ_STEP = 200000;               //!< Frequency step for 125k AS923 uplink channels
-    const uint32_t AS923_RX2_FREQ = 869525000;                  //!< Frequency default for second rx window in AS923
-
-    const uint8_t AS923_TX_POWER_MAX = 14;                      //!< Max power for AS923 channel plan
-
-    const uint8_t IN865_125K_NUM_CHANS = 16;                    //!< Number of 125k channels in IN865 channel plan
-    const uint8_t IN865_DEFAULT_NUM_CHANS = 3;                  //!< Number of default channels in IN865 channel plan
-    const uint32_t IN865_125K_DEF_FREQ_1 = 865062500;
-    const uint32_t IN865_125K_DEF_FREQ_2 = 865402500;
-    const uint32_t IN865_125K_DEF_FREQ_3 = 865985000;
-    const uint32_t IN865_RX2_FREQ = 866550000;                  //!< Frequency default for second rx window in IN865
-
-    const uint8_t IN865_TX_POWER_MAX = 30;                      //!< Max power for IN865 channel plan
-
-    // 0.1% duty cycle 863-868
-    // Limiting to 865-868 allows for 1% duty cycle
-    const uint32_t EU868_MILLI_FREQ_MIN = 865000000;
-    const uint32_t EU868_MILLI_FREQ_MAX = 868000000;
-
-    const uint32_t EU868_MILLI_1_FREQ_MIN = 868700000;
-    const uint32_t EU868_MILLI_1_FREQ_MAX = 869200000;
-
-    // 1% duty cycle
-    const uint32_t EU868_CENTI_FREQ_MIN = 868000000;
-    const uint32_t EU868_CENTI_FREQ_MAX = 868600000;
-
-    // 10% duty cycle
-    const uint32_t EU868_DECI_FREQ_MIN = 869400000;
-    const uint32_t EU868_DECI_FREQ_MAX = 869650000;
-
-    // Below 7dBm there is no duty cycle for these frequencies
-    // Up to 14dBm there is 1% duty cycle
-    const uint32_t EU868_VAR_FREQ_MIN = 869700000;
-    const uint32_t EU868_VAR_FREQ_MAX = 870000000;
-
-    const uint32_t EU868_FREQ_MIN = 863000000;
-    const uint32_t EU868_FREQ_MAX = 870000000;
-
-    const uint8_t EU868_MIN_DATARATE = (uint8_t) DR_0;       //!< Minimum transmit datarate for EU868
-    const uint8_t EU868_MAX_DATARATE = (uint8_t) DR_7;       //!< Maximum transmit datarate for EU868
-
-    const uint8_t EU868_MIN_DATARATE_OFFSET = (uint8_t) 0;       //!< Minimum transmit datarate for US915
-    const uint8_t EU868_MAX_DATARATE_OFFSET = (uint8_t) 5;       //!< Maximum transmit datarate for US915
+    const uint16_t BEACON_PREAMBLE_LENGTH = 10U;                //!< Beacon preamble length
+    const uint16_t DEFAULT_BEACON_PERIOD = 128U;                //!< Default period of the beacon (in seconds)
+    const uint16_t PING_SLOT_LENGTH = 30U;                      //!< Duration of each class B ping slot (in milliseconds)
+    const uint16_t BEACON_RESERVED_TIME = 2120U;                //!< Time reserved for beacon broadcast (in milliseconds)
+    const uint16_t BEACON_GUARD_TIME = 3000U;                   //!< Guard time before beacon transmission where no ping slots can be scheduled (in milliseconds)
+    const uint32_t MAX_BEACONLESS_OP_TIME = 7200U;              //!< Maximum time to operate in class B since last beacon received (in seconds)
+    const uint16_t MAX_CLASS_B_WINDOW_GROWTH = 3U;              //!< Maximum window growth factor for beacons and ping slots in beacon-less operation
+    const uint16_t DEFAULT_PING_NB = 1U;                        //!< Default number of ping slots per beacon interval
 
     const int16_t DEFAULT_FREE_CHAN_RSSI_THRESHOLD = -90;       //!< Threshold for channel activity detection (CAD) dBm
 
@@ -332,18 +236,27 @@
 
 
     /**
-     * Received window used by Link
+     * Receive window used by Link
      */
     enum ReceiveWindows {
         RX_1 = 1,           //!< First receive window
         RX_2,               //!< Second receive window
         RX_BEACON,          //!< Beacon receive window
-        RX_SLOT,            //!< Ping Slot receive window
+        RX_SLOT,            //!< Ping slot receive window
         RXC,                //!< Class C continuous window
         RX_TEST
     };
 
     /**
+     * Beacon info descriptors for the GwSpecific Info field
+     */
+    enum BeaconInfoDesc {
+        GPS_FIRST_ANTENNA = 0,    //!< GPS coordinates of the gateway's first antenna
+        GPS_SECOND_ANTENNA,       //!< GPS coordinates of the gateway's second antenna
+        GPS_THIRD_ANTENNA,        //!< GPS coordinates of the gateway's third antenna
+    };
+
+    /**
      * Datarate range for a Channel
      */
     typedef union {
@@ -367,6 +280,7 @@
             uint8_t TxIQ;
             uint8_t RxIQ;
             uint8_t SymbolTimeout();
+            float Timeout();
             Datarate();
     } Datarate;
 
@@ -401,6 +315,16 @@
     } DutyBand;
 
     /**
+     * Beacon data content (w/o CRCs and RFUs)
+     */
+    typedef struct {
+        uint32_t Time;
+        uint8_t InfoDesc;
+        uint32_t Latitude;
+        uint32_t Longitude;
+    } BeaconData_t;
+
+    /**
      * Device configuration
      */
     typedef struct {
@@ -430,12 +354,13 @@
             uint32_t TxFrequency;       //!< Frequency for P2P transmit
             int8_t AntennaGain;         //!< Antenna Gain
             uint8_t DisableEncryption;  //!< Disable Encryption
-            uint8_t DisableCRC;        //!< Disable CRC on uplink packets
+            uint8_t DisableCRC;         //!< Disable CRC on uplink packets
             uint16_t P2PACKTimeout;
             uint16_t P2PACKBackoff;
             uint8_t JoinRx1DatarateOffset;  //!< Offset for datarate for first window
             uint32_t JoinRx2Frequency;      //!< Frequency used in second window
             uint8_t JoinRx2DatarateIndex;   //!< Datarate for second window
+            uint8_t PingPeriodicity;        //!< Number of ping slots to open in a beacon interval (2^(7-PingPeriodicity))
     } NetworkConfig;
 
     /**
@@ -444,9 +369,14 @@
      */
     typedef struct {
             uint8_t Joined;                     //!< State of session
+            uint8_t Class;                      //!< Operating class of device
             uint8_t Rx1DatarateOffset;          //!< Offset for datarate for first window
             uint32_t Rx2Frequency;              //!< Frequency used in second window
             uint8_t Rx2DatarateIndex;           //!< Datarate for second window
+            uint32_t BeaconFrequency;           //!< Frequency used for the beacon window
+            uint8_t BeaconDatarateIndex;        //!< Datarate for the beacon
+            uint32_t PingSlotFrequency;         //!< Frequency used for ping slot windows
+            uint8_t PingSlotDatarateIndex;      //!< Datarate for the ping slots
             uint8_t TxPower;                    //!< Current total radiated output power in dBm
             uint8_t TxDatarate;                 //!< Current datarate can be changed when ADR is enabled
             uint32_t Address;                   //!< Network address
@@ -636,13 +566,16 @@
         MOTE_MAC_RX_TIMING_SETUP_ANS = 0x08,
         MOTE_MAC_TX_PARAM_SETUP_ANS = 0x09,
         MOTE_MAC_DL_CHANNEL_ANS = 0x0A,
+        MOTE_MAC_REKEY_IND = 0x0B,
+        MOTE_MAC_ADR_PARAM_SETUP_ANS = 0x0C,
+        MOTE_MAC_DEVICE_TIME_REQ = 0x0D,
+        MOTE_MAC_REJOIN_PARAM_SETUP_ANS = 0x0F,
 
         /* Class B */
-        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,
+        MOTE_MAC_PING_SLOT_INFO_REQ = 0x10,
+        MOTE_MAC_PING_SLOT_CHANNEL_ANS = 0x11,
+        MOTE_MAC_BEACON_TIMING_REQ = 0x12,
+        MOTE_MAC_BEACON_FREQ_ANS = 0x13,
 
         /* Multitech */
         MOTE_MAC_PING_REQ = 0x80,
@@ -668,13 +601,17 @@
         SRV_MAC_RX_TIMING_SETUP_REQ = 0x08,
         SRV_MAC_TX_PARAM_SETUP_REQ = 0x09,
         SRV_MAC_DL_CHANNEL_REQ = 0x0A,
+        SRV_MAC_REKEY_CONF = 0x0B,
+        SRV_MAC_ADR_PARAM_SETUP_REQ = 0x0C,
+        SRV_MAC_DEVICE_TIME_ANS = 0x0D,
+        SRV_MAC_FORCE_REJOIN_REQ = 0x0E,
+        SRV_MAC_REJOIN_PARAM_SETUP_REQ = 0x0F,
 
         /* Class B */
-        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,
+        SRV_MAC_PING_SLOT_INFO_ANS = 0x10,
+        SRV_MAC_PING_SLOT_CHANNEL_REQ = 0x11,
+        SRV_MAC_BEACON_TIMING_ANS = 0x12,
+        SRV_MAC_BEACON_FREQ_REQ = 0x13,
 
         /* Multitech */
         SRV_MAC_PING_ANS = 0x80,
@@ -687,6 +624,15 @@
     } ServerCommand;
 
     /**
+     * Radio configuration options
+     */
+    typedef enum RadioCfg {
+        NO_RADIO_CFG,
+        TX_RADIO_CFG,
+        RX_RADIO_CFG
+    } RadioCfg_t;
+
+    /**
      * Random seed for software RNG
      */
     void srand(uint32_t seed);
--- a/MacEvents.h	Tue Aug 14 15:45:14 2018 -0500
+++ b/MacEvents.h	Thu Aug 30 09:06:17 2018 -0500
@@ -34,8 +34,12 @@
             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 BeaconRx(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr) = 0;
+            virtual void BeaconLost() = 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 ServerTime(uint32_t seconds, uint8_t sub_seconds) = 0;
 
             virtual void RxTimeout(uint8_t slot) = 0;
             virtual void RxError(uint8_t slot) = 0;
--- a/Mote.h	Tue Aug 14 15:45:14 2018 -0500
+++ b/Mote.h	Thu Aug 30 09:06:17 2018 -0500
@@ -16,8 +16,11 @@
 #ifndef __LORA_MOTE_H__
 #define __LORA_MOTE_H__
 
-#include "rtos.h"
+#include "mbed.h"
+#include "mbed_events.h"
+
 #include "MacEvents.h"
+
 #include <vector>
 
 class SxRadio;
@@ -91,6 +94,20 @@
             virtual void RxDone(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr, lora::DownlinkControl ctrl, uint8_t slot);
 
             /**
+             * Fired when a beacon is received
+             * @param payload received bytes
+             * @param size number of received bytes
+             * @param rssi of received beacon
+             * @param snr of received beacon
+             */
+            virtual void BeaconRx(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr);
+
+            /**
+             * Fired upon losing beacon synchronization (120 minutes elapsed from last beacon reception)
+             */
+            virtual void BeaconLost();
+
+            /**
              * Fired if rx window times out
              * @param slot rx window that timed out
              */
@@ -121,6 +138,13 @@
             virtual void NetworkLinkCheck(int16_t m_rssi, int8_t m_snr, int8_t s_snr, uint8_t s_gateways);
 
             /**
+             * Fired upon receiving a server time answer
+             * @param seconds from the GPS epoch
+             * @param sub_seconds from the GPS epoch
+             */
+            virtual void ServerTime(uint32_t seconds, uint8_t sub_seconds);
+
+            /**
              * Callback to for device to measure the battery level and report to server
              * @return battery level 0-255, 0 - external power, 1-254 level min-max, 255 device unable to measure battery
              */
@@ -293,6 +317,10 @@
         private:
             ChannelPlan* _plan;
             MoteEvents _events;
+
+            // Event queue objects for timing events
+            EventQueue _evtQueue;
+            Thread _dispatch_thread;
     };
 
 }
--- a/SxRadio.h	Tue Aug 14 15:45:14 2018 -0500
+++ b/SxRadio.h	Thu Aug 30 09:06:17 2018 -0500
@@ -70,6 +70,7 @@
      * \param [IN] modem Modem to be used [0: FSK, 1: LoRa] 
      */
     virtual void SetModem( RadioModems_t modem ) = 0;
+	virtual RadioModems_t GetModem( void ) { return Modem; }
     /*!
      * \brief Sets the channel frequency
      *
Binary file libxDot-ARMCC.ar has changed
Binary file libxDot-GCC_ARM.a has changed
--- a/mDot.h	Tue Aug 14 15:45:14 2018 -0500
+++ b/mDot.h	Thu Aug 30 09:06:17 2018 -0500
@@ -1194,6 +1194,21 @@
         uint8_t getMinTxPower();
 
         /**
+         * Set ping slot periodicity
+         * Specify the the number of ping slots in a given beacon interval
+         * Note: Must switch back to class A for the change to take effect
+         * @param exp - number_of_pings = 2^(7 - exp) where 0 <= exp <= 7
+         * @returns MDOT_OK if success
+         */
+        uint32_t setPingPeriodicity(uint8_t exp);
+
+        /**
+         * Get ping slot periodicity
+         * @returns exp = 7 - log2(number_of_pings)
+         */
+        uint8_t getPingPeriodicity();
+
+        /**
          *
          * get/set adaptive data rate
          * configure data rates and power levels based on signal to noise of packets received at gateway
--- a/mDotEvent.h	Tue Aug 14 15:45:14 2018 -0500
+++ b/mDotEvent.h	Thu Aug 30 09:06:17 2018 -0500
@@ -63,9 +63,13 @@
           PacketReceived(false),
           RxPort(0),
           RxPayloadSize(0),
+          BeaconLocked(false),
+          BeaconPayloadSize(0U),
           PongReceived(false),
           PongRssi(0),
           PongSnr(0),
+          ServerTimeReceived(false),
+          ServerTimeSeconds(0U),
           AckReceived(false),
           DuplicateRx(false),
           TxNbRetries(0),
@@ -234,6 +238,19 @@
                 _sleep_cb(mDot::AUTO_SLEEP_EVT_CLEANUP);
         }
 
+        virtual void BeaconRx(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr) {
+            logDebug("mDotEvent - BeaconRx");
+            BeaconLocked = true;
+
+            memcpy(BeaconPayload, payload, size);
+            BeaconPayloadSize = size;
+        }
+
+        virtual void BeaconLost() {
+            logDebug("mDotEvent - BeaconLost");
+            BeaconLocked = false;
+        }
+
         virtual void Pong(int16_t m_rssi, int8_t m_snr, int16_t s_rssi, int8_t s_snr) {
             logDebug("mDotEvent - Pong");
             PongReceived = true;
@@ -241,6 +258,12 @@
             PongSnr = s_snr;
         }
 
+        virtual void ServerTime(uint32_t seconds, uint8_t sub_seconds) {
+            logDebug("mDotEvent - ServerTime");
+            ServerTimeReceived = true;
+            ServerTimeSeconds = seconds;
+        }
+
         virtual void NetworkLinkCheck(int16_t m_rssi, int8_t m_snr, int8_t s_snr, uint8_t s_gateways) {
             logDebug("mDotEvent - NetworkLinkCheck");
             LinkCheckAnsReceived = true;
@@ -309,10 +332,17 @@
         uint8_t RxPayload[255];
         uint8_t RxPayloadSize;
 
+        bool BeaconLocked;
+        uint8_t BeaconPayload[25];
+        uint8_t BeaconPayloadSize;
+
         bool PongReceived;
         int16_t PongRssi;
         int16_t PongSnr;
 
+        bool ServerTimeReceived;
+        uint32_t ServerTimeSeconds;
+
         bool AckReceived;
         bool DuplicateRx;
         uint8_t TxNbRetries;
--- a/plans/ChannelPlan_AS923.cpp	Tue Aug 14 15:45:14 2018 -0500
+++ b/plans/ChannelPlan_AS923.cpp	Thu Aug 30 09:06:17 2018 -0500
@@ -92,6 +92,12 @@
 
     GetSettings()->Session.Rx2Frequency = 923200000;
     GetSettings()->Session.Rx2DatarateIndex = DR_2;
+
+    GetSettings()->Session.BeaconFrequency = AS923_BEACON_FREQ;
+    GetSettings()->Session.BeaconDatarateIndex = AS923_BEACON_DR;
+    GetSettings()->Session.PingSlotFrequency = AS923_BEACON_FREQ;
+    GetSettings()->Session.PingSlotDatarateIndex = AS923_BEACON_DR;
+
     GetSettings()->Session.Max_EIRP  = 16;
 
     logInfo("Initialize datarates...");
@@ -271,7 +277,7 @@
     return LORA_OK;
 }
 
-uint8_t ChannelPlan_AS923::SetRxConfig(uint8_t window, bool continuous) {
+uint8_t ChannelPlan_AS923::SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth) {
 
     RxWindow rxw = GetRxWindow(window);
 
@@ -285,8 +291,10 @@
     uint32_t sf = rxDr.SpreadingFactor;
     uint8_t cr = rxDr.Coderate;
     uint8_t pl = rxDr.PreambleLength;
-    uint16_t sto = rxDr.SymbolTimeout();
+    uint16_t sto = rxDr.SymbolTimeout() * wnd_growth;
     uint32_t afc = 0;
+    bool fixLen = false;
+    uint8_t payloadLen = 0U;
     bool crc = false; // downlink does not use CRC according to LORAWAN
 
     if (GetSettings()->Network.DisableCRC == true)
@@ -299,6 +307,14 @@
         iq = txDr.TxIQ;
     }
 
+    // Beacon modifications - no I/Q inversion, fixed length rx, preamble
+    if (window == RX_BEACON) {
+        iq = txDr.TxIQ;
+        fixLen = true;
+        payloadLen = sizeof(BCNPayload);
+        pl = BEACON_PREAMBLE_LENGTH;
+    }
+
     SxRadio::RadioModems_t modem = SxRadio::MODEM_LORA;
 
     if (sf == SF_FSK) {
@@ -315,7 +331,7 @@
     // logTrace("Configure radio for RX%d on freq: %lu", window, rxw.Frequency);
     // logTrace("RX SF: %u BW: %u CR: %u PL: %u STO: %u CRC: %d IQ: %d", sf, bw, cr, pl, sto, crc, iq);
 
-    GetRadio()->SetRxConfig(modem, bw, sf, cr, afc, pl, sto, false, 0, crc, false, 0, iq, continuous);
+    GetRadio()->SetRxConfig(modem, bw, sf, cr, afc, pl, sto, fixLen, payloadLen, crc, false, 0, iq, continuous);
 
     return LORA_OK;
 }
@@ -375,7 +391,9 @@
         rxw.Frequency = GetSettings()->Network.TxFrequency;
         index = GetSettings()->Session.TxDatarate;
     } else {
-        if (window == 1) {
+        switch (window) {
+        case RX_1:
+        {
             // Use same frequency as TX
             rxw.Frequency = _channels[_txChannel].Frequency;
 
@@ -392,8 +410,21 @@
             uint8_t minDr = GetSettings()->Session.DownlinkDwelltime == 1 ? 2 : 0;
             index = std::min<uint8_t>(5, std::max<uint8_t>(minDr, index));
 
-        } else {
-            // Use session RX2 frequency
+            break;
+        }
+
+        case RX_BEACON:
+            rxw.Frequency = GetSettings()->Session.BeaconFrequency;
+            index = GetSettings()->Session.BeaconDatarateIndex;
+            break;
+
+        case RX_SLOT:
+            rxw.Frequency = GetSettings()->Session.PingSlotFrequency;
+            index = GetSettings()->Session.PingSlotDatarateIndex;
+            break;
+
+        // RX2, RXC, RX_TEST, etc..
+        default:
             rxw.Frequency = GetSettings()->Session.Rx2Frequency;
             index = GetSettings()->Session.Rx2DatarateIndex;
         }
@@ -492,54 +523,67 @@
 }
 
 uint8_t ChannelPlan_AS923::HandlePingSlotChannelReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) {
+    uint8_t datarate = 0;
+    uint32_t freq = 0;
 
-    lora::CopyFreqtoInt(payload + index, _beaconRxChannel.Frequency);
-    index += 3;
+    status = 0x03;
 
-    if (_beaconRxChannel.Frequency != 0) {
-        _beaconRxChannel.DrRange.Value = payload[index];
-    } else {
-        // TODO: set to default beacon rx channel
+    freq = payload[index++];
+    freq |= payload[index++] << 8;
+    freq |= payload[index++] << 16;
+    freq *= 100;
+
+    datarate = payload[index] & 0x0F;
+
+    if (freq == 0U) {
+        logInfo("Received request to reset ping slot frequency to default");
+        freq = AS923_BEACON_FREQ;
+    } else if (!CheckRfFrequency(freq)) {
+        logInfo("Freq KO");
+        status &= 0xFE; // Channel frequency KO
     }
 
-    status = 0x03;
+    if (datarate < _minRx2Datarate || datarate > _maxRx2Datarate) {
+        logInfo("DR KO");
+        status &= 0xFD; // Datarate KO
+    }
+
+    if ((status & 0x03) == 0x03) {
+        logInfo("PingSlotChannelReq accepted DR: %d Freq: %d", datarate, freq);
+        GetSettings()->Session.PingSlotFrequency = freq;
+        GetSettings()->Session.PingSlotDatarateIndex = datarate;
+    } else {
+        logInfo("PingSlotChannelReq rejected DR: %d Freq: %d", datarate, freq);
+    }
+
     return LORA_OK;
 }
 
 uint8_t ChannelPlan_AS923::HandleBeaconFrequencyReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) {
+    uint32_t freq = 0;
 
-    status = 0x03;
-    Channel chParam;
+    status = 0x01;
 
-    // Skip channel index
-    index++;
+    freq = payload[index++];
+    freq |= payload[index++] << 8;
+    freq |= payload[index] << 16;
+    freq *= 100;
 
-    lora::CopyFreqtoInt(payload + index, chParam.Frequency);
-    index += 3;
-    chParam.DrRange.Value = payload[index++];
-
-    if (!GetRadio()->CheckRfFrequency(chParam.Frequency)) {
+    if (freq == 0U) {
+        logInfo("Received request to reset beacon frequency to default");
+        freq = AS923_BEACON_FREQ;
+    } else if (!CheckRfFrequency(freq)) {
+        logInfo("Freq KO");
         status &= 0xFE; // Channel frequency KO
     }
 
-    if (chParam.DrRange.Fields.Min < chParam.DrRange.Fields.Max) {
-        status &= 0xFD; // Datarate range KO
-    } else if (chParam.DrRange.Fields.Min < _minDatarate || chParam.DrRange.Fields.Min > _maxDatarate) {
-        status &= 0xFD; // Datarate range KO
-    } else if (chParam.DrRange.Fields.Max < _minDatarate || chParam.DrRange.Fields.Max > _maxDatarate) {
-        status &= 0xFD; // Datarate range KO
+    if (status & 0x01) {
+        logInfo("BeaconFrequencyReq accepted Freq: %d", freq);
+        GetSettings()->Session.BeaconFrequency = freq;
+    } else {
+        logInfo("BeaconFrequencyReq rejected Freq: %d", freq);
     }
 
-    if ((status & 0x03) == 0x03) {
-        _beaconChannel = chParam;
-    }
-
-    if (_beaconChannel.Frequency == 0) {
-        // TODO: Set to default
-    }
-
-    status = 0x01;
-
     return LORA_OK;
 }
 
@@ -1045,3 +1089,39 @@
     }
 }
 
+bool ChannelPlan_AS923::DecodeBeacon(const uint8_t* payload, size_t size, BeaconData_t& data) {
+    uint16_t crc1, crc1_rx, crc2, crc2_rx;
+    const BCNPayload* beacon = (const BCNPayload*)payload;
+
+    // First check the size of the packet
+    if (size != sizeof(BCNPayload))
+        return false;
+
+    // Next we verify the CRCs are correct
+    crc1 = CRC16(beacon->RFU, sizeof(beacon->RFU) + sizeof(beacon->Time));
+    memcpy((uint8_t*)&crc1_rx, beacon->CRC1, sizeof(uint16_t));
+
+    if (crc1 != crc1_rx)
+        return false;
+
+    crc2 = CRC16(beacon->GwSpecific, sizeof(beacon->GwSpecific));
+    memcpy((uint8_t*)&crc2_rx, beacon->CRC2, sizeof(uint16_t));
+
+    if (crc2 != crc2_rx)
+        return false;
+
+    // Now that we have confirmed this packet is a beacon, parse and complete the output struct
+    memcpy(&data.Time, beacon->Time, sizeof(beacon->Time));
+    data.InfoDesc = beacon->GwSpecific[0];
+
+    // Update the GPS fields if we have a gps info descriptor
+    if (data.InfoDesc == GPS_FIRST_ANTENNA ||
+        data.InfoDesc == GPS_SECOND_ANTENNA ||
+        data.InfoDesc == GPS_THIRD_ANTENNA) {
+        // Latitude and Longitude 3 bytes in length
+        memcpy(&data.Latitude, &beacon->GwSpecific[1], 3);
+        memcpy(&data.Longitude, &beacon->GwSpecific[4], 3);
+    }
+
+    return true;
+}
--- a/plans/ChannelPlan_AS923.h	Tue Aug 14 15:45:14 2018 -0500
+++ b/plans/ChannelPlan_AS923.h	Thu Aug 30 09:06:17 2018 -0500
@@ -23,6 +23,14 @@
 
 namespace lora {
 
+    const uint8_t  AS923_125K_NUM_CHANS = 16;        //!< Number of 125k channels in AS923 channel plan
+    const uint8_t  AS923_DEFAULT_NUM_CHANS = 2;      //!< Number of default channels in AS923 channel plan
+    const uint32_t AS923_125K_FREQ_BASE = 923200000; //!< Frequency base for 125k AS923 uplink channels
+    const uint32_t AS923_125K_FREQ_STEP = 200000;    //!< Frequency step for 125k AS923 uplink channels
+    const uint32_t AS923_RX2_FREQ = 923200000;       //!< Frequency default for second rx window in AS923
+    const uint8_t  AS923_BEACON_DR = DR_3;           //!< Default beacon datarate
+    const uint32_t AS923_BEACON_FREQ = 923400000U;   //!< Default beacon broadcast frequency
+
     class ChannelPlan_AS923: public lora::ChannelPlan {
         public:
             /**
@@ -95,9 +103,10 @@
              * Set the SxRadio rx config provided window
              * @param window to be opened
              * @param continuous keep window open
+             * @param wnd_growth factor to increase the rx window by
              * @return LORA_OK
              */
-            virtual uint8_t SetRxConfig(uint8_t window, bool continuous);
+            virtual uint8_t SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth);
 
             /**
              * Set frequency sub band if supported by plan
@@ -230,6 +239,17 @@
              */
             virtual void DecrementDatarate();
 
+            /**
+             * Check if this packet is a beacon and if so extract parameters needed
+             * @param payload of potential beacon
+             * @param size of the packet
+             * @param [out] data extracted from the beacon if this packet was indeed a beacon
+             * @return true if this packet is beacon, false if not
+             */
+            virtual bool DecodeBeacon(const uint8_t* payload,
+                                      size_t size,
+                                      BeaconData_t& data);
+
         protected:
 
             static const uint8_t AS923_TX_POWERS[8];                    //!< List of available tx powers
@@ -238,6 +258,14 @@
             static const uint8_t AS923_MAX_PAYLOAD_SIZE_400[];              //!< List of max payload sizes for each datarate
             static const uint8_t AS923_MAX_PAYLOAD_SIZE_REPEATER[];     //!< List of repeater compatible max payload sizes for each datarate
             static const uint8_t AS923_MAX_PAYLOAD_SIZE_REPEATER_400[];     //!< List of repeater compatible max payload sizes for each datarate
+
+            typedef struct __attribute__((packed)) {
+                uint8_t RFU[2];
+                uint8_t Time[4];
+                uint8_t CRC1[2];
+                uint8_t GwSpecific[7];
+                uint8_t CRC2[2];
+            } BCNPayload;
     };
 }
 
--- a/plans/ChannelPlan_AU915.cpp	Tue Aug 14 15:45:14 2018 -0500
+++ b/plans/ChannelPlan_AU915.cpp	Thu Aug 30 09:06:17 2018 -0500
@@ -28,6 +28,8 @@
 ChannelPlan_AU915::ChannelPlan_AU915()
 :
   ChannelPlan(NULL, NULL)
+  , _bcnFreqHop(true)
+  , _pingFreqHop(true)
 {
 
 }
@@ -35,6 +37,8 @@
 ChannelPlan_AU915::ChannelPlan_AU915(Settings* settings)
 :
   ChannelPlan(NULL, settings)
+  , _bcnFreqHop(true)
+  , _pingFreqHop(true)
 {
 
 }
@@ -42,6 +46,8 @@
 ChannelPlan_AU915::ChannelPlan_AU915(SxRadio* radio, Settings* settings)
 :
   ChannelPlan(radio, settings)
+  , _bcnFreqHop(true)
+  , _pingFreqHop(true)
 {
 
 }
@@ -87,6 +93,11 @@
     _freqDStep500k = AU915_500K_DSTEP;
     GetSettings()->Session.Rx2Frequency = AU915_500K_DBASE;
 
+    GetSettings()->Session.BeaconFrequency = AU915_BEACON_FREQ_BASE;
+    GetSettings()->Session.BeaconDatarateIndex = AU915_BEACON_DR;
+    GetSettings()->Session.PingSlotFrequency = AU915_BEACON_FREQ_BASE;
+    GetSettings()->Session.PingSlotDatarateIndex = AU915_BEACON_DR;
+
     _minDatarate = AU915_MIN_DATARATE;
     _maxDatarate = AU915_MAX_DATARATE;
     _minRx2Datarate = DR_8;
@@ -271,7 +282,7 @@
     return LORA_OK;
 }
 
-uint8_t ChannelPlan_AU915::SetRxConfig(uint8_t window, bool continuous) {
+uint8_t ChannelPlan_AU915::SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth) {
 
     RxWindow rxw = GetRxWindow(window);
     GetRadio()->SetChannel(rxw.Frequency);
@@ -281,8 +292,10 @@
     uint32_t sf = rxDr.SpreadingFactor;
     uint8_t cr = rxDr.Coderate;
     uint8_t pl = rxDr.PreambleLength;
-    uint16_t sto = rxDr.SymbolTimeout();
+    uint16_t sto = rxDr.SymbolTimeout() * wnd_growth;
     uint32_t afc = 0;
+    bool fixLen = false;
+    uint8_t payloadLen = 0U;
     bool crc = false; // downlink does not use CRC according to LORAWAN
 
     if (GetSettings()->Network.DisableCRC == true)
@@ -295,6 +308,14 @@
         iq = txDr.TxIQ;
     }
 
+    // Beacon modifications - no I/Q inversion, fixed length rx, preamble
+    if (window == RX_BEACON) {
+        iq = txDr.TxIQ;
+        fixLen = true;
+        payloadLen = sizeof(BCNPayload);
+        pl = BEACON_PREAMBLE_LENGTH;
+    }
+
     SxRadio::RadioModems_t modem = SxRadio::MODEM_LORA;
 
     if (sf == SF_FSK) {
@@ -311,7 +332,7 @@
     // logTrace("Configure radio for RX%d on freq: %lu", window, rxw.Frequency);
     // logTrace("RX SF: %u BW: %u CR: %u PL: %u STO: %u CRC: %d IQ: %d", sf, bw, cr, pl, sto, crc, iq);
 
-    GetRadio()->SetRxConfig(modem, bw, sf, cr, afc, pl, sto, false, 0, crc, false, 0, iq, continuous);
+    GetRadio()->SetRxConfig(modem, bw, sf, cr, afc, pl, sto, fixLen, payloadLen, crc, false, 0, iq, continuous);
 
     return LORA_OK;
 }
@@ -401,7 +422,8 @@
         rxw.Frequency = GetSettings()->Network.TxFrequency;
         index = GetSettings()->Session.TxDatarate;
     } else {
-        if (window == 1) {
+        switch (window) {
+        case RX_1:
             if (_txChannel < _numChans125k) {
                 if (GetSettings()->Network.Mode == lora::PRIVATE_MTS)
                     rxw.Frequency = _freqDBase500k + (_txChannel / 8) * _freqDStep500k;
@@ -422,7 +444,21 @@
                 if (index < DR_8)
                     index = DR_8;
             }
-        } else {
+
+            break;
+
+        case RX_BEACON:
+            rxw.Frequency = GetSettings()->Session.BeaconFrequency;
+            index = GetSettings()->Session.BeaconDatarateIndex;
+            break;
+
+        case RX_SLOT:
+            rxw.Frequency = GetSettings()->Session.PingSlotFrequency;
+            index = GetSettings()->Session.PingSlotDatarateIndex;
+            break;
+
+        // RX2, RXC, RX_TEST, etc..
+        default:
             if (GetSettings()->Network.Mode == lora::PRIVATE_MTS) {
                 if (_txChannel < _numChans125k) {
                     rxw.Frequency = _freqDBase500k + (_txChannel / 8) * _freqDStep500k;
@@ -432,6 +468,7 @@
             } else {
                 rxw.Frequency = GetSettings()->Session.Rx2Frequency;
             }
+
             index = GetSettings()->Session.Rx2DatarateIndex;
         }
     }
@@ -498,58 +535,76 @@
 }
 
 uint8_t ChannelPlan_AU915::HandlePingSlotChannelReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) {
+    uint8_t datarate = 0;
+    uint32_t freq = 0;
+    bool freqHop = false;
 
-    lora::CopyFreqtoInt(payload + index, _beaconRxChannel.Frequency);
-    index += 3;
+    status = 0x03;
 
-    if (_beaconRxChannel.Frequency != 0) {
-        _beaconRxChannel.DrRange.Value = payload[index];
-    } else {
-        // TODO: set to default beacon rx channel
+    freq = payload[index++];
+    freq |= payload[index++] << 8;
+    freq |= payload[index++] << 16;
+    freq *= 100;
+
+    datarate = payload[index] & 0x0F;
+
+    if (freq == 0U) {
+        logInfo("Received request to reset ping slot frequency to default");
+        freq = AU915_BEACON_FREQ_BASE;
+        freqHop = true;
+    } else if (!CheckRfFrequency(freq)) {
+        logInfo("Freq KO");
+        status &= 0xFE; // Channel frequency KO
     }
 
-    status = 0x03;
+    if (datarate < _minRx2Datarate || datarate > _maxRx2Datarate) {
+        logInfo("DR KO");
+        status &= 0xFD; // Datarate KO
+    }
+
+    if ((status & 0x03) == 0x03) {
+        logInfo("PingSlotChannelReq accepted DR: %d Freq: %d", datarate, freq);
+        GetSettings()->Session.PingSlotFrequency = freq;
+        GetSettings()->Session.PingSlotDatarateIndex = datarate;
+        _pingFreqHop = freqHop;
+    } else {
+        logInfo("PingSlotChannelReq rejected DR: %d Freq: %d", datarate, freq);
+    }
+
     return LORA_OK;
 }
 
 uint8_t ChannelPlan_AU915::HandleBeaconFrequencyReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) {
+    uint32_t freq = 0;
+    bool freqHop = false;
 
-    status = 0x03;
-    Channel chParam;
+    status = 0x01;
 
-    // Skip channel index
-    index++;
+    freq = payload[index++];
+    freq |= payload[index++] << 8;
+    freq |= payload[index] << 16;
+    freq *= 100;
 
-    lora::CopyFreqtoInt(payload + index, chParam.Frequency);
-    index += 3;
-    chParam.DrRange.Value = payload[index++];
-
-    if (!GetRadio()->CheckRfFrequency(chParam.Frequency)) {
+    if (freq == 0U) {
+        logInfo("Received request to reset beacon frequency to default");
+        freq = AU915_BEACON_FREQ_BASE;
+        freqHop = true;
+    } else if (!CheckRfFrequency(freq)) {
+        logInfo("Freq KO");
         status &= 0xFE; // Channel frequency KO
     }
 
-    if (chParam.DrRange.Fields.Min < chParam.DrRange.Fields.Max) {
-        status &= 0xFD; // Datarate range KO
-    } else if (chParam.DrRange.Fields.Min < _minDatarate || chParam.DrRange.Fields.Min > _maxDatarate) {
-        status &= 0xFD; // Datarate range KO
-    } else if (chParam.DrRange.Fields.Max < _minDatarate || chParam.DrRange.Fields.Max > _maxDatarate) {
-        status &= 0xFD; // Datarate range KO
+    if (status & 0x01) {
+        logInfo("BeaconFrequencyReq accepted Freq: %d", freq);
+        GetSettings()->Session.BeaconFrequency = freq;
+        _bcnFreqHop = freqHop;
+    } else {
+        logInfo("BeaconFrequencyReq rejected Freq: %d", freq);
     }
 
-    if ((status & 0x03) == 0x03) {
-        _beaconChannel = chParam;
-    }
-
-    if (_beaconChannel.Frequency == 0) {
-        // TODO: Set to default
-    }
-
-    status = 0x01;
-
     return LORA_OK;
 }
 
-
 uint8_t ChannelPlan_AU915::HandleAdrCommand(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) {
 
     uint8_t power = 0;
@@ -983,3 +1038,57 @@
 
     return LORA_OK;
 }
+
+bool ChannelPlan_AU915::DecodeBeacon(const uint8_t* payload, size_t size, BeaconData_t& data) {
+    uint16_t crc1, crc1_rx, crc2, crc2_rx;
+    const BCNPayload* beacon = (const BCNPayload*)payload;
+
+    // First check the size of the packet
+    if (size != sizeof(BCNPayload))
+        return false;
+
+    // Next we verify the CRCs are correct
+    crc1 = CRC16(beacon->RFU1, sizeof(beacon->RFU1) + sizeof(beacon->Time));
+    memcpy((uint8_t*)&crc1_rx, beacon->CRC1, sizeof(uint16_t));
+
+    if (crc1 != crc1_rx)
+        return false;
+
+    crc2 = CRC16(beacon->GwSpecific, sizeof(beacon->GwSpecific) + sizeof(beacon->RFU2));
+    memcpy((uint8_t*)&crc2_rx, beacon->CRC2, sizeof(uint16_t));
+
+    if (crc2 != crc2_rx)
+        return false;
+
+    // Now that we have confirmed this packet is a beacon, parse and complete the output struct
+    memcpy(&data.Time, beacon->Time, sizeof(beacon->Time));
+    data.InfoDesc = beacon->GwSpecific[0];
+
+    // Update the GPS fields if we have a gps info descriptor
+    if (data.InfoDesc == GPS_FIRST_ANTENNA ||
+        data.InfoDesc == GPS_SECOND_ANTENNA ||
+        data.InfoDesc == GPS_THIRD_ANTENNA) {
+        // Latitude and Longitude 3 bytes in length
+        memcpy(&data.Latitude, &beacon->GwSpecific[1], 3);
+        memcpy(&data.Longitude, &beacon->GwSpecific[4], 3);
+    }
+
+    return true;
+}
+
+void ChannelPlan_AU915::FrequencyHop(uint32_t time, uint32_t period, uint32_t devAddr) {
+    uint32_t channel;
+    uint32_t freq;
+
+    if (_bcnFreqHop) {
+        channel = (time / period) % AU915_BEACON_CHANNELS;
+        freq = AU915_BEACON_FREQ_BASE + (channel * AU915_BEACON_FREQ_STEP);
+        GetSettings()->Session.BeaconFrequency = freq;
+    }
+
+    if (_pingFreqHop) {
+        channel = (time / period + devAddr) % AU915_BEACON_CHANNELS;
+        freq = AU915_BEACON_FREQ_BASE + (channel * AU915_BEACON_FREQ_STEP);
+        GetSettings()->Session.PingSlotFrequency = freq;
+    }
+}
--- a/plans/ChannelPlan_AU915.h	Tue Aug 14 15:45:14 2018 -0500
+++ b/plans/ChannelPlan_AU915.h	Thu Aug 30 09:06:17 2018 -0500
@@ -23,6 +23,32 @@
 
 namespace lora {
 
+    const uint8_t AU915_125K_NUM_CHANS = 64;                    //!< Number of 125k channels in AU915 channel plan
+    const uint8_t AU915_500K_NUM_CHANS = 8;                     //!< Number of 500k channels in AU915 channel plan
+
+    const uint32_t AU915_125K_FREQ_BASE = 915200000;            //!< Frequency base for 125k AU915 uplink channels
+    const uint32_t AU915_125K_FREQ_STEP = 200000;               //!< Frequency step for 125k AU915 uplink channels
+
+    const uint32_t AU915_500K_FREQ_BASE = 915900000;            //!< Frequency base for 500k AU915 uplink channels
+    const uint32_t AU915_500K_FREQ_STEP = 1600000;              //!< Frequency step for 500k AU915 uplink channels
+
+    const uint32_t AU915_500K_DBASE = 923300000;                //!< Frequency base for 500k AU915 downlink channels
+    const uint32_t AU915_500K_DSTEP = 600000;                   //!< Frequency step for 500k AU915 downlink channels
+
+    const uint32_t AU915_FREQ_MIN = 915000000;
+    const uint32_t AU915_FREQ_MAX = 928000000;
+
+    const uint8_t AU915_MIN_DATARATE = (uint8_t) DR_0;          //!< Minimum transmit datarate for AU915
+    const uint8_t AU915_MAX_DATARATE = (uint8_t) DR_6;          //!< Maximum transmit datarate for AU915
+
+    const uint8_t AU915_MIN_DATARATE_OFFSET = (uint8_t) 0;      //!< Minimum transmit datarate for AU915
+    const uint8_t AU915_MAX_DATARATE_OFFSET = (uint8_t) 5;      //!< Maximum transmit datarate for AU915
+
+    const uint8_t  AU915_BEACON_DR = DR_8;                      //!< Default beacon datarate
+    const uint32_t AU915_BEACON_FREQ_BASE = 923300000U;         //!< Base beacon broadcast frequency
+    const uint32_t AU915_BEACON_FREQ_STEP = 600000U;            //!< Step size for beacon frequencies
+    const uint8_t  AU915_BEACON_CHANNELS = 8U;                  //!< Number of beacon channels
+
     class ChannelPlan_AU915 : public lora::ChannelPlan {
         public:
 
@@ -129,9 +155,10 @@
              * Set the SxRadio rx config provided window
              * @param window to be opened
              * @param continuous keep window open
+             * @param wnd_growth factor to increase the rx window by
              * @return LORA_OK
              */
-            virtual uint8_t SetRxConfig(uint8_t window, bool continuous);
+            virtual uint8_t SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth);
 
             /**
              * Set frequency sub band if supported by plan
@@ -248,6 +275,25 @@
 
             virtual uint8_t GetMaxDatarate();
 
+            /**
+             * Check if this packet is a beacon and if so extract parameters needed
+             * @param payload of potential beacon
+             * @param size of the packet
+             * @param [out] data extracted from the beacon if this packet was indeed a beacon
+             * @return true if this packet is beacon, false if not
+             */
+            virtual bool DecodeBeacon(const uint8_t* payload,
+                                      size_t size,
+                                      BeaconData_t& data);
+
+            /**
+             * Update class B beacon and ping slot settings if frequency hopping enabled
+             * @param time received in the last beacon
+             * @param period of the beacon
+             * @param devAddr of this end device
+             */
+            virtual void FrequencyHop(uint32_t time, uint32_t period, uint32_t devAddr);
+
         protected:
 
             static const uint8_t AU915_TX_POWERS[11];                   //!< List of available tx powers
@@ -255,6 +301,18 @@
             static const uint8_t AU915_MAX_PAYLOAD_SIZE[];              //!< List of max payload sizes for each datarate
             static const uint8_t AU915_MAX_PAYLOAD_SIZE_REPEATER[];     //!< List of repeater compatible max payload sizes for each datarate
 
+            typedef struct __attribute__((packed)) {
+                uint8_t RFU1[3];
+                uint8_t Time[4];
+                uint8_t CRC1[2];
+                uint8_t GwSpecific[7];
+                uint8_t RFU2[1];
+                uint8_t CRC2[2];
+            } BCNPayload;
+
+        private:
+            bool _bcnFreqHop;
+            bool _pingFreqHop;
     };
 }
 
--- a/plans/ChannelPlan_EU868.cpp	Tue Aug 14 15:45:14 2018 -0500
+++ b/plans/ChannelPlan_EU868.cpp	Thu Aug 30 09:06:17 2018 -0500
@@ -92,6 +92,11 @@
     GetSettings()->Session.Rx2Frequency = EU868_RX2_FREQ;
     GetSettings()->Session.Rx2DatarateIndex = DR_0;
 
+    GetSettings()->Session.BeaconFrequency = EU868_BEACON_FREQ;
+    GetSettings()->Session.BeaconDatarateIndex = EU868_BEACON_DR;
+    GetSettings()->Session.PingSlotFrequency = EU868_BEACON_FREQ;
+    GetSettings()->Session.PingSlotDatarateIndex = EU868_BEACON_DR;
+
     logInfo("Initialize datarates...");
 
     dr.SpreadingFactor = SF_12;
@@ -249,14 +254,6 @@
     return LORA_OK;
 }
 
-uint32_t ChannelPlan_EU868::GetTimeOnAir(uint8_t bytes) {
-    SetTxConfig();
-    if (GetSettings()->Session.TxDatarate == lora::DR_7) {
-        return GetRadio()->TimeOnAir(SxRadio::MODEM_FSK, bytes) / 1000u;
-    }
-    return GetRadio()->TimeOnAir(SxRadio::MODEM_LORA, bytes) / 1000u;
-}
-
 uint8_t ChannelPlan_EU868::SetTxConfig() {
 
     logInfo("Configure radio for TX");
@@ -310,7 +307,7 @@
     return LORA_OK;
 }
 
-uint8_t ChannelPlan_EU868::SetRxConfig(uint8_t window, bool continuous) {
+uint8_t ChannelPlan_EU868::SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth) {
 
     RxWindow rxw = GetRxWindow(window);
 
@@ -324,8 +321,10 @@
     uint32_t sf = rxDr.SpreadingFactor;
     uint8_t cr = rxDr.Coderate;
     uint8_t pl = rxDr.PreambleLength;
-    uint16_t sto = rxDr.SymbolTimeout();
+    uint16_t sto = rxDr.SymbolTimeout() * wnd_growth;
     uint32_t afc = 0;
+    bool fixLen = false;
+    uint8_t payloadLen = 0U;
     bool crc = false; // downlink does not use CRC according to LORAWAN
 
     if (GetSettings()->Network.DisableCRC == true)
@@ -338,6 +337,14 @@
         iq = txDr.TxIQ;
     }
 
+    // Beacon modifications - no I/Q inversion, fixed length rx, preamble
+    if (window == RX_BEACON) {
+        iq = txDr.TxIQ;
+        fixLen = true;
+        payloadLen = sizeof(BCNPayload);
+        pl = BEACON_PREAMBLE_LENGTH;
+    }
+
     SxRadio::RadioModems_t modem = SxRadio::MODEM_LORA;
 
     if (sf == SF_FSK) {
@@ -354,7 +361,7 @@
     // logTrace("Configure radio for RX%d on freq: %lu", window, rxw.Frequency);
     // logTrace("RX SF: %u BW: %u CR: %u PL: %u STO: %u CRC: %d IQ: %d", sf, bw, cr, pl, sto, crc, iq);
 
-    GetRadio()->SetRxConfig(modem, bw, sf, cr, afc, pl, sto, false, 0, crc, false, 0, iq, continuous);
+    GetRadio()->SetRxConfig(modem, bw, sf, cr, afc, pl, sto, fixLen, payloadLen, crc, false, 0, iq, continuous);
 
     return LORA_OK;
 }
@@ -400,7 +407,8 @@
         rxw.Frequency = GetSettings()->Network.TxFrequency;
         index = GetSettings()->Session.TxDatarate;
     } else {
-        if (window == 1) {
+        switch (window) {
+        case RX_1:
             rxw.Frequency = _channels[_txChannel].Frequency;
 
             if (GetSettings()->Session.TxDatarate > GetSettings()->Session.Rx1DatarateOffset) {
@@ -408,7 +416,21 @@
             } else {
                 index = 0;
             }
-        } else {
+
+            break;
+
+        case RX_BEACON:
+            rxw.Frequency = GetSettings()->Session.BeaconFrequency;
+            index = GetSettings()->Session.BeaconDatarateIndex;
+            break;
+
+        case RX_SLOT:
+            rxw.Frequency = GetSettings()->Session.PingSlotFrequency;
+            index = GetSettings()->Session.PingSlotDatarateIndex;
+            break;
+
+        // RX2, RXC, RX_TEST, etc..
+        default:
             rxw.Frequency = GetSettings()->Session.Rx2Frequency;
             index = GetSettings()->Session.Rx2DatarateIndex;
         }
@@ -507,57 +529,70 @@
 }
 
 uint8_t ChannelPlan_EU868::HandlePingSlotChannelReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) {
-
-    lora::CopyFreqtoInt(payload + index, _beaconRxChannel.Frequency);
-    index += 3;
-
-    if (_beaconRxChannel.Frequency != 0) {
-        _beaconRxChannel.DrRange.Value = payload[index];
-    } else {
-        // TODO: set to default beacon rx channel
-    }
+    uint8_t datarate = 0;
+    uint32_t freq = 0;
 
     status = 0x03;
-    return LORA_OK;
-}
 
-uint8_t ChannelPlan_EU868::HandleBeaconFrequencyReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) {
-
-    status = 0x03;
-    Channel chParam;
+    freq = payload[index++];
+    freq |= payload[index++] << 8;
+    freq |= payload[index++] << 16;
+    freq *= 100;
 
-    // Skip channel index
-    index++;
+    datarate = payload[index] & 0x0F;
 
-    lora::CopyFreqtoInt(payload + index, chParam.Frequency);
-    index += 3;
-    chParam.DrRange.Value = payload[index++];
-
-    if (!GetRadio()->CheckRfFrequency(chParam.Frequency)) {
+    if (freq == 0U) {
+        logInfo("Received request to reset ping slot frequency to default");
+        freq = EU868_BEACON_FREQ;
+    } else if (!CheckRfFrequency(freq)) {
+        logInfo("Freq KO");
         status &= 0xFE; // Channel frequency KO
     }
 
-    if (chParam.DrRange.Fields.Min < chParam.DrRange.Fields.Max) {
-        status &= 0xFD; // Datarate range KO
-    } else if (chParam.DrRange.Fields.Min < _minDatarate || chParam.DrRange.Fields.Min > _maxDatarate) {
-        status &= 0xFD; // Datarate range KO
-    } else if (chParam.DrRange.Fields.Max < _minDatarate || chParam.DrRange.Fields.Max > _maxDatarate) {
-        status &= 0xFD; // Datarate range KO
+    if (datarate < _minRx2Datarate || datarate > _maxRx2Datarate) {
+        logInfo("DR KO");
+        status &= 0xFD; // Datarate KO
     }
 
     if ((status & 0x03) == 0x03) {
-        _beaconChannel = chParam;
+        logInfo("PingSlotChannelReq accepted DR: %d Freq: %d", datarate, freq);
+        GetSettings()->Session.PingSlotFrequency = freq;
+        GetSettings()->Session.PingSlotDatarateIndex = datarate;
+    } else {
+        logInfo("PingSlotChannelReq rejected DR: %d Freq: %d", datarate, freq);
     }
 
-    if (_beaconChannel.Frequency == 0) {
-        // TODO: Set to default
-    }
-
-    status = 0x01;
-
     return LORA_OK;
 }
 
+uint8_t ChannelPlan_EU868::HandleBeaconFrequencyReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) 
+{
+    uint32_t freq = 0;
+
+    status = 0x01;
+
+    freq = payload[index++];
+    freq |= payload[index++] << 8;
+    freq |= payload[index] << 16;
+    freq *= 100;
+
+    if (freq == 0U) {
+        logInfo("Received request to reset beacon frequency to default");
+        freq = EU868_BEACON_FREQ;
+    } else if (!CheckRfFrequency(freq)) {
+        logInfo("Freq KO");
+        status &= 0xFE; // Channel frequency KO
+    }
+
+    if (status & 0x01) {
+        logInfo("BeaconFrequencyReq accepted Freq: %d", freq);
+        GetSettings()->Session.BeaconFrequency = freq;
+    } else {
+        logInfo("BeaconFrequencyReq rejected Freq: %d", freq);
+    }
+
+    return LORA_OK;
+}
 
 uint8_t ChannelPlan_EU868::HandleAdrCommand(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) {
 
@@ -1020,3 +1055,39 @@
     return LORA_OK;
 }
 
+bool ChannelPlan_EU868::DecodeBeacon(const uint8_t* payload, size_t size, BeaconData_t& data) {
+    uint16_t crc1, crc1_rx, crc2, crc2_rx;
+    const BCNPayload* beacon = (const BCNPayload*)payload;
+
+    // First check the size of the packet
+    if (size != sizeof(BCNPayload))
+        return false;
+
+    // Next we verify the CRCs are correct
+    crc1 = CRC16(beacon->RFU, sizeof(beacon->RFU) + sizeof(beacon->Time));
+    memcpy((uint8_t*)&crc1_rx, beacon->CRC1, sizeof(uint16_t));
+
+    if (crc1 != crc1_rx)
+        return false;
+
+    crc2 = CRC16(beacon->GwSpecific, sizeof(beacon->GwSpecific));
+    memcpy((uint8_t*)&crc2_rx, beacon->CRC2, sizeof(uint16_t));
+
+    if (crc2 != crc2_rx)
+        return false;
+
+    // Now that we have confirmed this packet is a beacon, parse and complete the output struct
+    memcpy(&data.Time, beacon->Time, sizeof(beacon->Time));
+    data.InfoDesc = beacon->GwSpecific[0];
+
+    // Update the GPS fields if we have a gps info descriptor
+    if (data.InfoDesc == GPS_FIRST_ANTENNA ||
+        data.InfoDesc == GPS_SECOND_ANTENNA ||
+        data.InfoDesc == GPS_THIRD_ANTENNA) {
+        // Latitude and Longitude 3 bytes in length
+        memcpy(&data.Latitude, &beacon->GwSpecific[1], 3);
+        memcpy(&data.Longitude, &beacon->GwSpecific[4], 3);
+    }
+
+    return true;
+}
--- a/plans/ChannelPlan_EU868.h	Tue Aug 14 15:45:14 2018 -0500
+++ b/plans/ChannelPlan_EU868.h	Thu Aug 30 09:06:17 2018 -0500
@@ -23,6 +23,47 @@
 
 namespace lora {
 
+    const uint8_t EU868_125K_NUM_CHANS = 16;                    //!< Number of 125k channels in EU868 channel plan
+    const uint8_t EU868_DEFAULT_NUM_CHANS = 3;                  //!< Number of defualt channels in EU868 channel plan
+    const uint32_t EU868_125K_FREQ_BASE = 868100000;            //!< Frequency base for 125k EU868 uplink channels
+    const uint32_t EU868_125K_FREQ_STEP = 200000;               //!< Frequency step for 125k EU868 uplink channels
+    const uint32_t EU868_RX2_FREQ = 869525000;                  //!< Frequency default for second rx window in EU868
+
+    const uint8_t EU868_TX_POWER_MAX = 14;                      //!< Max power for EU868 channel plan
+
+    // 0.1% duty cycle 863-868
+    // Limiting to 865-868 allows for 1% duty cycle
+    const uint32_t EU868_MILLI_FREQ_MIN = 865000000;
+    const uint32_t EU868_MILLI_FREQ_MAX = 868000000;
+
+    const uint32_t EU868_MILLI_1_FREQ_MIN = 868700000;
+    const uint32_t EU868_MILLI_1_FREQ_MAX = 869200000;
+
+    // 1% duty cycle
+    const uint32_t EU868_CENTI_FREQ_MIN = 868000000;
+    const uint32_t EU868_CENTI_FREQ_MAX = 868600000;
+
+    // 10% duty cycle
+    const uint32_t EU868_DECI_FREQ_MIN = 869400000;
+    const uint32_t EU868_DECI_FREQ_MAX = 869650000;
+
+    // Below 7dBm there is no duty cycle for these frequencies
+    // Up to 14dBm there is 1% duty cycle
+    const uint32_t EU868_VAR_FREQ_MIN = 869700000;
+    const uint32_t EU868_VAR_FREQ_MAX = 870000000;
+
+    const uint32_t EU868_FREQ_MIN = 863000000;
+    const uint32_t EU868_FREQ_MAX = 870000000;
+
+    const uint8_t EU868_MIN_DATARATE = (uint8_t) DR_0;           //!< Minimum transmit datarate for EU868
+    const uint8_t EU868_MAX_DATARATE = (uint8_t) DR_7;           //!< Maximum transmit datarate for EU868
+
+    const uint8_t EU868_MIN_DATARATE_OFFSET = (uint8_t) 0;       //!< Minimum transmit datarate for US915
+    const uint8_t EU868_MAX_DATARATE_OFFSET = (uint8_t) 5;       //!< Maximum transmit datarate for US915
+
+    const uint8_t  EU868_BEACON_DR = DR_3;                       //!< Default beacon datarate
+    const uint32_t EU868_BEACON_FREQ = 869525000U;               //!< Default beacon broadcast frequency
+
     class ChannelPlan_EU868 : public lora::ChannelPlan {
         public:
             /**
@@ -95,9 +136,10 @@
              * Set the SxRadio rx config provided window
              * @param window to be opened
              * @param continuous keep window open
+             * @param wnd_growth factor to increase the rx window by
              * @return LORA_OK
              */
-            virtual uint8_t SetRxConfig(uint8_t window, bool continuous);
+            virtual uint8_t SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth);
 
             /**
              * Set frequency sub band if supported by plan
@@ -107,12 +149,6 @@
             virtual uint8_t SetFrequencySubBand(uint8_t sub_band);
 
             /**
-             * Get time on air with current settings
-             * @param bytes number of bytes to be sent
-             */
-            virtual uint32_t GetTimeOnAir(uint8_t bytes);
-
-            /**
              * Callback for ACK timeout event
              * @return LORA_OK
              */
@@ -218,12 +254,31 @@
              */
             virtual void EnableDefaultChannels();
 
+            /**
+             * Check if this packet is a beacon and if so extract parameters needed
+             * @param payload of potential beacon
+             * @param size of the packet
+             * @param [out] data extracted from the beacon if this packet was indeed a beacon
+             * @return true if this packet is beacon, false if not
+             */
+            virtual bool DecodeBeacon(const uint8_t* payload,
+                                      size_t size,
+                                      BeaconData_t& data);
+
         protected:
 
             static const uint8_t EU868_TX_POWERS[8];                    //!< List of available tx powers
             static const uint8_t EU868_RADIO_POWERS[21];                 //!< List of calibrated tx powers
             static const uint8_t EU868_MAX_PAYLOAD_SIZE[];              //!< List of max payload sizes for each datarate
             static const uint8_t EU868_MAX_PAYLOAD_SIZE_REPEATER[];     //!< List of repeater compatible max payload sizes for each datarate
+
+            typedef struct __attribute__((packed)) {
+                uint8_t RFU[2];
+                uint8_t Time[4];
+                uint8_t CRC1[2];
+                uint8_t GwSpecific[7];
+                uint8_t CRC2[2];
+            } BCNPayload;
     };
 }
 
--- a/plans/ChannelPlan_IN865.cpp	Tue Aug 14 15:45:14 2018 -0500
+++ b/plans/ChannelPlan_IN865.cpp	Thu Aug 30 09:06:17 2018 -0500
@@ -91,6 +91,11 @@
     GetSettings()->Session.Rx2Frequency = 866550000;
     GetSettings()->Session.Rx2DatarateIndex = DR_2;
 
+    GetSettings()->Session.BeaconFrequency = IN865_BEACON_FREQ;
+    GetSettings()->Session.BeaconDatarateIndex = IN865_BEACON_DR;
+    GetSettings()->Session.PingSlotFrequency = IN865_BEACON_FREQ;
+    GetSettings()->Session.PingSlotDatarateIndex = IN865_BEACON_DR;
+
     logInfo("Initialize datarates...");
 
     dr.SpreadingFactor = SF_12;
@@ -274,7 +279,7 @@
 }
 
 
-uint8_t ChannelPlan_IN865::SetRxConfig(uint8_t window, bool continuous) {
+uint8_t ChannelPlan_IN865::SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth) {
 
     RxWindow rxw = GetRxWindow(window);
 
@@ -288,8 +293,10 @@
     uint32_t sf = rxDr.SpreadingFactor;
     uint8_t cr = rxDr.Coderate;
     uint8_t pl = rxDr.PreambleLength;
-    uint16_t sto = rxDr.SymbolTimeout();
+    uint16_t sto = rxDr.SymbolTimeout() * wnd_growth;
     uint32_t afc = 0;
+    bool fixLen = false;
+    uint8_t payloadLen = 0U;
     bool crc = false; // downlink does not use CRC according to LORAWAN
 
     if (GetSettings()->Network.DisableCRC == true)
@@ -302,6 +309,14 @@
         iq = txDr.TxIQ;
     }
 
+    // Beacon modifications - no I/Q inversion, fixed length rx, preamble
+    if (window == RX_BEACON) {
+        iq = txDr.TxIQ;
+        fixLen = true;
+        payloadLen = sizeof(BCNPayload);
+        pl = BEACON_PREAMBLE_LENGTH;
+    }
+
     SxRadio::RadioModems_t modem = SxRadio::MODEM_LORA;
 
     if (sf == SF_FSK) {
@@ -318,7 +333,7 @@
     // logTrace("Configure radio for RX%d on freq: %lu", window, rxw.Frequency);
     // logTrace("RX SF: %u BW: %u CR: %u PL: %u STO: %u CRC: %d IQ: %d", sf, bw, cr, pl, sto, crc, iq);
 
-    GetRadio()->SetRxConfig(modem, bw, sf, cr, afc, pl, sto, false, 0, crc, false, 0, iq, continuous);
+    GetRadio()->SetRxConfig(modem, bw, sf, cr, afc, pl, sto, fixLen, payloadLen, crc, false, 0, iq, continuous);
 
     return LORA_OK;
 }
@@ -364,7 +379,8 @@
         rxw.Frequency = GetSettings()->Network.TxFrequency;
         index = GetSettings()->Session.TxDatarate;
     } else {
-        if (window == 1) {
+        switch (window) {
+        case RX_1:
             // Use same frequency as TX
             rxw.Frequency = _channels[_txChannel].Frequency;
 
@@ -377,8 +393,20 @@
                 index = 0;
             }
 
-        } else {
-            // Use session RX2 frequency
+            break;
+
+        case RX_BEACON:
+            rxw.Frequency = GetSettings()->Session.BeaconFrequency;
+            index = GetSettings()->Session.BeaconDatarateIndex;
+            break;
+
+        case RX_SLOT:
+            rxw.Frequency = GetSettings()->Session.PingSlotFrequency;
+            index = GetSettings()->Session.PingSlotDatarateIndex;
+            break;
+
+        // RX2, RXC, RX_TEST, etc..
+        default:
             rxw.Frequency = GetSettings()->Session.Rx2Frequency;
             index = GetSettings()->Session.Rx2DatarateIndex;
         }
@@ -480,58 +508,70 @@
 }
 
 uint8_t ChannelPlan_IN865::HandlePingSlotChannelReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) {
+    uint8_t datarate = 0;
+    uint32_t freq = 0;
 
-    lora::CopyFreqtoInt(payload + index, _beaconRxChannel.Frequency);
-    index += 3;
+    status = 0x03;
 
-    if (_beaconRxChannel.Frequency != 0) {
-        _beaconRxChannel.DrRange.Value = payload[index];
-    } else {
-        // TODO: set to default beacon rx channel
+    freq = payload[index++];
+    freq |= payload[index++] << 8;
+    freq |= payload[index++] << 16;
+    freq *= 100;
+
+    datarate = payload[index] & 0x0F;
+
+    if (freq == 0U) {
+        logInfo("Received request to reset ping slot frequency to default");
+        freq = IN865_BEACON_FREQ;
+    } else if (!CheckRfFrequency(freq)) {
+        logInfo("Freq KO");
+        status &= 0xFE; // Channel frequency KO
     }
 
-    status = 0x03;
+    if (datarate < _minRx2Datarate || datarate > _maxRx2Datarate) {
+        logInfo("DR KO");
+        status &= 0xFD; // Datarate KO
+    }
+
+    if ((status & 0x03) == 0x03) {
+        logInfo("PingSlotChannelReq accepted DR: %d Freq: %d", datarate, freq);
+        GetSettings()->Session.PingSlotFrequency = freq;
+        GetSettings()->Session.PingSlotDatarateIndex = datarate;
+    } else {
+        logInfo("PingSlotChannelReq rejected DR: %d Freq: %d", datarate, freq);
+    }
+
     return LORA_OK;
 }
 
 uint8_t ChannelPlan_IN865::HandleBeaconFrequencyReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) {
+    uint32_t freq = 0;
 
-    status = 0x03;
-    Channel chParam;
+    status = 0x01;
 
-    // Skip channel index
-    index++;
+    freq = payload[index++];
+    freq |= payload[index++] << 8;
+    freq |= payload[index] << 16;
+    freq *= 100;
 
-    lora::CopyFreqtoInt(payload + index, chParam.Frequency);
-    index += 3;
-    chParam.DrRange.Value = payload[index++];
-
-    if (!GetRadio()->CheckRfFrequency(chParam.Frequency)) {
+    if (freq == 0U) {
+        logInfo("Received request to reset beacon frequency to default");
+        freq = IN865_BEACON_FREQ;
+    } else if (!CheckRfFrequency(freq)) {
+        logInfo("Freq KO");
         status &= 0xFE; // Channel frequency KO
     }
 
-    if (chParam.DrRange.Fields.Min < chParam.DrRange.Fields.Max) {
-        status &= 0xFD; // Datarate range KO
-    } else if (chParam.DrRange.Fields.Min < _minDatarate || chParam.DrRange.Fields.Min > _maxDatarate) {
-        status &= 0xFD; // Datarate range KO
-    } else if (chParam.DrRange.Fields.Max < _minDatarate || chParam.DrRange.Fields.Max > _maxDatarate) {
-        status &= 0xFD; // Datarate range KO
+    if (status & 0x01) {
+        logInfo("BeaconFrequencyReq accepted Freq: %d", freq);
+        GetSettings()->Session.BeaconFrequency = freq;
+    } else {
+        logInfo("BeaconFrequencyReq rejected Freq: %d", freq);
     }
 
-    if ((status & 0x03) == 0x03) {
-        _beaconChannel = chParam;
-    }
-
-    if (_beaconChannel.Frequency == 0) {
-        // TODO: Set to default
-    }
-
-    status = 0x01;
-
     return LORA_OK;
 }
 
-
 uint8_t ChannelPlan_IN865::HandleAdrCommand(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) {
 
     uint8_t power = 0;
@@ -1016,3 +1056,39 @@
     GetSettings()->Session.TxDatarate = dr;
 }
 
+bool ChannelPlan_IN865::DecodeBeacon(const uint8_t* payload, size_t size, BeaconData_t& data) {
+    uint16_t crc1, crc1_rx, crc2, crc2_rx;
+    const BCNPayload* beacon = (const BCNPayload*)payload;
+
+    // First check the size of the packet
+    if (size != sizeof(BCNPayload))
+        return false;
+
+    // Next we verify the CRCs are correct
+    crc1 = CRC16(beacon->RFU1, sizeof(beacon->RFU1) + sizeof(beacon->Time));
+    memcpy((uint8_t*)&crc1_rx, beacon->CRC1, sizeof(uint16_t));
+
+    if (crc1 != crc1_rx)
+        return false;
+
+    crc2 = CRC16(beacon->GwSpecific, sizeof(beacon->GwSpecific) + sizeof(beacon->RFU2));
+    memcpy((uint8_t*)&crc2_rx, beacon->CRC2, sizeof(uint16_t));
+
+    if (crc2 != crc2_rx)
+        return false;
+
+    // Now that we have confirmed this packet is a beacon, parse and complete the output struct
+    memcpy(&data.Time, beacon->Time, sizeof(beacon->Time));
+    data.InfoDesc = beacon->GwSpecific[0];
+
+    // Update the GPS fields if we have a gps info descriptor
+    if (data.InfoDesc == GPS_FIRST_ANTENNA ||
+        data.InfoDesc == GPS_SECOND_ANTENNA ||
+        data.InfoDesc == GPS_THIRD_ANTENNA) {
+        // Latitude and Longitude 3 bytes in length
+        memcpy(&data.Latitude, &beacon->GwSpecific[1], 3);
+        memcpy(&data.Longitude, &beacon->GwSpecific[4], 3);
+    }
+
+    return true;
+}
--- a/plans/ChannelPlan_IN865.h	Tue Aug 14 15:45:14 2018 -0500
+++ b/plans/ChannelPlan_IN865.h	Thu Aug 30 09:06:17 2018 -0500
@@ -23,6 +23,16 @@
 
 namespace lora {
 
+    const uint8_t  IN865_125K_NUM_CHANS = 16;         //!< Number of 125k channels in IN865 channel plan
+    const uint8_t  IN865_DEFAULT_NUM_CHANS = 3;       //!< Number of default channels in IN865 channel plan
+    const uint32_t IN865_125K_DEF_FREQ_1 = 865062500;
+    const uint32_t IN865_125K_DEF_FREQ_2 = 865402500;
+    const uint32_t IN865_125K_DEF_FREQ_3 = 865985000;
+    const uint32_t IN865_RX2_FREQ = 866550000;        //!< Frequency default for second rx window in IN865
+    const uint8_t  IN865_TX_POWER_MAX = 30;           //!< Max power for IN865 channel plan
+    const uint8_t  IN865_BEACON_DR = DR_4;            //!< Default beacon datarate
+    const uint32_t IN865_BEACON_FREQ = 866550000U;    //!< Default beacon broadcast frequency
+
     class ChannelPlan_IN865 : public lora::ChannelPlan {
         public:
             /**
@@ -95,9 +105,10 @@
              * Set the SxRadio rx config provided window
              * @param window to be opened
              * @param continuous keep window open
+             * @param wnd_growth factor to increase the rx window by
              * @return LORA_OK
              */
-            virtual uint8_t SetRxConfig(uint8_t window, bool continuous);
+            virtual uint8_t SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth);
 
             /**
              * Set frequency sub band if supported by plan
@@ -229,12 +240,32 @@
              */
             virtual void IncrementDatarate();
 
+            /**
+             * Check if this packet is a beacon and if so extract parameters needed
+             * @param payload of potential beacon
+             * @param size of the packet
+             * @param [out] data extracted from the beacon if this packet was indeed a beacon
+             * @return true if this packet is beacon, false if not
+             */
+            virtual bool DecodeBeacon(const uint8_t* payload,
+                                      size_t size,
+                                      BeaconData_t& data);
+
         protected:
 
             static const uint8_t IN865_TX_POWERS[11];                    //!< List of available tx powers
             static const uint8_t IN865_RADIO_POWERS[21];                 //!< List of calibrated tx powers
             static const uint8_t IN865_MAX_PAYLOAD_SIZE[];              //!< List of max payload sizes for each datarate
             static const uint8_t IN865_MAX_PAYLOAD_SIZE_REPEATER[];     //!< List of repeater compatible max payload sizes for each datarate
+
+            typedef struct __attribute__((packed)) {
+                uint8_t RFU1[1];
+                uint8_t Time[4];
+                uint8_t CRC1[2];
+                uint8_t GwSpecific[7];
+                uint8_t RFU2[3];
+                uint8_t CRC2[2];
+            } BCNPayload;
     };
 }
 
--- a/plans/ChannelPlan_KR920.cpp	Tue Aug 14 15:45:14 2018 -0500
+++ b/plans/ChannelPlan_KR920.cpp	Thu Aug 30 09:06:17 2018 -0500
@@ -94,6 +94,11 @@
     GetSettings()->Session.Rx2Frequency = 921900000;
     GetSettings()->Session.Rx2DatarateIndex = DR_0;
 
+    GetSettings()->Session.BeaconFrequency = KR920_BEACON_FREQ;
+    GetSettings()->Session.BeaconDatarateIndex = KR920_BEACON_DR;
+    GetSettings()->Session.PingSlotFrequency = KR920_BEACON_FREQ;
+    GetSettings()->Session.PingSlotDatarateIndex = KR920_BEACON_DR;
+
     logInfo("Initialize datarates...");
 
     dr.SpreadingFactor = SF_12;
@@ -264,7 +269,7 @@
 }
 
 
-uint8_t ChannelPlan_KR920::SetRxConfig(uint8_t window, bool continuous) {
+uint8_t ChannelPlan_KR920::SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth) {
 
     RxWindow rxw = GetRxWindow(window);
 
@@ -278,8 +283,10 @@
     uint32_t sf = rxDr.SpreadingFactor;
     uint8_t cr = rxDr.Coderate;
     uint8_t pl = rxDr.PreambleLength;
-    uint16_t sto = rxDr.SymbolTimeout();
+    uint16_t sto = rxDr.SymbolTimeout() * wnd_growth;
     uint32_t afc = 0;
+    bool fixLen = false;
+    uint8_t payloadLen = 0U;
     bool crc = false; // downlink does not use CRC according to LORAWAN
 
     if (GetSettings()->Network.DisableCRC == true)
@@ -292,6 +299,14 @@
         iq = txDr.TxIQ;
     }
 
+    // Beacon modifications - no I/Q inversion, fixed length rx, preamble
+    if (window == RX_BEACON) {
+        iq = txDr.TxIQ;
+        fixLen = true;
+        payloadLen = sizeof(BCNPayload);
+        pl = BEACON_PREAMBLE_LENGTH;
+    }
+
     SxRadio::RadioModems_t modem = SxRadio::MODEM_LORA;
 
     if (sf == SF_FSK) {
@@ -308,7 +323,7 @@
     // logTrace("Configure radio for RX%d on freq: %lu", window, rxw.Frequency);
     // logTrace("RX SF: %u BW: %u CR: %u PL: %u STO: %u CRC: %d IQ: %d", sf, bw, cr, pl, sto, crc, iq);
 
-    GetRadio()->SetRxConfig(modem, bw, sf, cr, afc, pl, sto, false, 0, crc, false, 0, iq, continuous);
+    GetRadio()->SetRxConfig(modem, bw, sf, cr, afc, pl, sto, fixLen, payloadLen, crc, false, 0, iq, continuous);
 
     return LORA_OK;
 }
@@ -354,7 +369,8 @@
         rxw.Frequency = GetSettings()->Network.TxFrequency;
         index = GetSettings()->Session.TxDatarate;
     } else {
-        if (window == 1) {
+        switch (window) {
+        case RX_1:
             // Use same frequency as TX
             rxw.Frequency = _channels[_txChannel].Frequency;
 
@@ -364,8 +380,20 @@
                 index = 0;
             }
 
-        } else {
-            // Use session RX2 frequency
+            break;
+
+        case RX_BEACON:
+            rxw.Frequency = GetSettings()->Session.BeaconFrequency;
+            index = GetSettings()->Session.BeaconDatarateIndex;
+            break;
+
+        case RX_SLOT:
+            rxw.Frequency = GetSettings()->Session.PingSlotFrequency;
+            index = GetSettings()->Session.PingSlotDatarateIndex;
+            break;
+
+        // RX2, RXC, RX_TEST, etc..
+        default:
             rxw.Frequency = GetSettings()->Session.Rx2Frequency;
             index = GetSettings()->Session.Rx2DatarateIndex;
         }
@@ -464,54 +492,67 @@
 }
 
 uint8_t ChannelPlan_KR920::HandlePingSlotChannelReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) {
+    uint8_t datarate = 0;
+    uint32_t freq = 0;
 
-    lora::CopyFreqtoInt(payload + index, _beaconRxChannel.Frequency);
-    index += 3;
+    status = 0x03;
 
-    if (_beaconRxChannel.Frequency != 0) {
-        _beaconRxChannel.DrRange.Value = payload[index];
-    } else {
-        // TODO: set to default beacon rx channel
+    freq = payload[index++];
+    freq |= payload[index++] << 8;
+    freq |= payload[index++] << 16;
+    freq *= 100;
+
+    datarate = payload[index] & 0x0F;
+
+    if (freq == 0U) {
+        logInfo("Received request to reset ping slot frequency to default");
+        freq = KR920_BEACON_FREQ;
+    } else if (!CheckRfFrequency(freq)) {
+        logInfo("Freq KO");
+        status &= 0xFE; // Channel frequency KO
     }
 
-    status = 0x03;
+    if (datarate < _minRx2Datarate || datarate > _maxRx2Datarate) {
+        logInfo("DR KO");
+        status &= 0xFD; // Datarate KO
+    }
+
+    if ((status & 0x03) == 0x03) {
+        logInfo("PingSlotChannelReq accepted DR: %d Freq: %d", datarate, freq);
+        GetSettings()->Session.PingSlotFrequency = freq;
+        GetSettings()->Session.PingSlotDatarateIndex = datarate;
+    } else {
+        logInfo("PingSlotChannelReq rejected DR: %d Freq: %d", datarate, freq);
+    }
+
     return LORA_OK;
 }
 
 uint8_t ChannelPlan_KR920::HandleBeaconFrequencyReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) {
+    uint32_t freq = 0;
 
-    status = 0x03;
-    Channel chParam;
+    status = 0x01;
 
-    // Skip channel index
-    index++;
+    freq = payload[index++];
+    freq |= payload[index++] << 8;
+    freq |= payload[index] << 16;
+    freq *= 100;
 
-    lora::CopyFreqtoInt(payload + index, chParam.Frequency);
-    index += 3;
-    chParam.DrRange.Value = payload[index++];
-
-    if (!GetRadio()->CheckRfFrequency(chParam.Frequency)) {
+    if (freq == 0U) {
+        logInfo("Received request to reset beacon frequency to default");
+        freq = KR920_BEACON_FREQ;
+    } else if (!CheckRfFrequency(freq)) {
+        logInfo("Freq KO");
         status &= 0xFE; // Channel frequency KO
     }
 
-    if (chParam.DrRange.Fields.Min < chParam.DrRange.Fields.Max) {
-        status &= 0xFD; // Datarate range KO
-    } else if (chParam.DrRange.Fields.Min < _minDatarate || chParam.DrRange.Fields.Min > _maxDatarate) {
-        status &= 0xFD; // Datarate range KO
-    } else if (chParam.DrRange.Fields.Max < _minDatarate || chParam.DrRange.Fields.Max > _maxDatarate) {
-        status &= 0xFD; // Datarate range KO
+    if (status & 0x01) {
+        logInfo("BeaconFrequencyReq accepted Freq: %d", freq);
+        GetSettings()->Session.BeaconFrequency = freq;
+    } else {
+        logInfo("BeaconFrequencyReq rejected Freq: %d", freq);
     }
 
-    if ((status & 0x03) == 0x03) {
-        _beaconChannel = chParam;
-    }
-
-    if (_beaconChannel.Frequency == 0) {
-        // TODO: Set to default
-    }
-
-    status = 0x01;
-
     return LORA_OK;
 }
 
@@ -982,3 +1023,39 @@
     _LBT_Threshold = -65;
 }
 
+bool ChannelPlan_KR920::DecodeBeacon(const uint8_t* payload, size_t size, BeaconData_t& data) {
+    uint16_t crc1, crc1_rx, crc2, crc2_rx;
+    const BCNPayload* beacon = (const BCNPayload*)payload;
+
+    // First check the size of the packet
+    if (size != sizeof(BCNPayload))
+        return false;
+
+    // Next we verify the CRCs are correct
+    crc1 = CRC16(beacon->RFU, sizeof(beacon->RFU) + sizeof(beacon->Time));
+    memcpy((uint8_t*)&crc1_rx, beacon->CRC1, sizeof(uint16_t));
+
+    if (crc1 != crc1_rx)
+        return false;
+
+    crc2 = CRC16(beacon->GwSpecific, sizeof(beacon->GwSpecific));
+    memcpy((uint8_t*)&crc2_rx, beacon->CRC2, sizeof(uint16_t));
+
+    if (crc2 != crc2_rx)
+        return false;
+
+    // Now that we have confirmed this packet is a beacon, parse and complete the output struct
+    memcpy(&data.Time, beacon->Time, sizeof(beacon->Time));
+    data.InfoDesc = beacon->GwSpecific[0];
+
+    // Update the GPS fields if we have a gps info descriptor
+    if (data.InfoDesc == GPS_FIRST_ANTENNA ||
+        data.InfoDesc == GPS_SECOND_ANTENNA ||
+        data.InfoDesc == GPS_THIRD_ANTENNA) {
+        // Latitude and Longitude 3 bytes in length
+        memcpy(&data.Latitude, &beacon->GwSpecific[1], 3);
+        memcpy(&data.Longitude, &beacon->GwSpecific[4], 3);
+    }
+
+    return true;
+}
--- a/plans/ChannelPlan_KR920.h	Tue Aug 14 15:45:14 2018 -0500
+++ b/plans/ChannelPlan_KR920.h	Thu Aug 30 09:06:17 2018 -0500
@@ -23,6 +23,15 @@
 
 namespace lora {
 
+    const uint8_t  KR920_125K_NUM_CHANS = 16;        //!< Number of 125k channels in KR920 channel plan
+    const uint8_t  KR920_DEFAULT_NUM_CHANS = 3;      //!< Number of default channels in KR920 channel plan
+    const uint32_t KR920_125K_FREQ_BASE = 922100000; //!< Frequency base for 125k KR920 uplink channels
+    const uint32_t KR920_125K_FREQ_STEP = 200000;    //!< Frequency step for 125k KR920 uplink channels
+    const uint32_t KR920_RX2_FREQ = 921900000;       //!< Frequency default for second rx window in KR920
+    const uint8_t  KR920_TX_POWER_MAX = 14;          //!< Max power for KR920 channel plan
+    const uint8_t  KR920_BEACON_DR = DR_3;           //!< Default beacon datarate
+    const uint32_t KR920_BEACON_FREQ = 923100000U;   //!< Default beacon broadcast frequency
+
     class ChannelPlan_KR920 : public lora::ChannelPlan {
         public:
             /**
@@ -95,9 +104,10 @@
              * Set the SxRadio rx config provided window
              * @param window to be opened
              * @param continuous keep window open
+             * @param wnd_growth factor to increase the rx window by
              * @return LORA_OK
              */
-            virtual uint8_t SetRxConfig(uint8_t window, bool continuous);
+            virtual uint8_t SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth);
 
             /**
              * Set frequency sub band if supported by plan
@@ -224,12 +234,31 @@
              */
             virtual void DefaultLBT();
 
+            /**
+             * Check if this packet is a beacon and if so extract parameters needed
+             * @param payload of potential beacon
+             * @param size of the packet
+             * @param [out] data extracted from the beacon if this packet was indeed a beacon
+             * @return true if this packet is beacon, false if not
+             */
+            virtual bool DecodeBeacon(const uint8_t* payload,
+                                      size_t size,
+                                      BeaconData_t& data);
+
         protected:
 
             static const uint8_t KR920_TX_POWERS[8];                    //!< List of available tx powers
             static const uint8_t KR920_RADIO_POWERS[21];                 //!< List of calibrated tx powers
             static const uint8_t KR920_MAX_PAYLOAD_SIZE[];              //!< List of max payload sizes for each datarate
             static const uint8_t KR920_MAX_PAYLOAD_SIZE_REPEATER[];     //!< List of repeater compatible max payload sizes for each datarate
+
+            typedef struct __attribute__((packed)) {
+                uint8_t RFU[2];
+                uint8_t Time[4];
+                uint8_t CRC1[2];
+                uint8_t GwSpecific[7];
+                uint8_t CRC2[2];
+            } BCNPayload;
     };
 }
 
--- a/plans/ChannelPlan_US915.cpp	Tue Aug 14 15:45:14 2018 -0500
+++ b/plans/ChannelPlan_US915.cpp	Thu Aug 30 09:06:17 2018 -0500
@@ -28,6 +28,8 @@
 ChannelPlan_US915::ChannelPlan_US915()
 :
   ChannelPlan(NULL, NULL)
+  , _bcnFreqHop(true)
+  , _pingFreqHop(true)
 {
 
 }
@@ -35,6 +37,8 @@
 ChannelPlan_US915::ChannelPlan_US915(Settings* settings)
 :
   ChannelPlan(NULL, settings)
+  , _bcnFreqHop(true)
+  , _pingFreqHop(true)
 {
 
 }
@@ -42,6 +46,8 @@
 ChannelPlan_US915::ChannelPlan_US915(SxRadio* radio, Settings* settings)
 :
   ChannelPlan(radio, settings)
+  , _bcnFreqHop(true)
+  , _pingFreqHop(true)
 {
 
 }
@@ -87,6 +93,11 @@
     _freqDStep500k = US915_500K_DSTEP;
     GetSettings()->Session.Rx2Frequency = US915_500K_DBASE;
 
+    GetSettings()->Session.BeaconFrequency = US915_BEACON_FREQ_BASE;
+    GetSettings()->Session.BeaconDatarateIndex = US915_BEACON_DR;
+    GetSettings()->Session.PingSlotFrequency = US915_BEACON_FREQ_BASE;
+    GetSettings()->Session.PingSlotDatarateIndex = US915_BEACON_DR;
+
     _minDatarate = US915_MIN_DATARATE;
     _maxDatarate = US915_MAX_DATARATE;
     _minRx2Datarate = DR_8;
@@ -280,7 +291,7 @@
     return LORA_OK;
 }
 
-uint8_t ChannelPlan_US915::SetRxConfig(uint8_t window, bool continuous) {
+uint8_t ChannelPlan_US915::SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth) {
 
     RxWindow rxw = GetRxWindow(window);
     GetRadio()->SetChannel(rxw.Frequency);
@@ -290,8 +301,10 @@
     uint32_t sf = rxDr.SpreadingFactor;
     uint8_t cr = rxDr.Coderate;
     uint8_t pl = rxDr.PreambleLength;
-    uint16_t sto = rxDr.SymbolTimeout();
+    uint16_t sto = rxDr.SymbolTimeout() * wnd_growth;
     uint32_t afc = 0;
+    bool fixLen = false;
+    uint8_t payloadLen = 0U;
     bool crc = false; // downlink does not use CRC according to LORAWAN
 
     if (GetSettings()->Network.DisableCRC == true)
@@ -304,6 +317,14 @@
         iq = txDr.TxIQ;
     }
 
+    // Beacon modifications - no I/Q inversion, fixed length rx, preamble
+    if (window == RX_BEACON) {
+        iq = txDr.TxIQ;
+        fixLen = true;
+        payloadLen = sizeof(BCNPayload);
+        pl = BEACON_PREAMBLE_LENGTH;
+    }
+
     SxRadio::RadioModems_t modem = SxRadio::MODEM_LORA;
 
     if (sf == SF_FSK) {
@@ -320,7 +341,7 @@
     // logTrace("Configure radio for RX%d on freq: %lu", window, rxw.Frequency);
     // logTrace("RX SF: %u BW: %u CR: %u PL: %u STO: %u CRC: %d IQ: %d", sf, bw, cr, pl, sto, crc, iq);
 
-    GetRadio()->SetRxConfig(modem, bw, sf, cr, afc, pl, sto, false, 0, crc, false, 0, iq, continuous);
+    GetRadio()->SetRxConfig(modem, bw, sf, cr, afc, pl, sto, fixLen, payloadLen, crc, false, 0, iq, continuous);
 
     return LORA_OK;
 }
@@ -410,7 +431,8 @@
         rxw.Frequency = GetSettings()->Network.TxFrequency;
         index = GetSettings()->Session.TxDatarate;
     } else {
-        if (window == 1) {
+        switch (window) {
+        case RX_1:
             if (_txChannel < _numChans125k) {
                 if (GetSettings()->Network.Mode == lora::PRIVATE_MTS)
                     rxw.Frequency = _freqDBase500k + (_txChannel / 8) * _freqDStep500k;
@@ -431,15 +453,31 @@
                 if (index < DR_8)
                     index = DR_8;
             }
-        } else {
-            if (GetSettings()->Network.Mode == lora::PRIVATE_MTS)
+
+            break;
+
+        case RX_BEACON:
+            rxw.Frequency = GetSettings()->Session.BeaconFrequency;
+            index = GetSettings()->Session.BeaconDatarateIndex;
+            break;
+
+        case RX_SLOT:
+            rxw.Frequency = GetSettings()->Session.PingSlotFrequency;
+            index = GetSettings()->Session.PingSlotDatarateIndex;
+            break;
+
+        // RX2, RXC, RX_TEST, etc..
+        default:
+            if (GetSettings()->Network.Mode == lora::PRIVATE_MTS) {
                 if (_txChannel < _numChans125k) {
                     rxw.Frequency = _freqDBase500k + (_txChannel / 8) * _freqDStep500k;
                 } else {
                     rxw.Frequency = _freqDBase500k + (_txChannel % 8) * _freqDStep500k;
                 }
-            else
+            } else {
                 rxw.Frequency = GetSettings()->Session.Rx2Frequency;
+            }
+
             index = GetSettings()->Session.Rx2DatarateIndex;
         }
     }
@@ -506,54 +544,73 @@
 }
 
 uint8_t ChannelPlan_US915::HandlePingSlotChannelReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) {
+    uint8_t datarate = 0;
+    uint32_t freq = 0;
+    bool freqHop = false;
 
-    lora::CopyFreqtoInt(payload + index, _beaconRxChannel.Frequency);
-    index += 3;
+    status = 0x03;
 
-    if (_beaconRxChannel.Frequency != 0) {
-        _beaconRxChannel.DrRange.Value = payload[index];
-    } else {
-        // TODO: set to default beacon rx channel
+    freq = payload[index++];
+    freq |= payload[index++] << 8;
+    freq |= payload[index++] << 16;
+    freq *= 100;
+
+    datarate = payload[index] & 0x0F;
+
+    if (freq == 0U) {
+        logInfo("Received request to reset ping slot frequency to default");
+        freq = US915_BEACON_FREQ_BASE;
+        freqHop = true;
+    } else if (!CheckRfFrequency(freq)) {
+        logInfo("Freq KO");
+        status &= 0xFE; // Channel frequency KO
     }
 
-    status = 0x03;
+    if (datarate < _minRx2Datarate || datarate > _maxRx2Datarate) {
+        logInfo("DR KO");
+        status &= 0xFD; // Datarate KO
+    }
+
+    if ((status & 0x03) == 0x03) {
+        logInfo("PingSlotChannelReq accepted DR: %d Freq: %d", datarate, freq);
+        GetSettings()->Session.PingSlotFrequency = freq;
+        GetSettings()->Session.PingSlotDatarateIndex = datarate;
+        _pingFreqHop = freqHop;
+    } else {
+        logInfo("PingSlotChannelReq rejected DR: %d Freq: %d", datarate, freq);
+    }
+
     return LORA_OK;
 }
 
 uint8_t ChannelPlan_US915::HandleBeaconFrequencyReq(const uint8_t* payload, uint8_t index, uint8_t size, uint8_t& status) {
+    uint32_t freq = 0;
+    bool freqHop = false;
 
-    status = 0x03;
-    Channel chParam;
+    status = 0x01;
 
-    // Skip channel index
-    index++;
+    freq = payload[index++];
+    freq |= payload[index++] << 8;
+    freq |= payload[index] << 16;
+    freq *= 100;
 
-    lora::CopyFreqtoInt(payload + index, chParam.Frequency);
-    index += 3;
-    chParam.DrRange.Value = payload[index++];
-
-    if (!GetRadio()->CheckRfFrequency(chParam.Frequency)) {
+    if (freq == 0U) {
+        logInfo("Received request to reset beacon frequency to default");
+        freq = US915_BEACON_FREQ_BASE;
+        freqHop = true;
+    } else if (!CheckRfFrequency(freq)) {
+        logInfo("Freq KO");
         status &= 0xFE; // Channel frequency KO
     }
 
-    if (chParam.DrRange.Fields.Min < chParam.DrRange.Fields.Max) {
-        status &= 0xFD; // Datarate range KO
-    } else if (chParam.DrRange.Fields.Min < _minDatarate || chParam.DrRange.Fields.Min > _maxDatarate) {
-        status &= 0xFD; // Datarate range KO
-    } else if (chParam.DrRange.Fields.Max < _minDatarate || chParam.DrRange.Fields.Max > _maxDatarate) {
-        status &= 0xFD; // Datarate range KO
+    if (status & 0x01) {
+        logInfo("BeaconFrequencyReq accepted Freq: %d", freq);
+        GetSettings()->Session.BeaconFrequency = freq;
+        _bcnFreqHop = freqHop;
+    } else {
+        logInfo("BeaconFrequencyReq rejected Freq: %d", freq);
     }
 
-    if ((status & 0x03) == 0x03) {
-        _beaconChannel = chParam;
-    }
-
-    if (_beaconChannel.Frequency == 0) {
-        // TODO: Set to default
-    }
-
-    status = 0x01;
-
     return LORA_OK;
 }
 
@@ -991,3 +1048,57 @@
 
     return LORA_OK;
 }
+
+bool ChannelPlan_US915::DecodeBeacon(const uint8_t* payload, size_t size, BeaconData_t& data) {
+    uint16_t crc1, crc1_rx, crc2, crc2_rx;
+    const BCNPayload* beacon = (const BCNPayload*)payload;
+
+    // First check the size of the packet
+    if (size != sizeof(BCNPayload))
+        return false;
+
+    // Next we verify the CRCs are correct
+    crc1 = CRC16(beacon->RFU1, sizeof(beacon->RFU1) + sizeof(beacon->Time));
+    memcpy((uint8_t*)&crc1_rx, beacon->CRC1, sizeof(uint16_t));
+
+    if (crc1 != crc1_rx)
+        return false;
+
+    crc2 = CRC16(beacon->GwSpecific, sizeof(beacon->GwSpecific) + sizeof(beacon->RFU2));
+    memcpy((uint8_t*)&crc2_rx, beacon->CRC2, sizeof(uint16_t));
+
+    if (crc2 != crc2_rx)
+        return false;
+
+    // Now that we have confirmed this packet is a beacon, parse and complete the output struct
+    memcpy(&data.Time, beacon->Time, sizeof(beacon->Time));
+    data.InfoDesc = beacon->GwSpecific[0];
+
+    // Update the GPS fields if we have a gps info descriptor
+    if (data.InfoDesc == GPS_FIRST_ANTENNA ||
+        data.InfoDesc == GPS_SECOND_ANTENNA ||
+        data.InfoDesc == GPS_THIRD_ANTENNA) {
+        // Latitude and Longitude 3 bytes in length
+        memcpy(&data.Latitude, &beacon->GwSpecific[1], 3);
+        memcpy(&data.Longitude, &beacon->GwSpecific[4], 3);
+    }
+
+    return true;
+}
+
+void ChannelPlan_US915::FrequencyHop(uint32_t time, uint32_t period, uint32_t devAddr) {
+    uint32_t channel;
+    uint32_t freq;
+
+    if (_bcnFreqHop) {
+        channel = (time / period) % US915_BEACON_CHANNELS;
+        freq = US915_BEACON_FREQ_BASE + (channel * US915_BEACON_FREQ_STEP);
+        GetSettings()->Session.BeaconFrequency = freq;
+    }
+
+    if (_pingFreqHop) {
+        channel = (time / period + devAddr) % US915_BEACON_CHANNELS;
+        freq = US915_BEACON_FREQ_BASE + (channel * US915_BEACON_FREQ_STEP);
+        GetSettings()->Session.PingSlotFrequency = freq;
+    }
+}
--- a/plans/ChannelPlan_US915.h	Tue Aug 14 15:45:14 2018 -0500
+++ b/plans/ChannelPlan_US915.h	Thu Aug 30 09:06:17 2018 -0500
@@ -23,6 +23,32 @@
 
 namespace lora {
 
+    const uint8_t US915_125K_NUM_CHANS = 64;                    //!< Number of 125k channels in US915 channel plan
+    const uint8_t US915_500K_NUM_CHANS = 8;                     //!< Number of 500k channels in US915 channel plan
+
+    const uint32_t US915_125K_FREQ_BASE = 902300000;            //!< Frequency base for 125k US915 uplink channels
+    const uint32_t US915_125K_FREQ_STEP = 200000;               //!< Frequency step for 125k US915 uplink channels
+
+    const uint32_t US915_500K_FREQ_BASE = 903000000;            //!< Frequency base for 500k US915 uplink channels
+    const uint32_t US915_500K_FREQ_STEP = 1600000;              //!< Frequency step for 500k US915 uplink channels
+
+    const uint32_t US915_500K_DBASE = 923300000;                //!< Frequency base for 500k US915 downlink channels
+    const uint32_t US915_500K_DSTEP = 600000;                   //!< Frequency step for 500k US915 downlink channels
+
+    const uint32_t US915_FREQ_MIN = 902000000;
+    const uint32_t US915_FREQ_MAX = 928000000;
+
+    const uint8_t US915_MIN_DATARATE = (uint8_t) DR_0;          //!< Minimum transmit datarate for US915
+    const uint8_t US915_MAX_DATARATE = (uint8_t) DR_4;          //!< Maximum transmit datarate for US915
+
+    const uint8_t US915_MIN_DATARATE_OFFSET = (uint8_t) 0;      //!< Minimum transmit datarate for US915
+    const uint8_t US915_MAX_DATARATE_OFFSET = (uint8_t) 3;      //!< Maximum transmit datarate for US915
+
+    const uint8_t  US915_BEACON_DR = DR_8;                      //!< Default beacon datarate
+    const uint32_t US915_BEACON_FREQ_BASE = 923300000U;         //!< Base beacon broadcast frequency
+    const uint32_t US915_BEACON_FREQ_STEP = 600000U;            //!< Step size for beacon frequencies
+    const uint8_t  US915_BEACON_CHANNELS = 8U;                  //!< Number of beacon channels
+
     class ChannelPlan_US915 : public lora::ChannelPlan {
         public:
 
@@ -129,9 +155,10 @@
              * Set the SxRadio rx config provided window
              * @param window to be opened
              * @param continuous keep window open
+             * @param wnd_growth factor to increase the rx window by
              * @return LORA_OK
              */
-            virtual uint8_t SetRxConfig(uint8_t window, bool continuous);
+            virtual uint8_t SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth);
 
             /**
              * Set frequency sub band if supported by plan
@@ -248,6 +275,24 @@
 
             virtual uint8_t GetMaxDatarate();
 
+            /**
+             * Check if this packet is a beacon and if so extract parameters needed
+             * @param payload of potential beacon
+             * @param size of the packet
+             * @param [out] data extracted from the beacon if this packet was indeed a beacon
+             * @return true if this packet is beacon, false if not
+             */
+            virtual bool DecodeBeacon(const uint8_t* payload,
+                                      size_t size,
+                                      BeaconData_t& data);
+            /**
+             * Update class B beacon and ping slot settings if frequency hopping enabled
+             * @param time received in the last beacon
+             * @param period of the beacon
+             * @param devAddr of this end device
+             */
+            virtual void FrequencyHop(uint32_t time, uint32_t period, uint32_t devAddr);
+
         protected:
 
             static const uint8_t US915_TX_POWERS[11];                   //!< List of available tx powers
@@ -255,6 +300,18 @@
             static const uint8_t US915_MAX_PAYLOAD_SIZE[];              //!< List of max payload sizes for each datarate
             static const uint8_t US915_MAX_PAYLOAD_SIZE_REPEATER[];     //!< List of repeater compatible max payload sizes for each datarate
 
+            typedef struct __attribute__((packed)) {
+                uint8_t RFU1[5];
+                uint8_t Time[4];
+                uint8_t CRC1[2];
+                uint8_t GwSpecific[7];
+                uint8_t RFU2[3];
+                uint8_t CRC2[2];
+            } BCNPayload;
+
+        private:
+            bool _bcnFreqHop;
+            bool _pingFreqHop;
     };
 }