1
votes

I am using a SIM900 module with my Arduino and it is missing characters although it is returning the right number of characters expected. I have ERROR on AT+SAPBR=1,1 and AT+HTTPINIT so I am not sure if this is the reason for it. Im not sure how to fix these issues either.

AT+CGATT?

+CGATT: 1

OK
AT+CGATT=1

OK
AT+SAPBR=3,1,"CONTYPE","GPRS"

OK
AT+SAPBR=3,1,"APN","mobile.o2.co.uk"

OK
AT+SAPBR=1,1

ERROR
AT+HTTPINIT

ERROR
AT+HTTPPARA="URL","http://www.xxxxxxxxxxx.com/temp/"

OK
AT+HTTPACTION=0

OK

+HTTPACTION:1,200,56
AT+HTTPREAD

+HTTPREAD:56
{"type":"dOK

My function that reads characters as they come in:

void whileAvailable() {
  char data;
  while (SIM900.available()) {
    data=SIM900.read();
    if (data>0) Serial.print(data);
  }
}

I believe the function is reading characters fine however I am not sure why it is failing the find the rest of the characters

2
Although this may highly be a buffer overflow, it is NOT the only reason. The web site answering the request causes it also (the response headers). Most probably above code works for google.com.hk but not for your site.karanis

2 Answers

0
votes

This is due to Serial buffer overflow of arduino uno or mega you use. Increase the buffer size so that they will accommodate more bytes; and those data can be displayed.

0
votes

You need to shut down AT+SAPBR and AT+HTTPINIT modes

Try this : AT+SAPBR=0,1

       AT+HTTPTERM