I am struggling to get AT commands working that will get the 3G SIM5230 module to make a clean HTTP request. When I build and send what I believe is a good request, I do not get a response from the web server, only the error +CHTTPACT: 237. I can get the module to send an invalid post (simply add a space in front of the POST in the command), and I get a response back from a web server 400, telling me it is an invalid http request. Anyone out there successfully doing HTTP POST commands with this module?
Model: SIMCOM_SIM5320A Revision: SIM5320A_V1.5
I also had trouble POST and GET 'ing with the SIM5320a module. While this code is for GET, similar code can be used for POST.
I found the tricky bit was what keystrokes to send after the AT+CHTTPSSEND=86 command, and how many characters to include in this (NOTE that the 86 is crucial - it is the number of characters plus 6 = for carriage return and line feeds). It took a while to work out that you need two carriage returns and line feeds at the end.
I used TERATERM for testing. I have now made some simple code for my arduino uno connected to a SIM5320a (this has been running for over a week now, and gets data every hour). If anyone wants this code, send me a request.
TERATERM + SIM5320a
//This program is for a SIM5320A connection using TeraTerm (I am running this through an Arduino Uno that has been uploaded with a AT port-through script). The items in brackets are the keystrokes I used to make the request run. The information after -> is the expected result.
//SETUP
AT+CGDCONT=1,"IP","INSERT_YOUR_APN","0.0.0.0" (return) -> OK
AT+CGSOCKCONT=1,"IP","INSERT_YOUR_APN" (return) -> OK
AT+CSOCKSETPN=1 (return) -> OK
//Start HTTPS session
AT+CHTTPSSTART (return) -> OK
//Open HTTPS session at server
AT+CHTTPSOPSE="www.XXXXXXXXXXXXXXXX.com.au",80,1 (return) -> OK
//Send request - NOTE that the 86 is crucial - it is the number of characters in what you want to send plus 6 (6 carriage return and line feeds)
AT+CHTTPSSEND=86 (return) -> >
GET /SensorE.php?temp=11111&EC=3333 HTTP/1.1
(Ctrl M)
(Ctrl J)
Host: www.XXXXXXXXXXXXXXXX.com.au:80
(Ctrl M)
(Ctrl J)
(Ctrl M)
(Ctrl J) -> OK +CHTTPS: RECV EVENT
//Receive request
AT+CHTTPSRECV=4000 (return) -> lots of stuff we hope, but should contain the returned data from your website
//Close session at server (but will automatically after it gets a nice recv)
AT+CHTTPSCLSE (return) -> OK or error - it is ok if error pops up here
//Stop the http service
AT+CHTTPSSTOP (return) -> OK
//Power down the module
AT+CPOF
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With