Forum >incomplete response from GPS/GPRS SIM908
General

incomplete response from GPS/GPRS SIM908

userHead wahmalik85 2014-02-12 01:04:45 6642 Views7 Replies
Hi all,

I faced many problems when using GPS/GPRS SIM908 with UNO Arduino and I do not why?
One of these problems is I get incomplete response.
I try to read all SMS that are in inbox using this AT command:

[quote]AT+CMGL="ALL"[/quote]

it supposed to list all messages that are in card inbox.
but what I get is only like this:
Code: Select all
AT+CMGL="ALL"
+CMGL: 1,"REC READ","73xxxxxxx","","14/02/09,2
the full code:
Code: Select all
byte gsmDriverPin[3] = {
3,4,5};
void setup()
{
//Init the driver pins for GSM function
for(int i = 0 ; i < 3; i++){
pinMode(gsmDriverPin[i],OUTPUT);
}
/*pinMode(ledpin,OUTPUT);*/
Serial.begin(9600); //set the baud rate
digitalWrite(5,HIGH); //Output GSM Timing
delay(1500);
digitalWrite(5,LOW);
digitalWrite(3,LOW); //Enable the GSM mode
digitalWrite(4,HIGH); //Disable the GPS mode
delay(2000);
delay(5000); //call ready
//Serial.println("AT+CMGD=1,4"); //Delete all SMS in box
Serial.println("AT");
delay(1500);
while( Serial.available() > 0)
{
Serial.read(); // Clean the input buffer
}
Serial.println("AT+CMGL=\"ALL\"");
delay(1000);
}
void loop()
{
if(Serial.available()>0)
{
while (Serial.available() > 0){
Serial.print((char)Serial.read());
}
}
Serial.print("---- ");
delay(10000);
}
Many thanks :)
2014-02-19 00:43:37 Great!

Thanks for sharing!
I would usually decrease the buffer to gain more RAM size, but it certainly helps to figure out where the problem is.
I suggest you get the buffer back to what it was and change your Serial.read and serial print function so it empties the buffer fast enough and clears it, then keeps printing if there is more to it.

Increasing the buffer would lead you to much less SRAM, and will most likely get you into trouble later on. Since SRAM is quite small, and its not very easy to detect when you run out of memory..
userHeadPic Jose
2014-02-19 00:15:45 Thank you Jose,

I increased the buffer size to 128 and I get the full message.
userHeadPic wahmalik85
2014-02-13 16:56:46 Great! hope the tool provides much help. Check out the right side as it shows you the at commands used, is very useful for coding your sketch.

For the serial buffer.. I think I've seen much cleaner way, but this is one possible way:
http://youtu.be/Aqc1SAtIJeU

Note, while this is good for testing, it can potentially affect Arduino's performance, so I suggest you to try but if it fix the issue, use another solution.
userHeadPic Jose
2014-02-13 03:21:50 [quote="Jose"]
I believe this is is caused because the shield is already initialized. Try to reset the shield once before using it and waiting for the LEDs to shut down.
[/quote]

The tool work now after yours note, thank you.

[quote="Jose"]
As for the message, I am thinking.. Could it be because the Serial buffer is full?
Do you get the whole list when manually inputting the AT commands?
[/quote]

from the tool, all 3 messages were read successfully, so is the problem from the serial buffer size?

I deleted 2 messages and left one message on the inbox and the problem still occurred.
userHeadPic wahmalik85
2014-02-12 04:25:50
Code: Select all
[code author=wahmalik85 ]
Sending AT query..
Invalid or no response from the device. Please check the modem port and the baud rate.Disconnecting port COM4.
I believe this is is caused because the shield is already initialized. Try to reset the shield once before using it and waiting for the LEDs to shut down.

As for the message, I am thinking.. Could it be because the Serial buffer is full?
Do you get the whole list when manually inputting the AT commands?
userHeadPic Jose
2014-02-12 03:43:16 Thank you Jose for your replay.

I tried the tool, and it couldn't to connect with the Arduino.
Code: Select all
Sending AT query..
Invalid or no response from the device. Please check the modem port and the baud rate.Disconnecting port COM4.
There are more than 2 messages in the inbox but what I get from the serial is what I mention before.
The output corrupted before the message body.

userHeadPic wahmalik85
2014-02-12 01:50:13 Hello Malik,

Have you tried this tool?:
http://m2msupport.net/m2msupport/module-tester/

It seems the command works fine, my guess is that you have 1 message stored available.

If you are expecting more messages, you might want to check if the other messages have arrived or not and that they have not being deleted.

Cheers^^
userHeadPic Jose