test harness

Dependencies:   LoRaWAN-NAMote72-Application-Demo LoRaWAN-lib2 SX1272Lib lib_gps lib_mma8451q lib_mpl3115a2 mbed

Fork of LoRaWAN-NAMote72-Application-Demo by Semtech

Files at this revision

API Documentation at this revision

Comitter:
billvs
Date:
Wed Nov 08 14:21:52 2017 +0000
Parent:
15:39a23f5affd1
Commit message:
changes for test harnes

Changed in this revision

LoRaWAN-NAMote72-Application-Demo-reload.lib Show annotated file Show diff for this revision Revisions of this file
app/Comissioning.h Show annotated file Show diff for this revision Revisions of this file
app/Config.h Show annotated file Show diff for this revision Revisions of this file
app/SerialDisplay.cpp Show annotated file Show diff for this revision Revisions of this file
mac/LoRaWAN-lib.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 39a23f5affd1 -r 3aa2e2bf34c3 LoRaWAN-NAMote72-Application-Demo-reload.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LoRaWAN-NAMote72-Application-Demo-reload.lib	Wed Nov 08 14:21:52 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/Semtech/code/LoRaWAN-NAMote72-Application-Demo/#39a23f5affd1
diff -r 39a23f5affd1 -r 3aa2e2bf34c3 app/Comissioning.h
--- a/app/Comissioning.h	Wed Aug 31 21:01:03 2016 +0000
+++ b/app/Comissioning.h	Wed Nov 08 14:21:52 2017 +0000
@@ -41,16 +41,20 @@
  * If provided by user, e.g. { IEEE_OUI, 0x00, 0x00, 0x00, 0xFF, 0x01 }, then this value is used by the application
  */
 #define LORAWAN_DEVICE_EUI                          { IEEE_OUI, 0x00, 0x00, 0x00, 0x00, 0x00 }
+//#define LORAWAN_DEVICE_EUI                          { IEEE_OUI,   0x00, 0x3D, 0x03, 0x4A, 0x33 }
 
 /*!
  * Application IEEE EUI (big endian)
  */
 #define LORAWAN_APPLICATION_EUI                     { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
+//#define LORAWAN_APPLICATION_EUI                     { 0xCA, 0xB1, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00 }
 
 /*!
  * AES encryption/decryption cipher application key
  */
 #define LORAWAN_APPLICATION_KEY                     { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }
+//#define LORAWAN_APPLICATION_KEY                     { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C }
+//#define LORAWAN_APPLICATION_KEY                       { 0x6c, 0xe4, 0x98, 0x66, 0x50, 0xd6, 0x0c, 0x36, 0x4a, 0x54, 0x6a, 0xb5, 0xfe, 0xfe, 0x5f, 0x81 }
 
 #else
 
diff -r 39a23f5affd1 -r 3aa2e2bf34c3 app/Config.h
--- a/app/Config.h	Wed Aug 31 21:01:03 2016 +0000
+++ b/app/Config.h	Wed Nov 08 14:21:52 2017 +0000
@@ -38,7 +38,7 @@
 /*!
  * Defines the application data transmission periodicity. It is the time between RX1/RX2 and next TX
  */
-#define APP_TX_DUTYCYCLE                            5000000  // value in us
+#define APP_TX_DUTYCYCLE                            10000000  // value in us
 
 /*!
  * LoRaWAN confirmed messages
@@ -70,7 +70,7 @@
  *
  * \remark The Tx power level is set as TX_POWER_P_DBM, where 10 <= P <= 30 and P is even value { i.e. P = 10, 12, 14 ... 28 or 30 }
  */
-#define LORAWAN_TX_POWER                            TX_POWER_20_DBM
+#define LORAWAN_TX_POWER                            TX_POWER_28_DBM
 
 #if ( LORAWAN_APP_PORT == 5 )
 /*====================================================
diff -r 39a23f5affd1 -r 3aa2e2bf34c3 app/SerialDisplay.cpp
--- a/app/SerialDisplay.cpp	Wed Aug 31 21:01:03 2016 +0000
+++ b/app/SerialDisplay.cpp	Wed Nov 08 14:21:52 2017 +0000
@@ -14,6 +14,10 @@
 */
 
 #include "SerialDisplay.h"
+extern int do_high_power;
+extern int Force_channel;
+extern uint8_t Hard_channel;
+extern uint8_t Channel;
 
 VT100 vt( USBTX, USBRX );
 
@@ -22,60 +26,97 @@
     printf( "###### ===== JOINING ==== ######\r\n" );
     
     DisplayNetworkParam( );
+    printf ("Channel = %d \r\n", Channel);
 
     printf( "\r\n" );
 }
+extern int verbose;
+int TX_first_time = 1;
+int total_sends;
+int delta;
+int old_delta;
 
 void SerialDisplayTxUpdate(void)
 {
-    printf( "###### ===== UPLINK FRAME %d ==== ######\r\n", LoRaMacUplinkStatus.UplinkCounter );
-
+    delta = total_sends - LoRaMacUplinkStatus.UplinkCounter;
+    printf( "#UF %d ==== delta = %d # ", LoRaMacUplinkStatus.UplinkCounter, delta  );
+    if (old_delta != delta)
+    {
+        old_delta = delta;
+        printf( "######                                         new  delta = %d##\r\n", delta );
+        
+    }
     DisplayNetworkParam( );
-    
-    printf( "TX PORT: %d\r\n", LoRaMacUplinkStatus.Port );
 
-    if( LoRaMacUplinkStatus.BufferSize != 0 )
-    {
-        printf( "TX DATA: " );
-        if( LoRaMacUplinkStatus.Type == MCPS_CONFIRMED )
+    if ((verbose > 10) || TX_first_time)
+    {    
+        TX_first_time = 0;
+        printf( "TX PORT: %d\r\n", LoRaMacUplinkStatus.Port );
+
+        if( LoRaMacUplinkStatus.BufferSize != 0 )
         {
-            printf( "CONFIRMED\r\n" );
+            printf( "TX DATA: " );
+            if( LoRaMacUplinkStatus.Type == MCPS_CONFIRMED )
+            {
+                printf( "CONFIRMED\r\n" );
+            }
+            else
+            {
+                printf( "UNCONFIRMED\r\n" );
+            }
+            SerialDisplayHex( LoRaMacUplinkStatus.Buffer, LoRaMacUplinkStatus.BufferSize );
         }
-        else
-        {
-            printf( "UNCONFIRMED\r\n" );
-        }
-        SerialDisplayHex( LoRaMacUplinkStatus.Buffer, LoRaMacUplinkStatus.BufferSize );
-    }
+
+        printf( "DATA RATE: DR%d\r\n", LoRaMacUplinkStatus.Datarate );
+    
+        printf( "BATTERY: %2.2fV\r\n", BoardGetBatteryVoltage( ) );
 
-    printf( "DATA RATE: DR%d\r\n", LoRaMacUplinkStatus.Datarate );
-
-    printf( "TX POWER: %d dBm\r\n", 30 - ( LoRaMacUplinkStatus.TxPower << 1 ) );
+    }
+    if (do_high_power)
+    {
+        printf( "TX P %d ", 30  );
+    }
+    else
+    {
+        printf( "TX P %d ", 30 - ( LoRaMacUplinkStatus.TxPower << 1 ) );
+    }
+    if  (Force_channel)
+    {
+        printf("Tot S = %d ", total_sends );
+    }
+    else
+    {
+        printf("channel number %d, total sends = %d \r\n", Channel, total_sends);
+    }
+    if (verbose > 5)
+        printf( "\r\n");
+}
 
-    printf( "BATTERY: %2.2fV\r\n", BoardGetBatteryVoltage( ) );
-
-    printf( "\r\n");
-}
+int RX_first_time = 1;
 
 void SerialDisplayRxUpdate( void )
 {
-    printf( "###### ===== DOWNLINK FRAME %d ==== ######\r\n", LoRaMacDownlinkStatus.DownlinkCounter );
+    printf( "# DF %d ==== ###### ", LoRaMacDownlinkStatus.DownlinkCounter );
+    printf( "W %d", LoRaMacDownlinkStatus.RxSlot + 1 );
 
-    printf( "RX WINDOW: %d\r\n", LoRaMacDownlinkStatus.RxSlot + 1 );
-    
-    printf( "RX PORT: %d\r\n", LoRaMacDownlinkStatus.Port );
-
-    if( LoRaMacDownlinkStatus.BufferSize != 0 )
+    if ((verbose > 10) || (RX_first_time))
     {
-        printf( "RX DATA: \r\n" );
-        SerialDisplayHex( LoRaMacDownlinkStatus.Buffer, LoRaMacDownlinkStatus.BufferSize );
-    }
+        RX_first_time = 0;
+    
+        printf( "RX PORT: %d\r\n", LoRaMacDownlinkStatus.Port );
 
-    printf( "RX RSSI: %d\r\n", LoRaMacDownlinkStatus.Rssi );
+        if( LoRaMacDownlinkStatus.BufferSize != 0 )
+        {
+            printf( "RX DATA: \r\n" );
+            SerialDisplayHex( LoRaMacDownlinkStatus.Buffer, LoRaMacDownlinkStatus.BufferSize );
+        }
 
-    printf( "RX SNR: %d\r\n", LoRaMacDownlinkStatus.Snr );
+        printf( "RX RSSI: %d\r\n", LoRaMacDownlinkStatus.Rssi );
 
-    printf( "\r\n" );
+        printf( "RX SNR: %d\r\n", LoRaMacDownlinkStatus.Snr );
+
+        printf( "\r\n" );
+    }
 }
 
 void SerialDisplayHex( uint8_t *pData, uint8_t len )
@@ -103,28 +144,40 @@
 
 void SerialAcclMetrDisplay( uint8_t statusReg )
 {
-    printf( "===== DEVICE ORIENTATION ====\r\n" );
+    if (verbose > 9)
+        printf( "===== DEVICE ORIENTATION ====\r\n" );
     if( ( statusReg & 0x40 ) != 0 )
     {
-        printf( "HORIZONTAL + " );
+        printf( "H + " );
         if( ( statusReg & 0x01 ) != 0 )
         {
-            printf( "FACE DOWN" );
+            do_high_power = 1;
+            Force_channel = 1;
+            printf( "FD=highP,ForceC " );
         }
         else
         {
-            printf( "FACE UP" );
+            do_high_power=0;
+            Force_channel = 1;
+            printf( "FU=ForcC " );
         }
     }
     else
     {
-        printf( "VERTICAL" ); 
+        do_high_power = 0;
+        Force_channel = 0;
+        printf( "VERTICAL - regular power, regular channel" ); 
     }
-    printf( "\r\n\r\n" );
+    //printf( "\r\n\r\n" );
 }
+int first_time = 1;
+int verbose = 1;
 
 void DisplayNetworkParam( void )
 {
+    if ((verbose > 10) || (first_time))
+    {
+        first_time = 0;
 #if( OVER_THE_AIR_ACTIVATION != 0 )
 
     printf( "DEVEUI: " );
@@ -151,7 +204,9 @@
     SerialDisplayHex( NwkSKey, 16 );
 
     printf( "APPSKEY: " );
+    printf( " channel = %d\r\n", Channel);
     SerialDisplayHex( AppSKey, 16 );
 
 #endif
+    }
 }
\ No newline at end of file
diff -r 39a23f5affd1 -r 3aa2e2bf34c3 mac/LoRaWAN-lib.lib
--- a/mac/LoRaWAN-lib.lib	Wed Aug 31 21:01:03 2016 +0000
+++ b/mac/LoRaWAN-lib.lib	Wed Nov 08 14:21:52 2017 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/teams/Semtech/code/LoRaWAN-lib/#d7a34ded7c87
+https://os.mbed.com/users/billvs/code/LoRaWAN-lib2/#e9b05b76b8f2