Go Down

Topic: GSM Shield V2 - Problems with "freezing within code"! (Read 1 time) previous topic - next topic

MindCode

Hello Arduino Community,

I'am working on a Car-Alarm project and for this
I bought the Orginial GSM Shield V2 from Arduino.
I'am using it with the Original Arduino Mega 2650.

I have to admit that I'am dissapointed:
This GSM Shield is very expensiv compared to the
Arduino Board itself and it won't work properly.

Here is the Problem:

It seems that sometimes, while Arduino Mega
acting with the Shield, that it gets stuck in the GSM
library (I'ive got the latest version 1.0.4).

Sometimes if the Shield gets a Call it just freezes
that moment where the Call comes in. In this case
its ringing and ringing and nothing more will happen
after that... I have to reset the whole board.

if (vcs.getvoiceCallStatus() == 2) // This is where I get stuck!
(Further code will not be executed)

In addition the same thing happens on this:

callState = vcs.voiceCall(remoteNumber);

By the way, it doesnt matter how I do it. Even with the example codes
from Arduino I get sometimes stuck and have to reset the Board.

So this is a very inconvenient circumstance, since I am
doing a Call to activate the Alarm or in order to disable it.
Also it makes a Call to inform me about that the Alarm
has been triggered. After the call it may happen that
he stucks in his call and the Alarm wont turn off after
a minute. It just doing the Alarm forever...

The behaivor of these errors seems to be (for me) absolutley
random and I can't see the reason why.

Additional information:
I'am running the whole board on the cars battery (12V) and
a voltage regulator down to 9V (5 Volt may be possible too)

robtillaart

Moderator: removed cross post in network section.

With respect to the problem:

- The voltage regulator of the Arduino should be capable of handling the voltage

- can you provide a link to the version of the library you use + the complete code + schematics, then we can check if there is some blocking condition possible or an HW problem.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


MindCode

New Code, same problem. Eventually the Arduiono board and GSM Shield just freezes:

#include <GSM.h>
#define PINNUMBER "7322"

GSM gsmAccess;
GSMVoiceCall vcs;

int AlarmCount = 0;   // Für spätere Zwecke evtl...
bool AlarmIstDa = 0;
int Alarm = 53;       // Ob Alarm gekommen ist oder nicht
int AlarmState = 51;  // Alarm an oder Aus. ACHTUNG: 0 = ALARM SOLL AKTIV SEIN ; 1 = ALARM DEAKTIV!
boolean Toggle = 0;   // Am Anfang nach dem Einschalten, Alarm erstmal Aktivieren!

char numtel[20];
char remoteNumber[20] = "0171xxxxxxx";

void setup()
{
  Serial.begin(9600);
  pinMode(Alarm, INPUT);
  pinMode(AlarmState, OUTPUT);
  pinMode(49, OUTPUT);
  digitalWrite(AlarmState, Toggle);
Serial.println("Connecting GSM");
  boolean notConnected = true;
  while (notConnected)
  {
    Serial.println("gsmAcc.begin Pinnummer...");
    if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
      notConnected = false;
      Serial.println("LOS GEHTS");}
    else
    {
      Serial.println("Fehler.. retry");
      delay(1000);
    }
  }
  Serial.println("FIRST HANGCALL");
  vcs.hangCall(); // This makes sure the modem correctly reports incoming events
  Serial.println("READY TO LOOP");
}

void loop()
{
digitalWrite(49,HIGH);
  if (digitalRead(Alarm) == LOW)
  {
    AlarmIstDa = 0;
    delay(100);
  }

  if (digitalRead(Alarm) == HIGH && AlarmIstDa == 0)
  {
    AlarmIstDa = 1;
    AlarmCount = AlarmCount + 1;
    vcs.voiceCall(remoteNumber);
    delay(15000);
    vcs.hangCall();
  }

  switch (vcs.getvoiceCallStatus())
  {
    case IDLE_CALL: // Nothing is happening
      break;
    case RECEIVINGCALL: // Yes! Someone is calling us
      vcs.retrieveCallingNumber(numtel, 20); // Retrieve the calling number
      Toggle = !Toggle;
      Serial.print("ALARM: ");
      Serial.println(Toggle);
      digitalWrite(AlarmState, Toggle); //0 = ALARM AN; 1 = ALARM AUS;

      vcs.hangCall();
      break;
  }

  delay(1000);
}


Go Up