WPG

Fork of mbed-os-example-mbed5-lorawan by mbed-os-examples

Files at this revision

API Documentation at this revision

Comitter:
limchy
Date:
Fri Jul 27 03:36:51 2018 +0000
Parent:
29:0da9196c900a
Commit message:
Ver1

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-lora-radio-drv.lib Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
diff -r 0da9196c900a -r 99137c499371 main.cpp
--- a/main.cpp	Mon Jul 23 12:00:22 2018 +0100
+++ b/main.cpp	Fri Jul 27 03:36:51 2018 +0000
@@ -193,6 +193,7 @@
 static void receive_message()
 {
     int16_t retcode;
+    lorawan_rx_metadata metadata;
     retcode = lorawan.receive(MBED_CONF_LORA_APP_PORT, rx_buffer,
                               sizeof(rx_buffer),
                               MSG_CONFIRMED_FLAG|MSG_UNCONFIRMED_FLAG);
@@ -209,7 +210,8 @@
     }
 
     printf("\r\n Data Length: %d\r\n", retcode);
-
+    lorawan.get_rx_metadata(metadata);
+    printf("\r\n RSSI: %d DR:%d SNR: %d\r\n", metadata.rssi,metadata.rx_datarate,metadata.snr);        
     memset(rx_buffer, 0, sizeof(rx_buffer));
 }
 
@@ -218,6 +220,7 @@
  */
 static void lora_event_handler(lorawan_event_t event)
 {
+    
     switch (event) {
         case CONNECTED:
             printf("\r\n Connection - Successful \r\n");
@@ -250,6 +253,7 @@
             break;
         case RX_DONE:
             printf("\r\n Received message from Network Server \r\n");
+
             receive_message();
             break;
         case RX_TIMEOUT:
diff -r 0da9196c900a -r 99137c499371 mbed-lora-radio-drv.lib
--- a/mbed-lora-radio-drv.lib	Mon Jul 23 12:00:22 2018 +0100
+++ b/mbed-lora-radio-drv.lib	Fri Jul 27 03:36:51 2018 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-semtech-lora-rf-drivers#1a18f0a174c33b3ca0127fc0d5ad8902a4e3b50b
+https://github.com/ARMmbed/mbed-semtech-lora-rf-drivers/#1a18f0a174c33b3ca0127fc0d5ad8902a4e3b50b
diff -r 0da9196c900a -r 99137c499371 mbed_app.json
--- a/mbed_app.json	Mon Jul 23 12:00:22 2018 +0100
+++ b/mbed_app.json	Fri Jul 27 03:36:51 2018 +0000
@@ -6,36 +6,36 @@
         },
         "main_stack_size":     { "value": 4096 },
 
-        "lora-spi-mosi":       { "value": "NC" },
-        "lora-spi-miso":       { "value": "NC" },
-        "lora-spi-sclk":       { "value": "NC" },
-        "lora-cs":             { "value": "NC" },
-        "lora-reset":          { "value": "NC" },
-        "lora-dio0":           { "value": "NC" },
-        "lora-dio1":           { "value": "NC" },
-        "lora-dio2":           { "value": "NC" },
-        "lora-dio3":           { "value": "NC" },
-        "lora-dio4":           { "value": "NC" },
-        "lora-dio5":           { "value": "NC" },
+        "lora-spi-mosi":       { "value": "PA_7" },
+        "lora-spi-miso":       { "value": "PA_6" },
+        "lora-spi-sclk":       { "value": "PA_5" },
+        "lora-cs":             { "value": "PB_6" },
+        "lora-reset":          { "value": "PA_0" },
+        "lora-dio0":           { "value": "PA_10" },
+        "lora-dio1":           { "value": "PB_3" },
+        "lora-dio2":           { "value": "PB_5" },
+        "lora-dio3":           { "value": "PB_4" },
+        "lora-dio4":           { "value": "PA_9" },
+        "lora-dio5":           { "value": "PC_7" },
         "lora-rf-switch-ctl1": { "value": "NC" },
         "lora-rf-switch-ctl2": { "value": "NC" },
         "lora-txctl":          { "value": "NC" },
-        "lora-rxctl":          { "value": "NC" },
+        "lora-rxctl":          { "value": "PC_1" },
         "lora-ant-switch":     { "value": "NC" },
         "lora-pwr-amp-ctl":    { "value": "NC" },
         "lora-tcxo":           { "value": "NC" }
     },
     "target_overrides": {
         "*": {
-            "platform.stdio-convert-newlines": true,
+             "platform.stdio-convert-newlines": true,
             "platform.stdio-baud-rate": 115200,
             "platform.default-serial-baud-rate": 115200,
             "lora.over-the-air-activation": true,
             "lora.duty-cycle-on": true,
-            "lora.phy": "EU868",
-            "lora.device-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }",
-            "lora.application-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }",
-            "lora.application-key": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }"
+            "lora.phy": "AS923",
+            "lora.device-eui": "{ 0xFF, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x02 }",
+            "lora.application-eui": "{ 0x70, 0xB3, 0xD5, 0x7E, 0xF0, 0x00, 0x01, 0xAF }",
+            "lora.application-key": "{ 0xF3, 0xCE, 0x69, 0xEC, 0x76, 0x98, 0x85, 0x57, 0xED, 0x66, 0xD5, 0xDF, 0x3B, 0x01, 0x40, 0xD7 }"
         },
 
         "K64F": {