Problems with CIPSEND cmd in GPRS shield

Hi!

I am trying for hours now to get my SIM900 working, but I am stuck with a problem, which I can’t solve.

It’s no problem to get the connection to a server using CIPSTART, I receive OK and than CONNECT OK. I also get a welcome message from my emailserver after this connect. After that command I send an AT+CIPSEND, wait for the “>” and enter the text, which I want to send. After this text I send “\r\n” and (0x26) for STRG-Z.

After that I do not get anything back from the server. It seems as if my server does not get the data. What am I doing wrong?

Any help is very welcome!
Thank you
Wolfgang

I think your emailserver have its owm data form, you need to send the data form so that it can receive, like send data to Pachube.

Hi jimbo!

Thank you for your answer. I’ve tried with TELNET too and I am able to simulate everything i like using Telnet, but not from the SIM.
I also used the Pachube sample to send a request to my own webserver. Tried with SMTP, POP, HTTP. The same problem here. I do not get the CIPSEND data to my server. I tried with two different SIM cards.

Is there a less complex example for testing my SIM900? Getting a header from google, or something else, which I could try? I am not sure if it’s my error, or if there is something wrong with my sim.

Best regards
Wolfgang

I’ve now managed to simulate the command sequences using Tera Term Web 3.1 a Terminal program which is able to do the communication with my arduino.

I also tried Term V19b -> does not receive and transmit anything, also hterm or hyperterminal do not transfer any data with the arduino when the GPRS shield is installed. - I do not understand why?

But I’ve still the problem to transmit the data from arduino code to the server.

The sample from the garden exits the CIPSEND this way:

GPRS_Serial.print("\r\n"); delay(300); GPRS_Serial.print("\r\n"); delay(300); GPRS_Serial.print(0x26); delay(300); //Send End Of Line Character to send all the data and close connection

The print(0x26) should send the CTRL-Z commando to the modem.

It seems, as if this codelines do not work for me. - I now have found an ASCII table at http://www.cs.tut.fi/~jkorpela/chars/c0.html which lists CTRL-Z as dezimal 26 and hex 1A. I tried to send (0x1A) too, but it didn’t work too.

This is the code, what’s wrong with it? Why isn’t the data sent?

[code] GPRS_Serial.flush();
GPRS_Serial.println(“AT+CIPSEND”); //Start data through TCP connection
Serial.println(“AT+CIPSEND Sent!”);
if(GPRS_Serial_wait_for_bytes(1,100) == 0)
{
Serial.println(“Timeout”);
goto loop_start;
}
else
{
Serial.print(“Received:”);
while(GPRS_Serial.available()!=0)
{
Serial.print((unsigned char)GPRS_Serial.read());
}
Serial.print("\n");
}

GPRS_Serial.flush();
delay(500);

GPRS_Serial.print(“PUT /data/data.php?d=GPRS;1;2;3;4\r\n”);
Serial.println(“PUT /data/data.php?d=GPRS;1;2;3;4 Sent!”);
delay(300);

GPRS_Serial.print(“Host: myhost.at\r\n”);
Serial.print(“Host: myhost.at Sent!”);
delay(300);

delay(300);
GPRS_Serial.print("\r\n");
Serial.print(“CR-LF Sent!”);
delay(300);
GPRS_Serial.print("\r\n");
Serial.print(“CR-LF Sent!”);
delay(300);

// STRG-Z = dez 26, hex: 1A http://www.cs.tut.fi/~jkorpela/chars/c0.html
GPRS_Serial.print(0x1A); // STRG-Z
Serial.print(“STRG-Z Sent!”);
delay(50);[/code]

Wolfgang

Ok. Finally got it running. The line which sends the CTRL-Z should be like this:

GPRS_Serial.println(26,BYTE); // CTRL-Z -> This is EOF

You should update your pachube.com example at garden!

best regards
Wolfgang

Ok, run into a new problem. - Only the first characters from the website I am calling are transfered correct, after that I only get garbage. What could be the reason?

It looks like that:

SEND OK
HTTP/1.1 200 OK
Date: Thu, 04 Aug 2011 20:51:50 GMTTaa"wT1tidt"wghaaqe =te"tiho88
8<<

Maybe each character should be used the same protocol.

Could you please explain what you mean, I do not understand it. What character, which protocol? What I get back is HTML Code -> Plain ASCII Codes. My Webpage doesn’t send “Taa"wT1tidt"wghaaqe =te"tiho88”

Only the first characters are received correct. Is there a timing problem?

BTW: You’ve still an error in your example file. You now have .print(0x26,BYTE); in your code. That’s not correct. Either you write .print(26,BYTE) or .print(0x1A,BYTE). And in the next comment line it’s described as “End of Line”. CTRL-Z is End of File (EOF)

Thank you for the code correcting.
What I mean is that your email server may have it only protocol. It may need header or tail for the email server to decode.

Hi Jimbo,

it’s just a HTML response, what I get back. Every character is plain ASCII when I try it using a telnet command. There are no special characters returned from my server. For me, it looks like, as if there is a problem with the serial data, which are sent back.

The server always responses with the same message. What I read back from the sim900 differs always. - The first 50 characters are correct, after them there is only garbage. I should solve this problem, because I want to order more from this boards for a project. But I’ve to get that working first!

Best regards
Wolfgang

I am not sure, if I understand it right. Is this the official Support forum for problems with the seeedstudio devices?

I’ve a problem and I would like to get an response. If there is no support, it’s impossible to use your products in a professional way.

Is this hardware produced for people who play around and throw it on the garbage if it doesn’t work? Please let me know. I’ve also written to the techsupport emailadress but I didn’t get an answer there too. There are many many questions in your shop system where your customers ask questions. - But no answers? Are the products sold without support and the people shall look, if they get the devices running anyhow?

Please give me a little bit insight!

Thank you
Wolfgang

You may need to check your NewSoftSerial library, modify the buffer size of NewSoftSerial library.
#define _NewSS_MAX_RX_BUFF 64 // RX buffer size
change it to 256 or 512…

Jimbo,

that’s a good hint. Thank you! - I’ll try that in the evening and give a feedback, if it solved the problem!

Best regards
Wolfgang

Setting the NewSoftSerial buffer to 256 has worked. 512 is too much, I do not have enough free memory left for setting to 512 on my ATMega328.

I’ve modified the reading from the serial data this way, because the delay(200) in Serial_wait_for_bytes still caused problems and garbage:

[code] char c;
int GPRS_RespIndexer = 0;
unsigned long endtime = millis()+15000; // Timeout after 15 secs
int jump = 0;
int ascii;
boolean exit = 0;

while(((millis() < endtime) && GPRS_RespIndexer < 150) && !exit ) {
if (GPRS_Serial.available()) {
c = (unsigned char)GPRS_Serial.read();
jump++;
if (jump >= 270) {
ascii = c;
if (ascii != 10 && ascii != 13) {
GPRS_Response[GPRS_RespIndexer] = c;
GPRS_RespIndexer++;
GPRS_Response[GPRS_RespIndexer] = ‘\0’;
if (strstr( GPRS_Response, “CLOSED” )) exit = 1;
}
}
}
}[/code]

Because the data, which I am looking for is after all the header characters, I ignore 270 characters and after that I read a String with 150 chars. I am not sure if this is a very good solution, but this is working for me now.

Best regards
Wolfgang