HL7812 issue with data transfer via http post

Hi all,

Target:
Send data via http post to server using HL7810 FW: 5.4.10.0

Actual:
Existing implementation that correctly transmit the data using e.g. HL7692, HL6528
Adapted implemention for use with HL7812 and HL7810

Problem:
Using HL7812 or HL7810 has the following behaviour:

  • connection to server works fine
  • response from server can be received
  • data (payload) will not be received by server

Log:
→ AT+KHTTPHEADER=1
← CONNECT

→ Accept: text/plain
→ Content-Type: application/x-www-form-urlencoded
→ Content-Length: 25
→ --EOF–Pattern–
← OK

→ AT+KHTTPPOST=1,“/post”,0
← CONNECT

→ ident=10&customerid=20352 (payload)

← {
“args”: {},
“data”: {},
“files”: {},
“form”: {},
“headers”: {
“x-forwarded-proto”: “http”,
“x-forwarded-port”: “80”,
“host”: “postman-echo.com”,
“x-amzn-trace-id”: “Root=1-650aec6c-06a6903c6a6a41e104211902”,
“accept”: “text/plain”,
“content-type”: “application/json”
},
“json”: null,
“url”: “http://postman-echo.com/post
}–EOF–Pattern–
OK

+KHTTP_IND: 1,3,16,200,“OK” (index:1, status:3 success, 16 bytes of data, ok confirmation)

========================

Although the content size is 25 bytes, exactly send to the modem,
the KHTTP_IND response states, that the transmission was successful with 16 bytes transfered.

Why does the modem count the content lenght wrong? How does it determine the length?
Why does the server receive null data?

All signals were controlled with logic analyzer & oszilloscop, no obtrusiveness found.

The implementation works fine with other modems, but does not with HL7812 & HL7810. I tested with RTS/CTS handshake (on both sides) enabled and disabled. It makes no difference. Both works fine for connection, but does not transmit the payload.

Any idea for a bugfix?

Best regards
Claus

no problem is found on my side and I can post the data to my server:


AT+KHTTPCFG=1,"123.123.123.123",80,0


+KHTTPCFG: 1

OK

+KCNX_IND: 1,6

+KCNX_IND: 1,1,0

+KHTTP_IND: 1,1
AT+KHTTPHEADER=1

CONNECT

Content-Length: 25<CR+LF>
--EOF--Pattern--

OK
AT+KHTTPPOST=1,,"/post_put.php"


CONNECT
//here I enter 25 bytes: 1234512345123451234512345



HTTP/1.1 201 Created
date: Wed, 20 Sep 2023 14:27:52 GMT
server: Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.3.10
x-powered-by: PHP/7.3.10
content-length: 0
content-type: text/html; charset=UTF-8

--EOF--Pattern--
OK

+KHTTP_IND: 1,3,25,201,"Created"

+KCNX_IND: 1,5,30

+KHTTP_ERROR: 1,5

+KHTTP_IND: 1,0
ati3

HL7812.5.4.10.0

OK

and here the implementation:

-> AT+GMR
<- HL7810.5.4.10.0
OK

-> AT+KSLEEP=2
<- OK

-> AT&K3
<- OK

-> AT+CSQ
<- +CSQ: 15,0
OK

-> AT+COPS=0
<- OK

-> AT+CREG?
<- +CREG: 0,5
OK

-> AT+COPS?
<- +COPS: 0,0,"1nce.net",7
OK

-> AT+CGATT?
<- +CGATT: 1
OK

-> AT+CGDCONT=1,"IPV4V6","iot.1nce.net"
<- OK

-> AT+KCNXCFG=1,"GPRS","iot.1nce.net","","","IPV4V6","0.0.0.0","0.0.0.0","0.0.0.0"
<- OK

-> AT+KCNXTIMER=1,20,4,30
<- OK

-> AT+KIPOPT=0,"HTTP",1,1440
<- OK

-> AT+KCNXPROFILE=1
<- OK

-> AT+CGPADDR=1
<- +CGPADDR: 1,"100.95.227.56"
OK

-> AT+CGACT?
<- +CGACT: 1,1
+CGACT: 2,0
OK

-> AT+CGDCONT?
<- +CGDCONT: 1,IPV4V6,iot.1nce.net,100.95.227.56,0,0,,0,,,,,,,
+CGDCONT: 2,IPV4V6,,,0,0,0,0,0,,0,,,,
OK

-> AT+CSQ
<- +CSQ: 19,0
OK

-> AT+KHTTPCFG=1,"postman-echo.com",80,0,"",""
<- +KHTTPCFG: 1
OK
+KCNX_IND: 1,1,0
<- +KHTTPCFG: 1
OK
+KCNX_IND: 1,1,0
+KHTTP_IND: 1,1

-> AT+KHTTPHEADER=1
<- CONNECT

-> Accept: text/plain
-> Content-Type: application/x-www-form-urlencoded
-> Content-Length: 25
-> --EOF--Pattern--
<- OK

-> AT+KHTTPPOST=1,,"/post",0
<- CONNECT

-> ident=10&customerid=20352

<- {
  "args": {},
  "data": {},
  "files": {},
  "form": {},
  "headers": {
    "x-forwarded-proto": "http",
    "x-forwarded-port": "80",
    "host": "postman-echo.com",
    "x-amzn-trace-id": "Root=1-650b0660-14ccd42010e62cf4309e8e58",
    "accept": "text/plain",
    "content-type": "application/json"
  },
  "json": null,
  "url": "http://postman-echo.com/post"
}--EOF--Pattern--
OK

+KHTTP_IND: 1,3,14,200,"OK"

-> AT+KHTTPCLOSE=1,1
<- OK
+KCNX_IND: 1,5,30
<- OK
+KCNX_IND: 1,5,30

-> AT+KHTTPDEL=1
<- OK

again shows the KHTTP_IND response a difference between data transmitted (14) and the content-length (25). the server received null payload

you can try my AT command sequence and see if it is OK for you

You need to setup a http server with PHP to run this “post_put.php”:
post_put.php (958 Bytes)

Thanks, but did not help. Same behaviour.

here is the log from the HL7692, same implementation and correct behaviour

-> AT+KHTTPHEADER=1
<- CONNECT

-> Accept: text/plain
-> Content-Type: application/x-www-form-urlencoded
-> Content-Length: 25
-> --EOF--Pattern--
<- OK

+SIM: 1

+PBREADY

+KSUP: 0

-> AT+KHTTPPOST=1,,"/post",0
<- CONNECT

-> ident=10&customerid=20352

<- {
  "args": {},
  "data": "",
  "files": {},
  "form": {
    "ident": "10",
    "customerid": "20352"
  },
  "headers": {
    "x-forwarded-proto": "http",
    "x-forwarded-port": "80",
    "host": "postman-echo.com",
    "x-amzn-trace-id": "Root=1-650b115d-45093b8e66bce68b75a9fe16",
    "content-length": "25",
    "accept": "text/plain",
    "content-type": "application/x-www-form-urlencoded"
  },
  "json": {
    "ident": "10",
    "customerid": "20352"
  },
  "url": "http://postman-echo.com/post"
}--EOF--Pattern--
OK

+KHTTP_IND: 1,3,25,200,"OK"

have you captured wireshark log in server side and see what is really sending from HL7812 to your server?

If you use my php file post_put.php, what will you receive on server side?

I can not use a local server and need the echo from internet server.
So I can not use Wireshark.

Then it is hard to troubleshoot on why server is not receiving data …( especially no problem is found on my server to receive 25 bytes)
will you set up your own http server?

I have also tried your AT command sequence, no problem is found, the 25 bytes data “ident=10&customerid=20352” can be uploaded to my server:



AT+KHTTPCFG=1,"123.123.123.123",80,0


+KHTTPCFG: 1

OK

+KCNX_IND: 1,4,1

+KCNX_IND: 1,1,0
AT+KHTTPHEADER=1


CONNECT
Accept: text/plain
Content-Type: application/x-www-form-urlencoded
Content-Length: 25
--EOF--Pattern--
OK

+KHTTP_IND: 1,1
AT+KHTTPPOST=1,,"/post_put.php"


CONNECT
//Here I enter "ident=10&customerid=20352"



HTTP/1.1 201 Created
date: Thu, 21 Sep 2023 05:20:34 GMT
server: Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.3.10
x-powered-by: PHP/7.3.10
content-length: 0
content-type: text/html; charset=UTF-8

--EOF--Pattern--
OK

+KHTTP_IND: 1,3,25,201,"Created"

+KCNX_IND: 1,5,30

+KHTTP_ERROR: 1,5

+KHTTP_IND: 1,0

+KCNX_IND: 1,3

+KCNX_IND: 1,0,0
ati3

HL7812.5.4.10.0

OK

Thanks for your support.

Yes, I do think, that the problem is not the AT secuence. HL7692 & HL6528 works fine with it (with little adaptation). Also my hardware must be ok. Signals are checked (power, RTS, CTS, RxD, TxD, DTR, DSR) by oszilloskop and logic analyzer. Everything looks fine.

What I do not understand:

  • How does the modem detect amount of bytes (payload)?
  • How can it be, that this detection results in a wrong amount? (to small number)
  • What can be the reason, that the modem did not send the payload, but can communicte with the server? (receive HTTP response, with status ok)

Without a working platform for you, currently it is hard to isolate factors such as different SIM card, different network provider, radio technology, different HTTP server, different hardware, etc

For your questions, probably wireshark log from server side is needed to compare in different situation.
That is why I suggest you set up your own http server for further investigation

I just tried the same HTTP POST server as yours, no problem is found, 25 bytes data can be transferred to your server:

+CREG: 2
ati3

HL7812.5.4.10.0

OK

+CREG: 1,"047F","0000E6E0",0

+CREG: 1,"047F","0000E6E0",0
AT+KCNXCFG=1,"GPRS","hkcsl"


OK
AT+KHTTPCFG=1,"postman-echo.com",80,0


+KHTTPCFG: 1

+CREG: 1,"047F","0000DBF4",0

OK

+KCNX_IND: 1,4,1

+KCNX_IND: 1,1,0

+KHTTP_IND: 1,1
AT+KHTTPHEADER=1


CONNECT

OK
AT+KHTTPPOST=1,,"/post"


CONNECT
HTTP/1.1 200 OK
date: Sat, 23 Sep 2023 04:44:14 GMT
content-type: application/json; charset=utf-8
content-length: 504
connection: keep-alive
etag: W/"1f8-9u0tQseMWdhBdd6CW0xJf3W/f6A"
set-cookie: sails.sid=s%3AbwdKJbPmTdC-FaJyoKZ4e7bo9qFzl7Yd.mMvRl2dmSL%2Bz6I7ELjs5fn88s93acwN8XP8YPyFRZ7g; Path=/; HttpOnly

{
   "args": {},
                "data": "",
                             "files": {},
                                           "form": {
                                                        "ident": "10",
                                                                          "customerid": "20352"
                 },
                     "headers": {
                                     "x-forwarded-proto": "http",
                                                                     "x-forwarded-port": "80",
                  "host": "postman-echo.com",
                                                 "x-amzn-trace-id": "Root=1-650e6d1a-0f4ffab4552ba8897705b115",
                                   "content-length": "25",
                                                              "accept": "text/plain",
         "content-type": "application/x-www-form-urlencoded"
                                                              },
                                                                  "json": {
                                                                               "ident": "10",
                 "customerid": "20352"
                                        },
                                            "url": "http://postman-echo.com/post"
 }--EOF--Pattern--
OK

+KHTTP_IND: 1,3,25,200,"OK"

Hi jyijyi,
I tried to recreate the test in your last post but am not getting a correct response from the server. I also get a success message (+KHTTP_IND: 1,3,25,200,“OK”), but the server echo seems to be wrong.
Here is my log:

ATI3
HL7812.5.4.10.0
OK

AT+KCNXTIMER=1,20,4,60
OK

AT+KIPOPT=0,“HTTP”,1,1440
OK

AT+CNMI=2,0,0,0,1
OK

AT+KHTTPCFG=1,“postman-echo.com”,80,0,“”,“”
+KHTTPCFG: 1
OK
+KCNX_IND: 1,1,0
+KHTTP_IND: 1,1

AT+KHTTPHEADER=1
CONNECT

Accept: text/plain
Content-Type: application/x-www-form-urlencoded
Content-Length: 25
–EOF–Pattern–
OK

AT+KHTTPPOST=1,“/post”,0
CONNECT

ident=10&customerid=20352

{
“args”: {},
“data”: “”,
“files”: {},
“form”: {
“ident”: “10”,
“customerid”: “20352”
},
“headers”: {
“x279˜Ý T&ª’"http”,
“x-forwarded-port”: “80”,
"ho}–EOF–Pattern–

OK

+KHTTP_IND: 1,3,25,200,“OK”

AT+KHTTPCLOSE=1,1
OK

+KCNX_IND: 1,5,30

AT+KHTTPDEL=1
OK

What could be the reason for the strange answer in my test and the different behavior?

Best regards
Maik

I can see those data has been post by HTTP POST protocol:

“form”: {
“ident”: “10”,
“customerid”: “20352”
},

But for the header afterwards, not usre why there is strange characters.
Do you see this in lower baud rate?
Have you enabled the hardware flow control?

Yes, the hardware flow control is activated (AT&K3).
I haven’t tried it with a lower baud rate yet, that would definitely be worth testing.
I will report the result when I tested it with a different baud rate.

In all samples above, I can see that KHTTP_IND shows the correct information of “amount bytes transmitted”. This is differnt to my logs with HL7812 and HL7810.
In my log KHTTP_IND shows always a smaller number (amount bytes transmitted) than expected and no bytes (payload) are received by the server. (I tried multiple sever)

What I do not understand:

  • How does the modem detect amount of bytes (payload)?
  • How can it be, that this detection results in a wrong amount? (too small number)
  • What can be the reason, that the modem did not send the payload, but can communicte with the server? (receive HTTP response, with status ok)

Remark:
I tested all AT commands and payload bytes with logic analyzer and oszilloscop and all looks fine. I tested also different serial interface setttings (baudrate, RTS/CTS flow control settings) and no changes can be observed. Everytime I got the same wrong behaviour.

For your questions, probably wireshark log from server side is needed to compare in different situation.

Have you set up your own http server for further investigation?

I can not setup a local http server which can be conneted from outside, which would be neccessary to use wireshark. I have already experience in using wireshark (for other problems).

My problem is located local: Correct control of the socket modem. If I had the possibillity of the above diagnostic, I expected to see only the confimation, that no payload was received by the server.

Have you tested with the HL development kit?
Not sure if there is hardware problem in your environment

No, but all other implemented modems from the HL series works properly with the same hardware and same software (some needs small adaption)

SOCKET_MODEM_UMTS_HL8548,
SOCKET_MODEM_GPRS_HL6528RD,
SOCKET_MODEM_LTE_HL7650,
SOCKET_MODEM_LTE_HL7688,
SOCKET_MODEM_LTE_HL7692,
SOCKET_MODEM_LTE_HL7810,
SOCKET_MODEM_LTE_HL7812,