This is an example based on mbed-os cellular APIs that demonstrates a TCP or UDP echo transaction with a public echo server.

Files at this revision

API Documentation at this revision

Comitter:
pimco01
Date:
Thu Jan 30 06:49:19 2020 +0000
Parent:
51:f4b4b186f3a2
Child:
53:52be2af62919
Commit message:
BG96 ( LGU+ LTE CAT.M1 ) Intial Commit.

Changed in this revision

SERCOMM.lib Show diff for this revision Revisions of this file
main.cpp 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
--- a/SERCOMM.lib	Wed Dec 25 16:18:24 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://github.com/codezoo-ltd/SERCOMM.git/#f0de3044fc2014eaa2422d02cc299a7d83d36c51
--- a/main.cpp	Wed Dec 25 16:18:24 2019 +0000
+++ b/main.cpp	Thu Jan 30 06:49:19 2020 +0000
@@ -15,6 +15,7 @@
  */
 
 #include "mbed.h"
+#include "rtos.h"
 #include "common_functions.h"
 #include "CellularNonIPSocket.h"
 #include "CellularDevice.h"
@@ -28,6 +29,23 @@
 // Number of retries /
 #define RETRY_COUNT 3
 
+void BG96_Modem_PowerON(void)
+{
+    DigitalIn BG96_STATUS(D2);
+    DigitalOut BG96_PWRKEY(D3);
+
+    ThisThread::sleep_for(50);
+    BG96_PWRKEY = 1;
+    ThisThread::sleep_for(600);
+    BG96_PWRKEY = 0;
+    ThisThread::sleep_for(5000);
+    
+    if(BG96_STATUS)
+        printf("Module Power On~~\r\n");
+    else
+        printf("Check Module Power Line!!\r\n");        
+}
+
 NetworkInterface *iface;
 
 // Echo server hostname
@@ -244,6 +262,9 @@
 #endif
 
     print_function("Establishing connection\n");
+    
+    BG96_Modem_PowerON();
+    
 #if MBED_CONF_MBED_TRACE_ENABLE
     trace_open();
 #else
--- a/mbed_app.json	Wed Dec 25 16:18:24 2019 +0000
+++ b/mbed_app.json	Thu Jan 30 06:49:19 2020 +0000
@@ -1,6 +1,6 @@
 {
     "config": {
-        "sock-type": "UDP",
+        "sock-type": "TCP",
         "echo-server-hostname": {
             "help": "Echo server host name.",
             "value": "\"echo.mbedcloudtesting.com\""
@@ -20,28 +20,23 @@
             "target.network-default-interface-type": "CELLULAR",
             "mbed-trace.enable": true,
             "lwip.ipv4-enabled": true,
+            "lwip.ipv6-enabled": false,
             "lwip.ethernet-enabled": false,
             "lwip.ppp-enabled": false,
             "lwip.tcp-enabled": true,
             "platform.stdio-convert-newlines": true,
             "platform.stdio-baud-rate": 115200,
-            "platform.default-serial-baud-rate": 9600,
+            "platform.default-serial-baud-rate": 115200,
             "platform.stdio-buffered-serial": true,
             "cellular.debug-at": false,
             "nsapi.default-cellular-plmn": 0,
             "nsapi.default-cellular-sim-pin": "\"1234\"",
-            "nsapi.default-cellular-apn": 0,
+            "nsapi.default-cellular-apn": "\"m2m-catm1.default.lguplus.co.kr\"",
             "nsapi.default-cellular-username": 0,
-            "nsapi.default-cellular-password": 0
-        },
-        "DISCO_L475VG_IOT01A": {
-            "target.macros_add": [
-                "CELLULAR_DEVICE=SERCOMM_TPB23"
-            ],
-            "target.components_add": ["SERCOMM_TPB23"],
-            "SERCOMM_TPB23.tx":"D1",
-            "SERCOMM_TPB23.rx":"D0",
-            "SERCOMM_TPB23.provide-default":"true"
+            "nsapi.default-cellular-password": 0,
+            "QUECTEL_BG96.tx": "D1",
+            "QUECTEL_BG96.rx": "D0",
+            "QUECTEL_BG96.provide-default": true
         }
     }
-}                
\ No newline at end of file
+}        
\ No newline at end of file