Go Down

Topic: Connecting to GSM/GPRS unstable, eventually hangs (Read 44248 times) previous topic - next topic

stoutfiles

Does everyone here have the 3 second connected light when running this code?

ghen

This will do the trick with connectivity problems.
No GSM library modification needed.

Also make sure your BAUD rate for serial is high enough. GSM library in debug mode generates tons of messages. And Serial buffer is only 64 bytes.


Code: [Select]


  GSM                    gsmAccess(true);          // 'true' -> debug enabled
  GPRS                   gprs;
  GSMClient              client;

  GSM3_NetworkStatus_t   gsmStatus;
  GSM3_NetworkStatus_t   gprsStatus;


  Serial.begin(28800);                           // NOTE: Low BAUD rate leads to buffer overflow
  Serial.println("Starting up ...");             //       when there are a lot of DEBUG messages.
  Serial.flush();



  Serial.println("Connecting to GSM network ...");
  Serial.flush();

  // IMPORTANT: do not reset (false) and do not wait for ready state (false)
  //            E.g. call it async. We will pull for the ready state on our own.
  gsmStatus = gsmAccess.begin(GSM_PIN_NO, false, false);

  int retrycount = 60;
  while (gsmStatus != GSM_READY && retrycount-- > 0) {
    delay(1000);                                // lower delay value could lead to unstable state
   
    theGSM3ShieldV1ModemCore.manageReceivedData();
    gsmStatus = gsmAccess.getStatus();
  }

  if (gsmStatus != GSM_READY) {
    Serial.println("[ERR]: GSM connection failed");
    Serial.flush();
    goto exit;
  }
 
  Serial.println(" [DONE]");




  Serial.println("Connecting to GPRS ...");
  Serial.flush();

  // IMPORTANT: do not wait for ready state (false)
  //            E.g. call it async. We will pull for the ready state on our own.
  gprsStatus = gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD, false);

  int retrycount = 60;
  while (gprsStatus != GPRS_READY && retrycount-- > 0) {
    delay(1000);                                // lower delay value could lead to unstable state
   
    theGSM3ShieldV1ModemCore.manageReceivedData();
    gprsStatus = gprs.getStatus();
  }

  if (gprsStatus != GPRS_READY) {
    Serial.println("[ERR]: GPRS connection failed");
    Serial.flush();
    goto exit;
  }
 
  Serial.println(" [DONE]");



 
  // TODO: do your stuff here
  ...



exit:
  Serial.println("Shutting down GSM modem ...");
  Serial.flush()
 
  gsmAccess.shutdown();
  delay(250);
 
  // NOTE: There is an error in the schematic of the GSM Shield on the A_TX.
  //       You can find more info here: http://forum.arduino.cc/index.php?topic=158811.0
  //       and the way to fix it is to add digitalWrite(3,LOW); after the gsm.shutdown().
  digitalWrite(PIN_GSM_TX, LOW);



Maarten123

#17
Mar 30, 2015, 10:11 am Last Edit: Mar 30, 2015, 10:12 am by Maarten123
hi, is there a reason why this only works when the debug mode is true?

rahayukristiyanti

guys, i need help, how can i modify the GSM3ShieldV1AccessProvider.cpp? because i didnt find this file to edit

Leonairo

#19
Dec 15, 2015, 01:25 pm Last Edit: Dec 15, 2015, 08:05 pm by Leonairo
I started to use the GSM Shield V2 and a Mega but facing same problems as in this topic..


My project can make a connection but after a day... some times a few days it hangs..


It looks like when the GSM connection is lost the Shield can't make a new connection..
Also when i load a newer version i have to reset the card... in the debug everything seems ok with the at commands but... can't make the connection and the trying loop go's on and on...

Is there a solution for this, or where can i find the code to use the watchdog so i can do a reset to the card ? 

Looking for some help over here because the whole idea to use a Arduino for the project seems to fall appart with this GSM shield...    with the ethernet shield i do not face the problem with this project... :(     

Leonairo

I have captured the moment where the Board starts to hang up..   ( please some assistance )


 +++AT+QICLOSE%13%
45 45>
.............

connecting...

AT+QIDNSIP=1%13%
45 51>%13%%10%OK%13%%10%
AT+QIOPEN="TCP","XXX.XXXXXXXXX.XX",80%13%
51 57>%13%%10%OK%13%%10%

51 68>%13%%10%OK%13%%10%%13%%10%CONNECT%13%%10%
Status ? NIC
GET http://XXX.XXXXXXXX.XX/tellingenapp/status.do?site=site=018-003&locatie=1 HTTP/1.0%13%%10%Connection: close%13%%10%%13%%10%End Message

disconnecting.
==================


68 64>HTTP/1.1 200 OK%13%%10%Access-Control-Allow-Origin: *%13%%10%Access-Control-Allow-Methods: GET,POST,DELETE%13%%10%Access-



and then only blanc field scrolling... and system is dead...


santhya

my modem doesn't reply no answer when call is not answered.

Go Up