EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: Vindhyachal.takniki on October 15, 2015, 01:49:45 pm

Title: sim900a tcp GET, not working
Post by: Vindhyachal.takniki on October 15, 2015, 01:49:45 pm
I am using SIm900A module to get data using cipsend command.
I don't receiving anything agter GET command. below is code.
baud is 9600.
-> Input to SIM900
<- output from SIM900

2. I have SIM900A connected to PC via RS232 cable. Using realterm to send commands. (also tried hyperterminal)

3. I have put sim in mobile & checked internet is working on it.

->AT
<-OK
delay_sec(3);

->AT+CPIN?
<-CPIN: READY
delay_sec(3);

->AT+CREG?
<-+CREG: 0,1
delay_sec(3);


->AT+CIPSHUT
<-SHUT OK
delay_sec(3);

->AT+CIPMUX = 0
<-OK
delay_sec(3);

->AT+CGATT=1
<-OK
delay_sec(3);

->AT+CGDCONT=1,"IP","TATA.DOCOMO.INTERNET"
<-OK
delay_sec(3);

->AT+CSTT="TATA.DOCOMO.INTERNET","",""
<-OK
delay_sec(3);

->AT+CIICR
<-OK
delay_sec(3);

->AT+CIFSR
<-xxx.xxx.xxx.xxx   //ip address
delay_sec(3);

->AT+CIPSTART="TCP","www.google.com","80"
<-OK
<-CONNECT OK
delay_sec(3);


->AT+CIPSEND
<- >
-> GET / HTTP/1.1           //IN SAME LINE ABOVE
-> Host: www.google.com (http://www.google.com)
-> Ctrl+z
<- SEND OK

<- CLOSED          //after long delay
<-+PDP: DEACT      //after very long delay
Title: Re: sim900a tcp GET, not working
Post by: kfitch42 on October 15, 2015, 02:27:03 pm
I am not familiar with this SIM900a thingy, but I have dealt HTTP a bit. The first thing that jumps out at me is that I don't see the extra newline after the header lines are finished. To be exact the string that should be sent to the web server should be (expressed in normal C string notation):

"GET / HTTP/1.1\r\nHost: www.google.com\ (http://www.google.com\)r\n\r\n"

You should even be able to get away with:

"GET / HTTP/1.0\r\n\r\n"

I haven't tried, but I would assume a lenient web server might be OK with something as simple as

"GET / HTTP/1.0\n\n"

or maybe even

"GET /\n\n"

Title: Re: sim900a tcp GET, not working
Post by: Vindhyachal.takniki on October 16, 2015, 11:05:28 am
@kfitch42, that was exactly the problem.