SIM5320e HTTPS堆栈,无法成功执行GET请求 [英] SIM5320e HTTPS Stack, can't make successful GET request

查看:117
本文介绍了SIM5320e HTTPS堆栈,无法成功执行GET请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用带有CoolTerm的SIM5320e 3G开发板和一个PL203串行至USB连接器.目的是一旦我可以成功发出HTTP/HTTPS GET请求,便可以将其合并到一个微控制器项目中,该项目将通过EDGE/GPRS/3G将数据从远程传感器传输到Internet.

I'm currently using a SIM5320e 3G development board with CoolTerm and a PL203 serial to USB connector. The aim is once I can make a successful HTTP/HTTPS GET request I can then incorporate it into a micro-controller project that will transmit data from a remote sensor to the internet vis EDGE/GPRS/3G.

但是,我的问题是我尚未成功执行GET请求.我已经搜索了互联网和这个站点,除了数据表之外,该板上没有大量信息,这非常复杂.我确定我错过了关键的一步,但看不到它是什么.

However my issue is I have yet to make a successful GET request. I have searched the internet and this site and there is not a vast amount of info on this board, besides the data sheet, which is quite complex. I'm sure I'm missing a crucial step but can't see what it is.

这是我的评论旁边的(典型)终端输出

Here is the (typical) terminal output alongside my comments

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

我想念什么?

感谢您的光临.

会.

推荐答案

经过大量测试,设法使CHTTPSPOST正常工作.

With quite a lot of testing, managed to get CHTTPSPOST working.

我的测试平台是SIM7600E,目前尚无此模块的博客或资源

My testing rig was a SIM7600E and there aren't many blogs or resources for this module out there yet

Serial2.println("AT+CHTTPSSTART"); xcode=SIM_receiveSerial(5, 0);   wdt_reset();                
Serial2.println("AT+CHTTPSOPSE=\"test.com/db\",443,2"); xcode=SIM_receiveSerial(5, 0);   wdt_reset();          
Serial.print  (" -Server conn "); Serial.println(xcode);  delay(100);
SIM_receiveSerial(1, 0);
SIM_receiveSerial(1, 0);
Serial2.println("AT+CHTTPSSEND=147");  
xcode=SIM_receiveSerial(1, 0);   wdt_reset();          Serial.print  (" -Server conn "); Serial.println(xcode);  

Serial.println("IN METHOD");

Serial2.print("POST https://test/com/db HTTP/1.1"); Serial2.write(13); Serial2.write(10);  Serial.println(" -Post ");    
Serial2.print("Host: test.com");                                             Serial2.write(13); Serial2.write(10);  Serial.println(" -host ");  
Serial2.print("Accept:*/*");                                                     Serial2.write(13); Serial2.write(10);
Serial2.print("Content-Type:application/x-www-form-urlencoded"); Serial2.write(13); Serial2.write(10);   Serial.println(" -Content-Type: ");                                            
Serial.println(" -Cache-Control: ");                                     
Serial.println(" -Accept-Charset: ");                                              
Serial.println(" -Pragma: ");    
Serial2.print("Content-Length:10");                                               
Serial2.write(13); Serial2.write(10);  Serial.println(" -Content-Length: ");    
Serial2.print("");                                                                Serial2.write(13); Serial2.write(10);   Serial.println(" -NL "); 
Serial2.print("&param=11");                                      Serial.println(" -api_token "); 
Serial2.write(13); Serial2.write(10);
Serial2.write(13); Serial2.write(10);  
Serial2.write(0x1a);                                                                  Serial.println(" -CTRL+Z ");


xcode=SIM_receiveSerial(2, 0);
xcode=SIM_receiveSerial(2, 0);
xcode=SIM_receiveSerial(2, 0);
xcode=SIM_receiveSerial(2, 0);
xcode=SIM_receiveSerial(2, 0);
xcode=SIM_receiveSerial(2, 0);
Serial2.println("AT+CHTTPSRECV?");  xcode=SIM_receiveSerial(2, 0);   wdt_reset();          Serial.print  (" -Server conn "); Serial.println(xcode);   

xcode=SIM_receiveSerial(2, 0);
xcode=SIM_receiveSerial(2, 0);
Serial2.println("AT+CHTTPSSTATE");  xcode=SIM_receiveSerial(2, 0);   wdt_reset();          
Serial.print  (" -Server conn "); Serial.println(xcode);   

您可以使用AT+CHTTPRECV

SIM_receiveSerial是等待sim模块回复的功能

SIM_receiveSerial is a function that waits for a reply from the sim module

这篇关于SIM5320e HTTPS堆栈,无法成功执行GET请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆