Afternoon all,
I've reciently moved to an MKR GSM 1400 looking to use the GSM to connect to an API where the web server requires TLS 1.2 which i believe the board supports. I was previously using an Uno & SIM800L board that worked fine until i wanted to use SSL.
Problem is the board isn't behaving quite like i'd expect. I'm currently using the GSMSSLWebClient example and only altering the server & path. I currently have antenna, lipo battery, usb connected & UK o2 data only SIM card inserted.
MKR GSM 1400 > server:arduino.cc path:/asciilogo.txt = 301 moved perminantly.
Postman > server:arduino.cc path:/asciilogo.txt = 200 text logo displayed.
MKR GSM 1400 > server:postman-echo.com path:/get?foo1=bar1&foo2=bar2 = echoed correctly
Postman > server:postman-echo.com path:/get?foo1=bar1&foo2=bar2 = 200 echoed correctly
MKR GSM 1400 > server:mytestapi.co.uk path:/api/post/read_single.php = 'connection failed'
Postman > server:mytestapi.co.uk path:/api/post/read_single.php = 200 data returned
I'm a little confused why i'm recieving the differing results, if i change the port to 80 then they all recieve 'connection failed'.
gprs.getIPAddress() will return an IP address
modemTest.getIMEI() will return the IMEI num
scannerNetworks.getCurrentCarrier() will return 'UK o2'
scannerNetworks.getSignalStrength() will return usually between 12 & 18
Am i missing a step somewhere, have i overlooked something? I've tested the SIM in an ipad and it works fine...
Any help of pointers would be greatly apreciated...
Thanks
Dave
This is the code i'm using, its literally the example...
#include <MKRGSM.h>
const char PINNUMBER[] = "";
const char GPRS_APN[] = "";
const char GPRS_LOGIN[] = "";
const char GPRS_PASSWORD[] = "";
// initialize the library instance
GSMSSLClient client;
GPRS gprs;
GSM gsmAccess;
char server[] = "arduino.cc";
char path[] = "/asciilogo.txt";
int port = 443;
void setup() {
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Starting Arduino web client.");
// connection state
bool connected = false;
// After starting the modem with GSM.begin()
// attach the shield to the GPRS network with the APN, login and password
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("connecting...");
// if you get a connection, report back via serial:
if (client.connect(server, port)) {
Serial.println("connected");
// Make a HTTP request:
client.print("GET ");
client.print(path);
client.println(" HTTP/1.1");
client.print("Host: ");
client.println(server);
client.println("Connection: close");
client.println();
} else {
// if you didn't get a connection to the server:
Serial.println("connection failed");
}
}
void loop() {
// if there are incoming bytes available
// from the server, read them and print them:
if (client.available()) {
char c = client.read();
Serial.print(c);
}
// if the server's disconnected, stop the client:
if (!client.available() && !client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
// do nothing forevermore:
for (;;)
;
}
}