Please help with GSM900 and Arduino Mega2560

Hi
I am running this GPRS Shield V1.0 shield http://www.seeedstudio.com/wiki/GPRS_Shield_V1.0 with a MEGA2560.
The library I use is GitHub - MarcoMartines/GSM-GPRS-GPS-Shield: GSM/GPRS & GPS Shield Library for modules using SIM900/SIM908 (Install Notes:
Download current release: Generic Version/current) and it has been set up for the Mega board. I am using Hardware serial with pin DO and D1 on the shield and pins 18 & 19 on the Mega.
When I run the GSM_GPRSLibrary_AT sketch I get this:

GSM Shield testing.
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:ELSE
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:ELSE
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:ELSE
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:AUTO BAUD RATE
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
Trying to force the baud-rate to 9600

1200
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

2400
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

4800
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

9600
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

19200
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

38400
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

57600
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

115200
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ERROR: SIM900 doesn't answer. Check power and serial pins in GSM.cpp

status=IDLE

I cannot find a solution to the communication issue. Has anyone has had this problem and how can it be fixed?.
Thank you :sweat_smile:
Regards
Luke

Hello,
I found the solution here:
http://www.elecfreaks.com/wiki/index.php?title=EFcom/GPRS_Shield_Guide

//SoftwareSerial mySerial(RX, TX)
//SoftwareSerial mySerial(50, smiley-cool; //OK
SoftwareSerial mySerial(50, 51); //OK

Henri

Hi
Thanks for your feedback. When I change the pins to RX/50 and TX/51 I get this when I run the GSM_GPRSLibrary_AT sketch

#include "SIM900.h"
#include <SoftwareSerial.h>
//#include "inetGSM.h"
//#include "sms.h"
//#include "call.h"

//To change pins for Software Serial, use the two lines in GSM.cpp.

//GSM Shield for Arduino
//www.open-electronics.org
//this code is based on the example of Arduino Labs.

//Simple sketch to communicate with SIM900 through AT commands.

//InetGSM inet;
//CallGSM call;
//SMSGSM sms;

int numdata;
char inSerial[40];
int i=0;


void setup() 
{
  //Serial connection.
  Serial.begin(9600);
  Serial.println("GSM Shield testing.");
  //Start configuration of shield with baudrate.
  //For http uses is raccomanded to use 4800 or slower.
  if (gsm.begin(9600))
    Serial.println("\nstatus=READY");
  else Serial.println("\nstatus=IDLE");
};

void loop() 
{
  //Read for new byte on serial hardware,
  //and write them on NewSoftSerial.
  serialhwread();
  //Read for new byte on NewSoftSerial.
  serialswread();
};

void serialhwread(){
  i=0;
  if (Serial.available() > 0){            
    while (Serial.available() > 0) {
      inSerial[i]=(Serial.read());
      delay(10);
      i++;      
    }
    
    inSerial[i]='\0';
    if(!strcmp(inSerial,"/END")){
      Serial.println("_");
      inSerial[0]=0x1a;
      inSerial[1]='\0';
      gsm.SimpleWriteln(inSerial);
    }
    //Send a saved AT command using serial port.
    if(!strcmp(inSerial,"TEST")){
      Serial.println("SIGNAL QUALITY");
      gsm.SimpleWriteln("AT+CSQ");
    } 
    else{
      Serial.println(inSerial);
      gsm.SimpleWriteln(inSerial);
    }    
    inSerial[0]='\0';
  }
}

void serialswread(){
  gsm.SimpleRead();
}
GSM Shield testing.
DB:NO RESP
DB:NO RESP
DB:NO RESP
Trying to force the baud-rate to 9600

1200
2400
4800
9600
19200
38400
57600
115200
ERROR: SIM900 doesn't answer. Check power and serial pins in GSM.cpp

status=IDLE

This pin change didn't help
Regards
Luke

Use the hardware Serial ports instead, i.e. Serial2 or Serial3

The answer that I gave you before did not work ?
myself, I dont use library,
Library are changing too many parameters that you dont particularly understand , especially Github
i only use commades Hays, I spend a lot of time to understand them,

at the beginning:

include <SoftwareSerial.h>

include <string.h>

include <print.h>

include <serial.h>

//SoftwareSerial mySerial(RX, TX)
SoftwareSerial mySerial(50, 51); //OK

Serial.begin (9600);
mySerial.begin (9600);
mySerial.print ("\ r"); / / Send a newline
delay (500);

reset command, made ??that sometimes , especially after using Github

mySerial.print ("AT & F \ r"); / / Reset factory
delay (2000);
mySerial.print ("AT + CNMI = 2,1,0,0,0 \ r"); / / VERY IMPORTANT! ! !
delay (2000);
mySerial.println ("AT + CSCA = " 33660003000 \ "145 \ r"); / / To fit for your supplier and your country
delay (2000);
mySerial.println ("AT + CSAS"); / / save config
delay (200);

mySerial.print ("AT + CLIP = 1 \ r"); / / To view the phone number
delay (1000);
mySerial.print ("AT + IPR = 9600 \ r"); / / Baud rate to 9600
delay (1000);
mySerial.print ("AT + JEEC = 1 \ r"); / / For the extended errors

my favorite pages on the subject :

http://www.simcom.ee/modules/gsm-gprs/sim900/ for SIM900 AT Command Manual V1.09.pdf
GSM Equipment error codes explained
http://www.cooking-hacks.com/skin/frontend/default/cooking/pdf/SIM900_AT_Command_Manual.pdf

Dont get discouraged, it's dificult to start but then it's just fun
Henri

Henrigp:
The answer that I gave you before did not work ?
myself, I dont use library,
Library are changing too many parameters that you dont particularly understand , especially Github
i only use commades Hays, I spend a lot of time to understand them,

at the beginning:

include <SoftwareSerial.h>

include <string.h>

include <print.h>

include <serial.h>

//SoftwareSerial mySerial(RX, TX)
SoftwareSerial mySerial(50, 51); //OK

Serial.begin (9600);
mySerial.begin (9600);
mySerial.print ("\ r"); / / Send a newline
delay (500);

reset command, made ??that sometimes , especially after using Github

mySerial.print ("AT & F \ r"); / / Reset factory
delay (2000);
mySerial.print ("AT + CNMI = 2,1,0,0,0 \ r"); / / VERY IMPORTANT! ! !
delay (2000);
mySerial.println ("AT + CSCA = " 33660003000 \ "145 \ r"); / / To fit for your supplier and your country
delay (2000);
mySerial.println ("AT + CSAS"); / / save config
delay (200);

mySerial.print ("AT + CLIP = 1 \ r"); / / To view the phone number
delay (1000);
mySerial.print ("AT + IPR = 9600 \ r"); / / Baud rate to 9600
delay (1000);
mySerial.print ("AT + JEEC = 1 \ r"); / / For the extended errors

my favorite pages on the subject :
Short Message Service / SMS Tutorial
http://www.simcom.ee/modules/gsm-gprs/sim900/ for SIM900 AT Command Manual V1.09.pdf
GSM Equipment error codes explained
http://www.cooking-hacks.com/skin/frontend/default/cooking/pdf/SIM900_AT_Command_Manual.pdf

Dont get discouraged, it's dificult to start but then it's just fun
Henri

How would you read the GSM response when issuing an AT command to the module?
i.e. let's say I want to test the signal quality, with "AT+CSQ", how would I read the response back into the Arduino code, to be able to do something else with it?

i.e. (non working code):

if (AT+CSQ == > 10 )
{
Serial.println("Signal too weak");
}

If you are using Arduino Mega 2560, follow these steps.
[1] How to switch between Arduino Mega and Arduino Uno?

Open GSM.h and comment-decomment the appropriate lines like below
e.g. for Arduino Mega
//#define UNO
#define MEGA

If you use Arduino Uno comment the line in HWSerial.h or decomment if
you are using Arduino Mega
e.g. for Arduino Mega
#define MEGA

Save and compile

[2] How to switch between the old shield (that uses 4 and 5 pins for
SoftwareSerial and the new (that used 2 and 3 pins)?

Open GSM.cpp and comment-decomment the appropriate lines like below
e.g. for the new one

//#define GSM_TXPIN 4
//#define GSM_RXPIN 5
#define GSM_TXPIN 2
#define GSM_RXPIN 3

Save and compile

Connect the RX pin of your sim module to pin 18 of your arduino mega and the TX pin to pin 19 of the arduino mega. This is because the library uses Hardware serial for mega. Connect VIO pin of your sim module to IOREF pin of your arduino mega and the connect the GND of your sim module to GND of your arduino mega. That's all.