Arduino version: 1.8.11
Environment: Windows 10 desktop
SAMD boards version: 1.8.9
Hello, I am trying to just get the board (MKR GSM 1400) to connect by following various boiler plate code examples available from hologram.io or other threads.
I have separated the GSM and GPRS functions to help with debugging. I have the device plugged into USB and an antenna plugged in as well. I am not supplying external power. I have tried:
gsmAccess.begin();
gsmAccess.begin(PINNUMBER);
gsmAccess.begin(true, false);
Out of the last 4 hours I have been messing with this, it connected once. GPRS never did. when I restarted the board, GSM never successfully began ever again. I get the following debug output repeatedly:
OK
AT+CREG?
+CREG: 0,0
Here is the code:
#include <MKRGSM.h>
const char PINNUMBER[] = " ";
const char GPRS_APN[] = "hologram";
const char GPRS_LOGIN[] = " ";
const char GPRS_PASSWORD[] = " ";
// these are irrelevant since the device cant access the network to begin with
// String HOLOGRAM_DEVICE_KEY = "1234abcd";
// String HOLOGRAM_MESSAGE = "Your Message here";
// String HOLOGRAM_TOPIC = "TOPIC";
// Hologram's Embedded API (https://hologram.io/docs/reference/cloud/embedded/) URL and port
// char server[] = "cloudsocket.hologram.io";
// int port = 9999;
// initialize the library instance
GSMClient client;
GPRS gprs;
GSM gsmAccess(true); //true to enable debugging
bool flag = false;
int gsmBeginStatus;
int gprsAttachStatus;
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {};
Serial.println("Starting Arduino web client.");
// connection state
boolean connected = false;
while (!connected)
{
Serial.println("Begin gsm Access");
gsmBeginStatus = gsmAccess.begin();
if ((gsmBeginStatus == GSM_READY))
{
Serial.println("gsm access success!");
flag = true;
}
else
{
Serial.println("gsm failed to begin.");
}
if(flag)
{
Serial.println("attaching gprs...");
//delay(2000); //tried with and without delays
gprsAttachStatus = gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD);
if(gprsAttachStatus == GPRS_READY)
{
connected = true;
Serial.println("gprs attached!");
}
else
{
Serial.println("gprs failure.");
}
}
else
{
Serial.println("Not connected");
delay(1000);
}
}
Serial.println("setup complete.");
}
// the loop function runs over and over again forever
void loop()
{
}
??? Please help. Thanks in advance.