Pages: [1]   Go Down
Author Topic: GSM shield hangs when reset/uploading code during GPRS connection  (Read 5214 times)
0 Members and 2 Guests are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, I have seen this a number of times now. When doing an upload of new code, the code is first compiled. Sometimes the previous code sets up a GPRS connection before the AtMega328 is reset for upload of the new code. Once that has happened the GSM module seems to blink it's Net-light as it is connected to a server and the STATUS light is always on. There is no way I can take control of the GSM modem. These are the things I have tried in the setup() routine that does not work:

--- Not working ---
client.shutdown(); //Pulses the POWER-key and is supposed to shut down the Quectel M10.
digitalWrite(3,LOW); //Sets the serial port low (forced break?)
client.stop(); //Claims in debug printing mode to send out +++ followed by AT+QICLOSE()
Pressing Reset //Only resets the ATMega328...
Pressing powerkey //No affect
The TestModem sketch // Prints "Starting modem test...ERROR, no modem answer."

--- working ---
Toggling power DO work ok.
Pulling Emergency_off low for a while. (This pin is not connected on the GSM Shield as it might destroy the modem if used at the wrong times according to the Quectel datasheets)

Please help! I can't have a modem that stops working if the bottom Arduino for some reason resets itself (i.e with a watchdog if there is an error)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have now run a program that wakes up the modem every five minutes to send up some temperature measurements values. After about 30 hours I noticed the same hang again. The modem, or maybe the GSM libraries does not seem to be able to resolve the connectivity problem. Modem just shines status led and blinks the other led as it is connected to a server... for hours... Any help appreciated! As it does not really help if the AVR is reseted as the modem is not connected to the reset line I'm kind of stuck...

I use theses libraries:

#include <GSM.h>
#include <OneWire.h> //Third pary library to read one-wire temp sensors
#include <LowPower.h> //Third party library to stop AVR for 8 seconds.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm checking it but, when you execute begin() the modem should be rebooted (that's the reason for the long pause when starting).

Just, can you switch on debugging doing:

GSM gsmAccess(true);

and post here the trace as dumped in the serial interface?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just, can you switch on debugging doing:

GSM gsmAccess(true);

It's still running (about 30 hours now), but I will try to force the problem later toady or tomorrow when time permits. What I did see last time it happened was that the pin toggling did not help and the debug printouts stopped after having written out the first "AT". I.e it did not attempt to send another AT-command either... just once after reset of the arduino part, then nothing... I used the synchrounous mode, but will switch to asynch mode later to be able to detect communication timeouts.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It hang again after about ~30 more hours. Here is my conclusion after a day of isolating the problem and how to trigger it:

Insert the Movistar sim-card into the GSM-shield. (I can't trigger this hang with my local Swedish operator Telia and their sim-cards.).

Upload the following dummy sketch to the board:
Code:
void setup() {
  pinMode(0,INPUT); //The CPU should not drive any pins, so make input
  pinMode(1,INPUT);
  pinMode(2,INPUT);
  pinMode(3,INPUT);
  pinMode(13,OUTPUT); //Only for visualization
}
void loop() {
  digitalWrite(13,HIGH); //Blink to show we are ok.
  delay(5000);
  digitalWrite(13,LOW);
  delay(200); 
}

Now, press the POWER-button on the GSM-shield in the same patterna as the LED blinks, that is: Hold it down for five seconds, then release button for a short time. Repeat this about ten times.

Try to turn off the GSM-module and it's STATUS-led by pressing the POWER-button as usual (2 seconds). It is not possible to turn it off.

-----
Here is a way to test out AT-commands on the module, and also showing that the communication with the GSM-module has been completely lost.

After the above code has been uploaded to the Arduino UNO (or similar), connect digital pin 0 to digital pin 3 and connect digital pin 1 to digital pin 2. Now a terminal program (i.e the Serial Monitor) can talk directly to the modem. In the normal state power on the GSM module by holding the POWER-button for 2 seconds so the STATUS-led lights up. Type "AT" and press the enter-key, you should se an "OK" from the modem.

Now do the above POWER-button toggling ten times with the timing described. Once the STATUS-led is not turning off, try to type "AT"+Enter. It is not possible to communicate with the modem.
----
How did we trigger this in a real test? well, we try to save power and did this after our gprs-connected session. After about 30 hours and 400 successfull times, it locks the modem.

Code:
Serial.println("Success! Shutting down...");
while (!gsmAccess.shutdown()); //Shutdown pulls the same line as the POWER-button... and here we repeat it, repeat it, repeat it...
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

EMERG_OFF pin must be connected if GPRS is activated on remote sites!
I just encountered the problem on a remote unit that used the new secure shutdown-code. I did another search and came upon this Application Note from Quactel: http://www.meraprojekt.com.pl/files/quectel/GSM_TCPIP_AN_V1.1.pdf

Quote
5.5.
Deactivate PDP context
Use AT+QIDEACT command to deactivate current PDP context.

AT+QIDEACT
//
If the context will not be used in a long period (for example more than one hour), it‟s recommended to close this context by command AT+QIDEACT. Normally the response time for this command is about 2-5 seconds. But when the network is very bad or in some abnormal conditions, the longest waiting time will achieve about 2.5 minutes. It‟s recommended to set timeout value which is less than 1 minute or less according to their applications. If it is timeout, users have not received DEACT OK, user can restart the module by EMERG_OFF pin.

My €0.02 on this is that at some locations this will never happen ( I have one unit up for a week now out in a field), but on some this will be frequent and completely lock the GSM-shield (8 hours and ~20 gprs connections after installation in another field, it locked)

This is my code and solution (after having issued a shutdown() and waited 12 seconds, then I call this):
Code:
void emergency_off() {
  //Connect a 470 ohm resistor between D8 and EMERG_OFF pin of Quectel module.
  //If signal D8 is high, then module is not powered off. Pull it down for 20 ms to kill module.
  if (digitalRead(8)) {
    Serial.println("EMERG OFF!");
    delay(12000); //Wait another 12 seconds just in case.
    digitalWrite(8,LOW);
    pinMode(8,OUTPUT);
    delay(30);
    pinMode(8,INPUT);
  }
}

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I Have the same proble, som times arduino lost the control of Quectel, arduino can't run program because is in some part of library GSM

the solution that I propouse is:
I have configuarted a WDT (count the time of GSM module inactivity) , before 1 minute the module not responds, arduino can reset by EMERG_OFF pin?

Where is that pin? 
It will work done?

Oriol
Logged

Kerala
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
 i wanna know how can i Access internet if m directly connecting the board to PC, i.e i wanna take net in PC using GSM modem.thanks in advance smiley 

Logged

Madrid (Spain)
Offline Offline
Full Member
***
Karma: 0
Posts: 137
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
 i wanna know how can i Access internet if m directly connecting the board to PC, i.e i wanna take net in PC using GSM modem.thanks in advance smiley 



This is only possible if someone develops a driver to manage the serial connection as a modem. Also, would need a special sketch.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Regarding transparent mode to talk to GSM module - Look up Arduino Phone project on Github. This sketch does it - https://github.com/damellis/cellphone2/tree/master/SerialProxy

Also have a look at the projects homepage for some other fun things to do with the modules!  http://web.media.mit.edu/~mellis/cellphone/index.html
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 80
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, after more than one year since your original post, are you still recommending this EMERG_OFF pin solution in order to avoid the GSM shield to hang?

Any other options?

Thanks
Logged

Pages: [1]   Go Up
Jump to: