Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

SIM300 suddenly closes TCP connection

Status
Not open for further replies.

piotrbocian

Newbie level 2
Joined
Apr 18, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Poland
Activity points
1,300
Hello everyone,
Currently I'm working on electronic circuit Atmega128<->SIM300<->Internet. I want to download data via gsm modem from the website. Everything goes fine, I get html content, but suddenly (and always at the same moment) at the end of transmission, sim300 breaks the TCP connection by sending to Atmega: CLOSED.
Below my log of http request and received data (ECHO on SIM300 is ON).

HTTP request:
Code:
GET /martifer/baza_czyt.php HTTP/1.1
Host: ercp.home.pl:80
Connection: Keep-Alive
Accept: */*
(each line ends with \r\n, and one empty line at the end)

SIM300 response:
Code:
Call Ready
at+cops?
+COPS: 0,0,"06"

OK
AT+CIPMODE?
+CIPMODE: 0

OK
AT+CIPMODE=1
OK
AT+CIPCCFG=3,4,256,1
OK
at+cipstatus
OK

STATE: IP INITIAL
at+cstt="INTERNET","",""
OK
at+cgdcont=1,"IP","INTERNET"
OK
AT+CDNSCFG="153.19.0.50"
OK
at+cipstatus
OK

STATE: IP START
at+ciicr
OK
at+cifsr
109.243.36.248
at+cipstatus
OK

STATE: IP STATUS
AT+CDNSORIP=1
OK
at+cipstart="TCP","ercp.home.pl","80"
OK

CONNECT
HTTP/1.1 200 OK
Connection: close
Content-Type: text/html
Date: Tue, 13 Apr 2010 16:07:00 GMT
Server: IdeaWebServer/v0.70
X-Powered-By: PHP/5.2.6
 
1;Marek Homeowski;00
2;Marek Homeowski;00
3;Marek Homeowski;00
4;Marek Homeowski;00
5;Marek Homeowski;00
6;Marek Homeowski;00
7;Marek Homeowski;00
8;Marek Homeowski;00
9;Marek Homeowski;00
10;Marek Homeowski;00
11;Marek Homeowski;00
12;Marek Homeowski;00
13;Marek Homeowski;00
(...)	// here go all the same rows with incremented index
533;Marek Homeowski;00
534;Marek Homeowski;00
535;Marek Homeowski;00
536;Marek Homeowski;00
537;Marek Homeowski;00
538;Marek Homeowski;00
539;Marek Homeowski;00
540;Marek Homeowski;00
541;Marek Homeowski;00
542;Marek Homeowski;00
543;Marek Homeowski;00
544;Marek Homeowski;00
5	// '5' as the first byte of new line is the last received byre
CLOSED

Although there are 600 lines, sim300 closes connection and switch to command mode.

A few observations:
1. Some of the servers works fine and some of them closes connection as before.
2. I suppose, that sim300 in some way parses "Connection: close" from http header. But eg firefox, wget, ethernut on atmega and other programs sending http request also get "Connection: close" and they receive whole html content.
3. I am not able to trace the tcp traffic because server is not mine.

Does anyone encountered similar problems or have an idea of what it can be caused by? Will appreciate any reply :)

PS. website mentioned above (html content and addresses) are for tests, so feel free if you would like to test it.

Piotr
 

It's not clear from your post, but are you sending AT+CIPSEND after you receive the CONNECT status response from the at+cipstart and then wait for the '>' from the module before sending your request data?

Also, you can only send up to 1,024 bytes per request as that is the size of the buffer in the SIM300.
 

I've forgotten to say - it's transparent mode so after receiving CONNECT, i'm starting with http request without AT+CIPSEND
 

I have same problem what is the solution?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top