Hello,
I'm in trouble using the GSM Shield.
I'm trying to use the shield to monitor data from a device (wind turbine actually).
The problem is that it works for 12 hours and then stops with a +PDP DEACT message.
Then I receive errors when trying to send new HTTP request. So I detect the "ERROR" message and tried to reconnect but it's not working. The AT comand looks unresponsive and I'm blocked in the gsm.begin routine when trying to reconnect.
Here is the code to reconnect and what I get on the terminal.
CODE :
boolean Reconnect (void)
{
unsigned int timeout;
boolean notConnected = true;
//Reset Modem
gsmAccess.shutdown();
delay(12000);
//Trying new connection
Serial.println("GSM Connect...");
timeout = 0;
GSMstatus=0;
theGSM3ShieldV1ModemCore.println("AT"); //read that in some case resolve problem on gsm.begin ...
while(GSMstatus!=GSM_READY && timeout<15)
{
GSMstatus = gsmAccess.begin();
delay(3000);
timeout++;
}
if(GSMstatus==GSM_READY)
{
Serial.println("GSM OK");
Serial.println("Connect network...");
timeout = 0;
while(notConnected && timeout<10)
{
timeout++;
Serial.println("attach...");
if((gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
{
Serial.println("Connected");
notConnected = false;
return true;
}
else
{
Serial.println("Not connected");
delay(1000);
}
}
}
else
{
Serial.println("GSM NOK");
}
return false;
}
TERMINAL : (it occurs after working well during 12h)
------ Sending Data : ------
POST /api:v1/stack/alias HTTP/1.1%13%%10%Host: m2.exosite.com%13%%10%X-Exosite-CIK: 41b73dbcccb85f51bad8fcd21658%13%%10%Content-Type: application/x-www-form-urlencoded; charset=utf-8%13%%10%Content-Length: 115%13%%10%%13%%10%anemo1= 0.00&PHours=0&WHours=0&TotProd=0&PwINV=0&PwAFE=0&PwVirt=0&FrINV= 0.00&FrAFE= 0.00&angle=0&ASYS=0&AESYS=0%13%%10%anemo1= 0.00&PHours=0&WHours=0&TotProd=0&PwINV=0&PwAFE=0&PwVirt=0&FrINV= 0.00&FrAFE= 0.00&angle=0&ASYS=0&AESYS=0
108 102>HTTP/1.1 204 No Content%13%%10%Date: Wed, 22 Oct 2014 08:15:54 GMT%13%%10%Content-Length: 0%13%%10%Connection: keep-alive%13%%10%Server: nginx%13%%10%%13%%10%
HTTP/1.1 204 No Content
Date: Wed, 22 Oct 2014 08:15:54 GMT
Content-Length: 0
Connection: keep-alive
Server: nginx
102 116>%13%%10%+PDP DEACT%13%%10%
+PDP DEACT
------ Sending Data : ------
POST /api:v1/stack/alias HTTP/1.1%13%%10%Host: m2.exosite.com%13%%10%X-Exosite-CIK: 41b73dbcccb85f51bad8fcd21658%13%%10%Content-Type: application/x-www-form-urlencoded; charset=utf-8%13%%10%Content-Length: 115%13%%10%%13%%10%anemo1= 0.00&PHours=0&WHours=0&TotProd=0&PwINV=0&PwAFE=0&PwVirt=0&FrINV= 0.00&FrAFE= 0.00&angle=0&ASYS=0&AESYS=0%13%%10%anemo1= 0.00&PHours=0&WHours=0&TotProd=0&PwINV=0&PwAFE=0&PwVirt=0&FrINV= 0.00&FrAFE= 0.00&angle=0&ASYS=0&AESYS=0
116 125>%13%%10%ERROR%13%%10%
ERROR
Trying to Reconnect
GSM Connect...
AT%13%%10%AT%13%
If somebody know why I receive the PDP DEACT ? It seems that it should be caused by a detach but I never called this function.
Why I m not able to reconnect ?
Thanks for your help !!