solved: GSM hanging: check for autobaud


I had a long fight with my GSM shield which most time was hanging at the very beginning and could not connect to the net. I am telling here the whole story because it might help somebody else with a similar problem.

The location where the software was hanging was the call gsmAccess.begin(PINNUMBER) within setup():

if (gsmAccess.begin(PINNUMBER) == GSM_READY)
      notConnected = false;
      Serial.println("Not connected");

I edited the function GSM3ShieldV1AccessProvider::begin() with a timeout counter as proposed in this forum. The result was that the serial monitor showed "Not connected" all the time.

I checked the antenna and tried to improve it because a posting in this forum told me that a low signal could cause the software hanging. No improvement.

The tip that the GSM library has a debugging mode, an example sketch how to send AT commands manually via the serial monitor and studying the M10 manual brought the solution:

The debugging mode can be switch on with "true" in the constructor

GSM gsmAccess(true);  // true for debugging

Then all commands to the GSM shield and all responses are printed on the serial monitor.

The only print out was


which is the string sent by the GSM library, and on which the GSM shield usually shall detect the baud rate, according to M10 manual.
But there was no response.

Now it was clear that the GSM shield cannot communicate with my Mega2560 because the autobaud function obviously did not recognize the baud rate.

With the sketch from
I sent "at" so many times until autobaud detected 9600 baud. Then I fixed this baud rate with the command "AT&W" and the shield is starting with 9600 baud (hopefully it will do it forever).

This problem took me a lot of time but now the GSM shield works fine and I am happy :slight_smile: