Rephone Geo Kit: Disconnect vom GSM after SMS send

Hi,
I try to to build the tracable dog collar:

seeedstudio.com/recipe/424-r … ollar.html

Besides the GPS problem everything works fine until the Rephone sends the SMS. Sometimes it works for two or three SMS but usually it only works for one SMS. After that the connection get lost.

I connected the Rephone to PC and tried to debug via serial monitor.
Thats what I noticed:

COM3 is for the serial connection on my pc.
COM4 is for uploading the sketches.

When receiving phone calls or SMS everything works fine.
Serial Monitor:

[*]Call come in, number is +491752374385

Call come in, number is +49175*******

Get new sms, content: GPS, number: +49175*******

GPS list:
UTC:80-1-12 5:2:16,
latitude: -:0.000000,
longitude: -:0.000000,
altitude: 0.000000,
speed: 0.000000,
course: 0.000000.

GPS data is OK, the test is inside the house.

After the SMS is send the COM3 and COM4 connection gets disconnected and device manager shows an empty COM5 for a few seconds. After that the COM5 gets disconnected again and COM3 and COM4 is correctly shown again.

But after that “connection lost” the Rephone will not answer any calls or receive any SMS until a reboot.

Any ideas??

Thx a lot

Change the following line of code and give it a try:

char buffer[100] = {0,};

to

char buffer[200] = {0,};

Works fine now!

Thank you so much!

Ok, what does it affect and where?

The array buffer is used to store the contents coming from the GPS module. The contents that it was trying to store was a lot more than 100 characters. Therefore, increasing the array size solves the issue.

I’m familiar with buffers, thanks :slight_smile:
I was curious, how does increasing that buffer affects the sms sending functionality. One line of code is not really explaining anything :smiley:

I am sure that you already know this - in C/C++ there is no boundary check for array. The variable buffer was declared with a size of 100, but in the sprintf statement, it was trying to store about 135 characters. As about 35 characters were stored in an out of bound location, from time to time, it was putting the module in an unstable position, which probably was causing the issue here. By declaring the array with a larger size, it is ensuring that there isn’t any memory leak, and therefore, the module is functioning in a stable state, which includes the SMS transmission part.

As I don’t know any way to debug the code (line by line) inside the Arduino IDE, I cannot guarantee that it was the sole cause of the bug, but as we can see here, increasing the size of the array solved the problem for the OP.

As I don’t know any way to debug the code (line by line) inside the Arduino IDE
Don’t worry, native C/C++ code is also almost impossible to debug on this platform :wink:

Thank you for the effort!