Spreadstrum SM5100B-D w/ Arduino Mega2560 w/ TCP connection

Hello

I can not get a TCP response with Spreadstrum SM5100B-D on Arduino Mega2560.

Even though someone may claim I wont be able to keep up with the GPRS module spitting data too fast for the baudrate 9600 on Serial1, it is the only baudrate that enables the module to work. I tested them all.
The power supply is enough and I got UDP connections to work well.

The sketch uses SDATATSEND to send data, and SDATAREAD to read data from the socket. When SDATATREAD is used (notice the "T" in the middle), a response with no data of "+SSTR:1," is caught by the serial. Since I want the output to come as "+SDATA:1,,", the sketch uses SDATAREAD instead.

The HTTP server is able to respond to the GET request. I was able to monitor this in a controlled environment.

For SDATAREAD, the following attempts were tried to get something like this "+SDATA:1,,":

  • immediately after receiving "+STCPD:1" do "Serial1.println("AT+SDATAREAD=1");" (code for this one is commented below, it should work after uncomment). Please note that I do get "+STCPD:1" in many attempts, I am just not able to read the actual response, but it is saying there is one available.
  • immediately after all sent bytes be acknowledged do "Serial1.println("AT+SDATAREAD=1");"
  • immediately after "+STCPC:1" do "Serial1.println("AT+SDATAREAD=1");"
  • many different delay combinations were tried.

All occurrences of SDATA are looking like this: "+SDATA: 1,0," , which means there are no available bytes to be read upon.
The program finalizes with the number of available bytes of the response. If the response has more than 0 available bytes, it can be a successful response.

To try this sketch, the following command must be modified to match the internet provider requirements:
Serial1.println("AT+CGPCO=0,"internet","internet",1"); // these are the parameters for my internet provider. Please change them to mach yours

Any hints on which may be the problem here?
If someone has a TCP connection sketch working and could make it available, I would be most appreciated.

The sketch and serial monitor output follows as attachment.

gprs2.pde (6.71 KB)

serial_monitor_output.rtf (1.38 KB)