Example "MC20_GPRSHTTP" does not work on Wio Tracker

I connected my Wio Tracker board to Arduino IDE and it worked fine. And I put my 4G nano sim card into the sim socket in the board.



Then I opened the example “MC20_GPRSHTTP” and downloaded the firmware into the board. The result was always failure(see below).



10:31:47.839 ->

10:31:47.839 -> Power On!

10:31:53.370 ->

10:31:53.370 ->

10:31:53.370 ->

10:31:53.370 ->

10:31:53.370 ->

10:31:53.370 ->

10:32:24.386 ->

10:32:24.386 -> IP:

10:32:34.384 -> ERROR:QIOPEN

10:32:44.410 -> ERROR:QIOPEN

10:32:54.409 -> ERROR:QIOPEN

10:33:04.397 -> ERROR:QIOPEN

10:33:14.402 -> ERROR:QIOPEN

10:33:14.402 -> Connect Error!



I tried both 4G cards of CMCC and China TeleCOM, the error messages are the same.



How can I use GPRS TCP then?



Thanks,

Jim Jin

When I run the other example “MC20_SMSSend”, the registration of network fails (the code is: gpsTracker.waitForNetworkRegister()). There is one interesting thing: when I installed the 4G sim card of China Telecom, the “NET” led on the board blinks. It does not blink with CMCC sim card.

Hi there,



For GPRS: you have to configure your own APN @ const char apn[10] = “XXXX”; You can check with your SIM card carrier about the APN.



Coz I can not access <LINK_TEXT text=“https://os.mbed.com/media/uploads/mbed_ … /hello.txt”>https://os.mbed.com/media/uploads/mbed_official/hello.txt</LINK_TEXT> from my area, so i replace to raw.githubusercontent.com. If you can access mbed website. You can use this configure.



you have to connect the antenna, or else, it can not connect the network. thanks.



---------------------------------------------------------------------------

const char URL[100] = “mbed.org”;

char http_cmd[100] = “GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\r\n\r”;

---------------------------------------------------------------------------

[code]#include “MC20_Common.h”
#include “MC20_Arduino_Interface.h”
#include “MC20_GPRS.h”

#define RGBPIN 10

GPRS gprs = GPRS();
const char apn[10] = “CMNET”;
const char URL[100] = “raw.githubusercontent.com”;
char http_cmd[100] = “GET SeeedDocument/forum_doc/master/hello.txt HTTP/1.0\n\r\n\r”;
int port = 80;

int ret = 0;

void setup() {
pinMode(RGBPIN, OUTPUT);
digitalWrite(RGBPIN, LOW);
SerialUSB.begin(115200);

gprs.Power_On();
SerialUSB.println("\n\rPower On!");

if(!(ret = gprs.init(apn))) {
SerialUSB.print("GPRS init error: ");
SerialUSB.println(ret);
}

gprs.join();
SerialUSB.print("\n\rIP: ");
SerialUSB.print(gprs.ip_string);

if(gprs.connectTCP(URL, port)) {
gprs.sendTCPData(http_cmd);
} else {
SerialUSB.println(“Connect Error!”);
}
}

void loop() {
/* Debug */
if(SerialUSB.available()){
serialMC20.write(SerialUSB.read());
}
if(serialMC20.available()){
SerialUSB.write(serialMC20.read());
}

}[/code]

Here is the output from arduino serial port.

[code]

Power On!

IP:
10.11.176.242

HTTP/1.1 400 Bad Request
Server: GitHub.com
Content-Type: text/html; charset=utf-8
ETag: “5c3cbd7d-23a1”
Content-Security-Policy: default-src ‘none’; style-src ‘unsafe-inline’; img-src data:; connect-src ‘self’
X-GitHub-Request-Id: 3B94:3B5F:1E39E89:2096F1A:5CEE4C59
Accept-Ranges: bytes
Content-Length: 9121
Accept-Ranges: bytes
Date: Wed, 29 May 2019 09:09:46 GMT
Via: 1.1 varnish
Connection: close
X-Served-By: cache-lax8640-LAX
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1559120986.255221,VS0,VE27
Vary: Accept-Encoding
X-Fastly-Request-ID: 75eb3c14db3e85d903935c22fb9a7c822e9a818d

[/code]