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:
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.
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
I was curious, how does increasing that buffer affects the sms sending functionality. One line of code is not really explaining anything
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