STM32F103c8t6 LoRaWAN lmic

Dependents:   LoRaWAN-lmic-app_copy

Fork of LMiC by Semtech

Files at this revision

API Documentation at this revision

Comitter:
mistery
Date:
Wed Apr 19 07:57:22 2017 +0000
Parent:
4:85b2b647cb64
Commit message:
LoRaWAN

Changed in this revision

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 85b2b647cb64 -r 30dcb702226b lmic.cpp
--- a/lmic.cpp	Thu Nov 26 17:17:08 2015 +0000
+++ b/lmic.cpp	Wed Apr 19 07:57:22 2017 +0000
@@ -535,15 +535,23 @@
 //
 // BEG: EU868 related stuff
 //
-enum { NUM_DEFAULT_CHANNELS=6 };
+//enum { NUM_DEFAULT_CHANNELS=6 };
+enum { NUM_DEFAULT_CHANNELS=1 };
 static const u4_t iniChannelFreq[12] = {
+//static const u4_t iniChannelFreq[2] = {
     // Join frequencies and duty cycle limit (0.1%)
+    
     EU868_F1|BAND_MILLI, EU868_J4|BAND_MILLI,
     EU868_F2|BAND_MILLI, EU868_J5|BAND_MILLI,
     EU868_F3|BAND_MILLI, EU868_J6|BAND_MILLI,
     // Default operational frequencies
     EU868_F1|BAND_CENTI, EU868_F2|BAND_CENTI, EU868_F3|BAND_CENTI,
     EU868_F4|BAND_MILLI, EU868_F5|BAND_MILLI, EU868_F6|BAND_DECI
+/*
+    EU868_F1|BAND_MILLI,
+    // Default operational frequencies
+    EU868_F1|BAND_CENTI
+*/
 };
 
 static void initDefaultChannels (bit_t join) {
@@ -1395,7 +1403,7 @@
     // into the middle of the 8 symbols preamble.
 #if defined(CFG_eu868)
     if( /* TX datarate */LMIC.rxsyms == DR_FSK ) {
-        LMIC.rxtime = LMIC.txend + delay - PRERX_FSK*us2osticksRound(160);
+        LMIC.rxtime = LMIC.txend + delay - PRERX_FSK*us2osticksRound(180);
         LMIC.rxsyms = RXLEN_FSK;
     }
     else
diff -r 85b2b647cb64 -r 30dcb702226b lmic.h
--- a/lmic.h	Thu Nov 26 17:17:08 2015 +0000
+++ b/lmic.h	Wed Apr 19 07:57:22 2017 +0000
@@ -16,11 +16,11 @@
 #define _lmic_h_
 
 // MBED compiler options
-//#define CFG_eu868                                   1
-#define CFG_us915                                   1
-#define CHNL_HYBRID     0       /* US915: 0-7 to select block of 8 channels used */
+#define CFG_eu868                                   1
+//#define CFG_us915                                   1
+//#define CHNL_HYBRID     0       /* US915: 0-7 to select block of 8 channels used */
 
-#define USE_SMTC_RADIO_DRIVER                       1
+//#define USE_SMTC_RADIO_DRIVER                       1
 
 //#define CFG_sx1272_radio                            0
 #define CFG_sx1276_radio                            1
@@ -53,9 +53,12 @@
 #if defined(CFG_eu868) // EU868 spectrum ====================================================
 
 enum { MAX_CHANNELS = 16 };      //!< Max supported channels
+//enum { MAX_CHANNELS = 1};
 enum { MAX_BANDS    =  4 };
+//enum { MAX_BANDS    =  1 };
+enum { LIMIT_CHANNELS = (1<<4) };   // EU868 will never have more channels
+//enum { LIMIT_CHANNELS = (1) }; 
 
-enum { LIMIT_CHANNELS = (1<<4) };   // EU868 will never have more channels
 //! \internal
 struct band_t {
     u2_t     txcap;     // duty cycle limitation: 1/txcap
diff -r 85b2b647cb64 -r 30dcb702226b lorabase.h
--- a/lorabase.h	Thu Nov 26 17:17:08 2015 +0000
+++ b/lorabase.h	Wed Apr 19 07:57:22 2017 +0000
@@ -66,6 +66,8 @@
 //  g2 : 0.1%  14dBm  
 //  g3 :  10%  27dBm  
 //                 freq             band     datarates
+
+/*
 enum { EU868_F1 = 868100000,      // g1   SF7-12 
        EU868_F2 = 868300000,      // g1   SF7-12 FSK SF7/250         
        EU868_F3 = 868500000,      // g1   SF7-12         
@@ -76,9 +78,27 @@
        EU868_J5 = 864300000,      // g2   SF7-12   ditto
        EU868_J6 = 864500000,      // g2   SF7-12   ditto
 };
+*/
+
+//                 freq             band     datarates
+enum { EU868_F1 = 868100000,      // g1   SF7-12 
+       EU868_F2 = 868100000,      // g1   SF7-12 FSK SF7/250         
+       EU868_F3 = 868100000,      // g1   SF7-12         
+       EU868_F4 = 868100000,      // g2   SF7-12         
+       EU868_F5 = 868100000,      // g2   SF7-12         
+       EU868_F6 = 868100000,      // g3   SF7-12         
+       EU868_J4 = 868100000,      // g2   SF7-12  used during join
+       EU868_J5 = 868100000,      // g2   SF7-12   ditto
+       EU868_J6 = 868100000,      // g2   SF7-12   ditto
+};
+
+
 enum { EU868_FREQ_MIN = 863000000,
        EU868_FREQ_MAX = 870000000 };
-
+/*
+enum { EU868_FREQ_MIN = 868100000,
+       EU868_FREQ_MAX = 868100000 };
+*/
 enum { CHNL_PING         = 5 };
 enum { FREQ_PING         = EU868_F6 };  // default ping freq
 enum { DR_PING           = SF9 };       // default ping DR
diff -r 85b2b647cb64 -r 30dcb702226b radio.cpp
--- a/radio.cpp	Thu Nov 26 17:17:08 2015 +0000
+++ b/radio.cpp	Wed Apr 19 07:57:22 2017 +0000
@@ -564,10 +564,10 @@
 #error Missing CFG_sx1272_radio/CFG_sx1276_radio
 #endif
 
-#define RADIO_DBG
+//#define RADIO_DBG
 #if defined(RADIO_DBG)
-DigitalOut txStateIo( PB_8 );
-DigitalOut rxStateIo( PB_9 );
+DigitalOut txStateIo( PA_10 );
+DigitalOut rxStateIo( PA_11 );
 #endif
 
 static void writeReg (u1_t addr, u1_t data ) {