Hello all, I received a new MKRGSM 1400 with antenna and Arduino SIM card a few days ago. After waiting for the SIM to activate, I tried a few example codes to ping different websites. Unfortunately, the board would connect, but the ping always failed. Saying the RTT took -2 or -4 ms.
I've hardcoded the "secret" tab info here as they are the arduino sim defaults for now.
Yesterday I ran this code to see if I could isolate the problem:
// libraries
#include <MKRGSM.h>
// Please enter your sensitive data in the Secret tab or arduino_secrets.h
// PIN Number
const char PINNUMBER[] = "0000";
// APN data
const char GPRS_APN[] = "prepay.pelion";
const char GPRS_LOGIN[] = "arduino";
const char GPRS_PASSWORD[] = "arduino";
// initialize the library instance
GPRS gprs;
GSM gsmAccess(true); // include a 'true' parameter for debug enabled
GSMServer server(80); // port 80 (http default)
// timeout
const unsigned long __TIMEOUT__ = 10 * 1000;
void setup() {
// initialize serial communications and wait for port to open:
Serial.begin(9600);
Serial.println("nice");
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// connection state
bool connected = false;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while (!connected) {
if ((gsmAccess.begin(PINNUMBER) == GSM_READY) &&
(gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD) == GPRS_READY)) {
connected = true;
} else {
Serial.println("Not connected");
delay(1000);
}
}
Serial.println("Connected to GPRS network");
// start server
server.begin();
//Get IP.
IPAddress LocalIP = gprs.getIPAddress();
Serial.println("Server IP address=");
Serial.println(LocalIP);
}
void loop() {
// listen for incoming clients
GSMClient client = server.available();
if (client) {
Serial.println("client is true");
while (client.connected()) {
Serial.println("client.connected is true");
if (client.available()) {
Serial.println("Receiving request!");
bool sendResponse = false;
while (int c = client.read()) {
if (c == -1) {
break;
} else if (c == '\n') {
sendResponse = true;
}
}
// if you've gotten to the end of the line (received a newline
// character)
if (sendResponse) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
client.println("<html>");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(analogRead(analogChannel));
client.println("<br />");
}
client.println("</html>");
//necessary delay
delay(1000);
client.stop();
}
} else {
Serial.println("client.available is false");
}
}
Serial.println("client.connected is false");
} else {
Serial.println("client is null");
delay(1000);
}
}
Here is the result from the serial monitor:
10:08:44.997 -> ⸮AT
10:08:45.234 -> OK
10:08:45.234 -> AT+IPR=921600
10:08:45.234 -> OK
10:08:45.327 -> AT
10:08:45.370 -> OK
10:08:45.370 -> AT+UPSV=3
10:08:45.370 -> OK
10:08:45.513 -> AT+CPIN?
10:08:45.513 -> ERROR
10:08:45.695 -> AT+CPIN?
10:08:45.695 -> +CPIN: READY
10:08:45.695 ->
10:08:45.695 -> OK
10:08:45.879 -> AT+CMGF=1
10:08:45.879 -> OK
10:08:46.112 -> AT+UDCONF=1,1
10:08:46.112 -> OK
10:08:46.299 -> AT+CTZU=1
10:08:46.299 -> OK
10:08:46.485 -> AT+UDTMFD=1,2
10:08:46.485 -> OK
10:08:46.714 -> AT+CREG?
10:08:46.714 -> +CREG: 0,0
10:08:46.714 ->
10:08:46.714 -> OK
10:08:46.901 -> AT+CREG?
10:08:46.901 -> +CREG: 0,0
10:08:46.901 ->
10:08:46.901 -> OK
10:08:47.088 -> AT+CREG?
10:08:47.088 -> +CREG: 0,0
10:08:47.088 ->
10:08:47.088 -> OK
10:08:47.322 -> AT+CREG?
10:08:47.322 -> +CREG: 0,0
10:08:47.322 ->
10:08:47.322 -> OK
10:08:47.507 -> AT+CREG?
10:08:47.507 -> +CREG: 0,0
10:08:47.507 ->
10:08:47.507 -> OK
10:08:47.692 -> AT+CREG?
10:08:47.692 -> +CREG: 0,0
10:08:47.692 ->
10:08:47.692 -> OK
10:08:47.922 -> AT+CREG?
10:08:47.922 -> +CREG: 0,0
10:08:47.922 ->
10:08:47.922 -> OK
10:08:48.014 ->
10:08:48.014 -> +UMWI: 0,1
10:08:48.014 ->
10:08:48.014 -> +UMWI: 0,2
10:08:48.014 ->
10:08:48.014 -> +UMWI: 0,3
10:08:48.014 ->
10:08:48.014 -> +UMWI: 0,4
10:08:48.154 -> AT+CREG?
10:08:48.154 -> +CREG: 0,0
10:08:48.154 ->
10:08:48.154 -> OK
10:08:48.339 -> AT+CREG?
10:08:48.339 -> +CREG: 0,0
10:08:48.339 ->
10:08:48.339 -> OK
10:08:48.526 -> AT+CREG?
10:08:48.526 -> +CREG: 0,0
10:08:48.526 ->
10:08:48.526 -> OK
10:08:48.757 -> AT+CREG?
10:08:48.757 -> +CREG: 0,0
10:08:48.757 ->
10:08:48.757 -> OK
10:08:48.945 -> AT+CREG?
10:08:48.945 -> +CREG: 0,0
10:08:48.945 ->
10:08:48.945 -> OK
10:08:49.127 -> AT+CREG?
10:08:49.127 -> +CREG: 0,0
10:08:49.127 ->
10:08:49.127 -> OK
10:08:49.365 -> AT+CREG?
10:08:49.365 -> +CREG: 0,0
10:08:49.365 ->
10:08:49.365 -> OK
10:08:49.547 -> AT+CREG?
10:08:49.547 -> +CREG: 0,0
10:08:49.547 ->
10:08:49.547 -> OK
10:08:49.784 -> AT+CREG?
10:08:49.784 -> +CREG: 0,0
10:08:49.784 ->
10:08:49.784 -> OK
10:08:49.968 -> AT+CREG?
10:08:49.968 -> +CREG: 0,0
10:08:49.968 ->
10:08:49.968 -> OK
10:08:50.150 -> AT+CREG?
10:08:50.150 -> +CREG: 0,0
10:08:50.150 ->
10:08:50.150 -> OK
10:08:50.381 -> AT+CREG?
10:08:50.381 -> +CREG: 0,0
10:08:50.381 ->
10:08:50.381 -> OK
10:08:50.570 -> AT+CREG?
10:08:50.570 -> +CREG: 0,0
10:08:50.570 ->
10:08:50.570 -> OK
10:08:50.756 -> AT+CREG?
10:08:50.756 -> +CREG: 0,0
10:08:50.756 ->
10:08:50.756 -> OK
10:08:50.990 -> AT+CREG?
10:08:50.990 -> +CREG: 0,0
10:08:50.990 ->
10:08:50.990 -> OK
10:08:51.174 -> AT+CREG?
10:08:51.174 -> +CREG: 0,0
10:08:51.174 ->
10:08:51.174 -> OK
10:08:51.360 -> AT+CREG?
10:08:51.360 -> +CREG: 0,0
10:08:51.360 ->
10:08:51.360 -> OK
10:08:51.592 -> AT+CREG?
10:08:51.592 -> +CREG: 0,0
10:08:51.592 ->
10:08:51.592 -> OK
10:08:51.777 -> AT+CREG?
10:08:51.777 -> +CREG: 0,0
10:08:51.777 ->
10:08:51.777 -> OK
10:08:51.962 -> AT+CREG?
10:08:51.962 -> +CREG: 0,0
10:08:51.962 ->
10:08:51.962 -> OK
10:08:52.193 -> AT+CREG?
10:08:52.193 -> +CREG: 0,0
10:08:52.193 ->
10:08:52.193 -> OK
10:08:52.382 -> AT+CREG?
10:08:52.382 -> +CREG: 0,5
10:08:52.382 ->
10:08:52.382 -> OK
10:08:52.570 -> AT+UCALLSTAT=1
10:08:52.570 -> OK
10:08:52.707 -> AT+CGATT=1
10:08:52.707 -> OK
10:08:52.897 -> AT+UPSD=0,1,"prepay.pelion"
10:08:52.897 -> OK
10:08:53.125 -> AT+UPSD=0,6,3
10:08:53.125 -> OK
10:08:53.315 -> AT+UPSD=0,2,"arduino"
10:08:53.315 -> OK
10:08:53.548 -> AT+UPSD=0,3,"arduino"
10:08:53.548 -> OK
10:08:53.729 -> AT+UPSD=0,7,"0.0.0.0"
10:08:53.729 -> OK
10:08:53.916 -> AT+UPSDA=0,3
10:08:59.819 -> OK
10:09:00.051 -> AT+UPSND=0,8
10:09:00.051 -> +UPSND: 0,8,1
10:09:00.051 ->
10:09:00.051 -> OK
10:09:00.051 -> Connected to GPRS network
10:09:00.051 -> AT+USOCR=6
10:09:00.051 -> +USOCR: 0
10:09:00.051 ->
10:09:00.051 -> OK
10:09:00.097 -> AT+USOLI=0,80
10:09:00.097 -> OK
10:09:00.097 -> AT+UPSND=0,0
10:09:00.097 -> +UPSND: 0,0,"10.66.35.36"
10:09:00.097 ->
10:09:00.097 -> OK
10:09:00.097 -> Server IP address=
10:09:00.097 -> 10.66.35.36
10:09:00.097 -> client is null
10:09:01.119 -> client is null
10:09:02.091 -> client is null
10:09:03.118 -> client is null
10:09:04.092 -> client is null
10:09:05.111 -> client is null
10:09:06.089 -> client is null
10:09:07.113 -> client is null
Does anyone have any idea what could be going on here?