Updates as of 2-17-16 for debugging K22F LoRa platform.

Fork of lmic_MOTE_L152RC by Timothy Mulrooney

Files at this revision

API Documentation at this revision

Comitter:
jlcolemanmbed
Date:
Thu Feb 18 01:28:06 2016 +0000
Parent:
11:671d85a0f15b
Commit message:
updated file for testing K22F development system

Changed in this revision

hal.cpp Show annotated file Show diff for this revision Revisions of this file
lmic.cpp Show annotated file Show diff for this revision Revisions of this file
lmic.h Show annotated file Show diff for this revision Revisions of this file
lorabase.h Show annotated file Show diff for this revision Revisions of this file
radio.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 671d85a0f15b -r febc37010b64 hal.cpp
--- a/hal.cpp	Tue Feb 09 00:28:59 2016 +0000
+++ b/hal.cpp	Thu Feb 18 01:28:06 2016 +0000
@@ -10,8 +10,8 @@
 #define RADIO_NSS       PTD4
 //#define RESET_PIN       PTC1 /* *** TODO *** */
 
-//#define RFSW1                    PTC1 //NorAm_Mote RFSwitch_CNTR_1 *** TODO ***
-//#define RFSW2                    PTC1 //NorAm_Mote RFSwitch_CNTR_2 *** TODO ***
+//#define RFSW1                    PTC6 //NorAm_Mote RFSwitch_CNTR_1 *** TODO ***
+#define RFSW2                    PTC6 //NorAm_Mote RFSwitch_CNTR_2 *** TODO ***
 
 static DigitalOut nss(PTD4);
 static SPI spi(RADIO_MOSI, RADIO_MISO, RADIO_SCLK); // (mosi, miso, sclk)
@@ -19,7 +19,7 @@
 //static DigitalInOut rst(RESET_PIN);
 
 //DigitalOut rfsw1(RFSW1);
-//DigitalOut rfsw2(RFSW2);
+DigitalOut rfsw2(RFSW2);
 
 //DigitalOut hdr_fem_csd(PTC1);   /* *** TODO *** */
 
@@ -110,7 +110,7 @@
     spi.frequency(1000000);
     spi.format(8, 0);
     nss = 1;
-    //RFSwitch_CNTR_2 = 1;
+   // RFSwitch_CNTR_2 = 1;
 #endif
 
     set_time(0);    // initialize RTC
@@ -304,7 +304,7 @@
     return(res);
 }
 
-// 0=RX     1=TX
+ //0=RX     1=TX
 /*void hal_pin_rxtx (u1_t val)
 {
     rxtx = !val;
@@ -322,24 +322,24 @@
 void hal_opmode(u1_t mode, u1_t pa_boost)
 {
    debugSW("hal_opmode %02X %02X\r\n",mode, pa_boost);
-//    if (mode == OPMODE_TX) {  // start of transmission
-//        if (pa_boost) {
-//            rfsw2 = 0;
+    if (mode == OPMODE_TX) {  // start of transmission
+        if (pa_boost) {
+            rfsw2 = 1; //revised to match PE4259 switch controls
 //            rfsw1 = 1;
-//        } else {
-//            rfsw2 = 1;
-//            rfsw1 = 0;          
-//        }
+        } else {
+            rfsw2 = 1;  //revised to match PE4259 switch controls
+//           rfsw1 = 0;          
+        }
 //        hdr_fem_csd = 0;    // debug   
-//    } else if (mode == OPMODE_RX || mode == OPMODE_RX_SINGLE || mode == OPMODE_CAD) { // start of reception
-//        rfsw2 = 1;
-//        rfsw1 = 1; 
+    } else if (mode == OPMODE_RX || mode == OPMODE_RX_SINGLE || mode == OPMODE_CAD) { // start of reception
+        rfsw2 = 0;  //revised to match PE4259 switch controls
+//       rfsw1 = 1; 
 //       hdr_fem_csd = 1;    // debug        
-//    } else { // RF switch shutdown
-//        rfsw2 = 0;
+    } else { // RF switch shutdown
+        rfsw2 = 1;  //revised to match PE4259 switch controls
 //        rfsw1 = 0;
-//        hdr_fem_csd = 0;    // debug   
-//    }
+//       hdr_fem_csd = 0;    // debug   
+    }
    debugSW("hal_opmode exit\r\n");
 }
 
diff -r 671d85a0f15b -r febc37010b64 lmic.cpp
--- a/lmic.cpp	Tue Feb 09 00:28:59 2016 +0000
+++ b/lmic.cpp	Thu Feb 18 01:28:06 2016 +0000
@@ -43,6 +43,8 @@
 // Special APIs - for development or testing
 #define isTESTMODE() 0
 
+
+
 DEFINE_LMIC;
 DECL_ON_LMIC_EVENT;
 
@@ -752,7 +754,7 @@
         LMIC.channelMap[i] = 0xFFFF;
     LMIC.channelMap[4] = 0x00FF;
     
-    LMIC.txpow_limit = 30;
+    LMIC.txpow_limit = 26;  //This sets the radio transmit power level in dBm
 #endif
 
     LMIC.txpow = LMIC.txpow_limit;
@@ -796,7 +798,8 @@
 }
 
 static void updateTx (ostime_t txbeg) {
-    u1_t chnl = LMIC.txChnl;
+    // u1_t chnl = LMIC.txChnl;
+      
 #ifdef JOIN_REQ_DEBUG    
     printf("chnl%d ", chnl);
 #endif /* JOIN_REQ_DEBUG */  
diff -r 671d85a0f15b -r febc37010b64 lmic.h
--- a/lmic.h	Tue Feb 09 00:28:59 2016 +0000
+++ b/lmic.h	Thu Feb 18 01:28:06 2016 +0000
@@ -19,6 +19,7 @@
 #include "lorabase.h"
 
 // LMIC version
+
 #define LMIC_VERSION_MAJOR 1
 #define LMIC_VERSION_MINOR 5
 #define LMIC_VERSION_BUILD 1431528305
@@ -57,7 +58,7 @@
 #elif defined(CFG_us915)  // US915 spectrum =================================================
 
 enum { MAX_XCHANNELS = 2 };      // extra channels in RAM, channels 0-71 are immutable 
-enum { MAX_TXPOW_125kHz = 30 };
+enum { MAX_TXPOW_125kHz = 30 };  
 
 #endif // ==========================================================================
 
diff -r 671d85a0f15b -r febc37010b64 lorabase.h
--- a/lorabase.h	Tue Feb 09 00:28:59 2016 +0000
+++ b/lorabase.h	Thu Feb 18 01:28:06 2016 +0000
@@ -112,7 +112,7 @@
 enum { DR_PAGE = DR_PAGE_US915 };
 
 // Default frequency plan for US 915MHz
-enum { US915_125kHz_UPFBASE = 902300000,
+enum { US915_125kHz_UPFBASE = 902300000,  //change back to 902300000
        US915_125kHz_UPFSTEP =    200000,
        US915_500kHz_UPFBASE = 903000000,
        US915_500kHz_UPFSTEP =   1600000,
diff -r 671d85a0f15b -r febc37010b64 radio.cpp
--- a/radio.cpp	Tue Feb 09 00:28:59 2016 +0000
+++ b/radio.cpp	Thu Feb 18 01:28:06 2016 +0000
@@ -449,7 +449,7 @@
         PaSelect = 0x80;    // use PA_BOOST 
         writeReg(RegPaConfig, PaSelect | boost_table[LMIC.txpow]);
     }
-    //printf("PaConfig:%02x\r\n", readReg(RegPaConfig));
+    printf("PaConfig:%02x\r\n", readReg(RegPaConfig));
     
 #else
 #error Missing CFG_sx1272_radio/CFG_sx1276_radio