cancel
Showing results for 
Search instead for 
Did you mean: 

Cant make http work on GSM sim7080

HZaib.1
Associate III

Connected to STM32F411CE

 

I know this post is not fully related to STM32 but I am posting here as this forum is somewhat active so I can get some help. SIMCOM forums are pretty much dead.

 

I am interfacing sim7080 with stm32, but for this test I am basically simply using TTL converter. my end goal is to implement OTA updates via http on stm32.

Here is what my problem is I am running there http application code for sim7080 and it works as expected. Now I try to access the simple http://txt2html.sourceforge.net/sample.txt link to read .txt file using the http but I am failing.

Here is the application code which works

//Example of HTTP GET. 
AT+SHCONF="URL","http://httpbin.org" 
OK
//Set up server URL
AT+SHCONF="BODYLEN",1024
OK
//Set HTTP body length, for range of maxbodylength
AT+SHCONF="HEADERLEN",350
OK
//Set HTTP head length, for range of maxheadlength
AT+SHCONN
OK
//HTTP build
AT+SHSTATE?
+SHSTATE: 1
OK
//Get HTTP status
//“+SHSTATE: 1”: connected
//“+SHSTATE: 0”: disconnected
AT+SHCHEAD
OK
//Clear HTTP header, because of http header isappended
AT+SHAHEAD="User-Agent","curl/7.47.0" 
OK
//Add header content
//For detail, please refer to document "rfc2616" 
AT+SHAHEAD="Cache-control","no-cache" 
OK
//Add header content
//For detail, please refer to document "rfc2616" 
AT+SHAHEAD="Connection","keep-alive" 
OK
//Add header content
//For detail, please refer to document "rfc2616" 
AT+SHAHEAD="Accept","*/*" 
OK
//Add header content
//For detail, please refer to document "rfc2616" 
AT+SHREQ="/get?user=jack&password=123", 1
OK
+SHREQ: "GET",200,387
//Set request type is GET.
//Get data size is 387. 
AT+SHREAD=0,387
OK
+SHREAD: 387
{ "args": { "password": "123", "user": "jack"
},"headers": { "Accept": "*/*", "Cache-Control": "no-cache", "Content-Length": "0", "Host": "httpbin.org", "User-Agent": "curl/7.47.0", "X-Amzn-Trace-Id": "Root=1-5ed706c8-99b97372ae6f043f805cf243
"
},"origin": "117.132.195.245", "url": "http://httpbin.org/get?user=jack&password=1
23"
}
//The data content is follow “+SHREAD: 387”
AT+SHDISC
OK

This works as expected as you can see I was able to read the json header 

Now this is what I am trying to do to read the text file 

AT+SHCONF="URL","http://txt2html.sourceforge.net"
OK
AT+SHCONF="BODYLEN",1024
OK
AT+SHCONF="HEADERLEN",350
OK
AT+SHCONN
OK
AT+SHCHEAD
OK
AT+SHAHEAD="User-Agent","curl/7.47.0"
OK
AT+SHAHEAD="Cache-control","no-cache"
OK
AT+SHAHEAD="Connection","keep-alive"
OK
AT+SHAHEAD="Accept","*/*"
OK
AT+SHREQ="/sample.txt",1
OK

+SHSTATE: 0

as you see in the end I got SHSTATE:0 which means that i got disconnected by sending it. I have tried different ways I have tried to directly connect to http://txt2html.sourceforge.net/sample.txt but doing that AT+SHCONN always fail

0 REPLIES 0