0
votes

I'm completely new to Arduino, so please forgive me if something I ask here sounds stupid. So I have this Arduino UNO & Arduino compatible GSM-GPRS-GPS Simcomm SIM808 module that I'm working with. I want it to communicate with a Web server, but I can't even get it to start.

Following is my Arduino code:

#include<SoftwareSerial.h>

SoftwareSerial mySerial(2,3);




void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  mySerial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println("Starting GSM...");
  mySerial.println("AT");
  Serial.println(getResponse());
  mySerial.println("AT+CSTT=\"TATA.DOCOMO.INTERNET\",\"\",\"\"");
  Serial.println(getResponse());
  mySerial.println("AT+CIFSR");
  Serial.println(getResponse());
}

String getResponse(){
  while(!mySerial.available()>0);
  return mySerial.readString();
}

And this is what I'm getting:

Starting GSM...
AT

OK

AT+CSTT="TATA.DGCOMO.INTERNET","",""

ERROR
ÿ
AT+CIFSR

ERROR

Starting GSM...
AT

OK

AT+CSTT="TATA.DOCOMO.INTERNET","",""

ERROR

AT+CIFSR

ERROR

Starting GSM...
AT

OK

AT+CSTT="TATA.DOCOMO.INTERNET","",""

ERROR

AT+CIFSR

ERROR
ÿÿÿÿ
Starting GSM...
AT

OK
ÿ
AT+CSTT="TATA.DOCOMO.INTERNET","",""

ERROR

AT+CIFSR

ERROR

I have no clue why it's happening & why I'm getting those ÿÿ in the result.

2
While I cannot say why AT+CSTT fails, I can give some tip on how to fix your response handling (which at least is present, good start). Using while(!mySerial.available()>0) will never work reliably; it is doomed to fail on you sooner or later. You must change to parse the response from the modem on a strict line by line basis. If the modem only sends you half a line you should block until the complete line is received. See this answer for details.hlovdal
You might get some useful details in the error responses by running AT+CMEE=2, although be aware that sometimes they are not that accurately describing the core problem and must be taken with a grain of salt.hlovdal
What is firmware version of SIM808? how about putting some delay between AT commands and serial response?Studuino

2 Answers

0
votes

ÿÿÿÿ This string appears when you restarts the SIM modem since you are getting it in the middle of your program, it is probably caused by insufficient power supply.

0
votes

I had the same problem where I received ERROR after executing AT+CSTT="APN" . The APN cannot be changed when AT+CIPSTATUS is in "IP START" state. Deactivate the PDP Context with AT+CIPSHUT so that the AT+CIPSTATUS is in "IP INITIAL" state. Then run the AT+CSTT="APN" again.