5

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

Roger
  • 2,063
  • 4
  • 32
  • 65
  • 1
    Maybe if you post more details about the method you're using we can help you – dubafek Mar 14 '16 at 02:28
  • There is the AT+CHTTPACT command which can be found in the http application doc: here is the link to SIMCOMs 52XX database http://simcom.ee/documents/?dir=SIM5320 to save double up this may help: https://forums.adafruit.com/viewtopic.php?f=54&t=102201&p=524065#p524065 –  Oct 12 '16 at 03:15

2 Answers2

4

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
Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
EPHM Lab
  • 41
  • 3
  • Tested this answer and it works. (It use the AT command set published for SIM5320a), it was confusing the HTTPS and no HTTP, but it works) From the app Note from the same manufacturer (sim52xx_http_application_note_v0.02) , it suggest to use AT+CHTTPACT (that is not in the formal command set). tested this method and got error 237, then I add a pair of CRLF at the end of the header, and voila, it works, so add your crlf extra at the end of the header – javqui May 17 '18 at 11:59
  • @javqui Could you please tell us more about your solution? The exactly command which you used? I'm facing with error 237 too. – Sam May 26 '18 at 12:25
  • Just add a pair (2) CRLF at the end of the header and will work. – javqui Jul 20 '18 at 09:04
0

Please verify your actual model because you said you have the SIMCOM5320A Model and asked about the SIM5230A.

If you have the SIMCOM5320A I think you are getting that error because that AT Command is already deprecated.

You can check the SIMCOM5320A AT Commands here: AT Commands

Karen Gonzalez
  • 664
  • 9
  • 17