Fork of Semtech LoRaWAN stack

Fork of LoRaWAN-lib by canuck lehead

Files at this revision

API Documentation at this revision

Comitter:
Shaun Nelson
Date:
Thu Sep 21 17:00:15 2017 -0400
Branch:
class_b
Parent:
42:c827c9e89260
Child:
47:e7fd944a7215
Commit message:
US915 PingSlot channel was not calculating downlink channel per the spec

Changed in this revision

region/Region.h Show annotated file Show diff for this revision Revisions of this file
region/RegionUS915.cpp Show annotated file Show diff for this revision Revisions of this file
region/RegionUS915.h Show annotated file Show diff for this revision Revisions of this file
--- a/region/Region.h	Tue Aug 15 17:12:19 2017 -0400
+++ b/region/Region.h	Thu Sep 21 17:00:15 2017 -0400
@@ -812,6 +812,13 @@
      * PHY_PINGSLOT_CHANNEL_FREQ.
      */
     uint32_t DeviceAddress;
+
+    /*!
+     * LoRaMAC Beacon Time.This parameter must be set to query:
+     * PHY_PINGSLOT_CHANNEL_FREQ.
+     */
+    TimerTime_t BeaconTime;
+
 }GetPhyParams_t;
 
 /*!
--- a/region/RegionUS915.cpp	Tue Aug 15 17:12:19 2017 -0400
+++ b/region/RegionUS915.cpp	Thu Sep 21 17:00:15 2017 -0400
@@ -358,7 +358,8 @@
         }
         case PHY_PINGSLOT_CHANNEL_FREQ:
         {
-            phyParam.Value = US915_BEACON_CHANNEL_FREQ;
+            // phyParam.Value = US915_BEACON_CHANNEL_FREQ;
+        	phyParam.Value = ( 923.3e6 + ( BeaconChannel( getPhy->DeviceAddress, getPhy->BeaconTime, US915_BEACON_INTERVAL)  * 600e3 ) );
             break;
         }
         case PHY_BEACON_SIZE:
@@ -618,10 +619,15 @@
     // Read the physical datarate from the datarates table
     phyDr = DataratesUS915[dr];
 
+
     Radio.SetChannel( frequency );
 
     // Radio configuration
-    Radio.SetRxConfig( MODEM_LORA, rxConfig->Bandwidth, phyDr, 1, 0, 8, rxConfig->WindowTimeout, false, 0, false, 0, 0, true, rxConfig->RxContinuous );
+    // SKN - bandwidth is garbage in ping slot receive, calculate it instead from the datarate
+    // Radio.SetRxConfig( MODEM_LORA, rxConfig->Bandwidth, phyDr, 1, 0, 8, rxConfig->WindowTimeout, false, 0, false, 0, 0, true, rxConfig->RxContinuous );
+
+    uint32_t bandwidth = GetBandwidth( dr );
+    Radio.SetRxConfig( MODEM_LORA, bandwidth, phyDr, 1, 0, 8, rxConfig->WindowTimeout, false, 0, false, 0, 0, true, rxConfig->RxContinuous );
 
     if( rxConfig->RepeaterSupport == true )
     {
--- a/region/RegionUS915.h	Tue Aug 15 17:12:19 2017 -0400
+++ b/region/RegionUS915.h	Thu Sep 21 17:00:15 2017 -0400
@@ -243,13 +243,16 @@
 /*!
  * Payload size of a beacon frame
  */
-#define US915_BEACON_SIZE                           19
+// #define US915_BEACON_SIZE                           19
+#define US915_BEACON_SIZE                           23 
 
 /*!
  * Datarate of the beacon channel
  */
-//#define US915_BEACON_CHANNEL_DR                     DR_8
-#define US915_BEACON_CHANNEL_DR                       DR_10
+// V1.1 Beacon Datarate
+#define US915_BEACON_CHANNEL_DR                     DR_8
+// V1.0 Datarate
+// #define US915_BEACON_CHANNEL_DR                       DR_10
 
 /*!
  * Bandwith of the beacon channel