我目前正在使用带有CoolTerm和PL203串口转USB连接器的SIM5320e 3G开发板。目标是,一旦我可以成功地进行HTTP / HTTPS GET请求,我就可以将其合并到一个微控制器项目中,该项目将数据从远程传感器传输到EDGE / GPRS / 3G上网。
但是我的问题是我还没有成功获得GET请求。我已经搜索了互联网和这个网站,除了数据表之外,这个主板上没有大量的信息,这非常复杂。我敢肯定我错过了一个关键的一步,但看不出它是什么。
这是(典型的)终端输出以及我的评论
AT
OK // Module is working
AT+CGSOCKCONT=1,"IP","giffgaff.com" // Setting the APN I am using Giffgaff UK sim card, this is the APN
OK
AT+CSOCKSETPN=1 // Not sure what this step is, but seems to need to happen according to the application note
OK
AT+CIPMODE=0 // Same again
OK
AT+NETOPEN=,,1
Network opened
OK // Opens the network connection via GPRS
AT+IPADDR
+IPADDR: 10.146.130.153
OK // Appears to successfully get a network address
AT+CHTTPSSTART
OK // Starts the HTTPS/HTTP stack
AT+CHTTPSOPSE="www.iforce2d.net", 80,1
OK // Opens a connection to the host on port 80
AT+CHTTPSSEND=23 // Request to send 23 chars of data
>GET /test.php HTTP/1.1 // Web page exists, displays the time in UTC
OK // Says OK
AT+CHTTPSSEND
OK
+CHTTPSSEND: 0 // Says sent with no issue
AT+CHTTPSSEND? // However, I query it
+CHTTPSSEND: 0 // However has sent no chars!
OK
+CHTTPSNOTIFY: PEER CLOSED
AT+CHTTPSRECV? //Query if anything has been received?
+CHTTPSRECV: LEN,0 // Hasn't received anything!
OK
我错过了什么?
谢谢你的期待。
将。
我希望这会有用。我使用TeraTerm将这些命令发送到我的SIM5320E
。所以我使用<Ctrl M>
和<Ctrl J>
而不是'<CR> <LF> OR /n/r'
字符。
网络设置
AT+CGDCONT=1,"IP","<your APN>","0.0.0.0"
AT+CGSOCKCONT=1,"IP","<your APN>"
AT+CSOCKSETPN=1
启动HTTP服务如果没有正确响应,您可以停止并启动服务。
AT+CHTTPSSTART
AT+CHTTPACT="www.iforce2d.net",80
HTTP GET请求
GET /test.php HTTP/1.1 <-- don't hit enter, instead hit the below 2 keys
<Ctrl M>
<Ctrl J>
Host: www.iforce2d.net <-- don't hit enter, instead hit the below 2 keys
<Ctrl M>
<Ctrl J>
Connection: close <-- don't hit enter, instead hit the below 4 keys. This is useful when connecting to REST APIs to download the the respective result only.
<Ctrl M>
<Ctrl J>
<Ctrl M>
<Ctrl J>
要结束命令并接收结果:
<Ctrl Z>
您将在此处收到大量数据。
停止HTTP服务
AT+CHTTPSCLSE
AT+CHTTPSSTOP
您将获得该网站的内容。可能它应该包含你需要的数据(我没有测试内容。可能你需要稍微调整一下结果。)