the communication with nrf52840 and nrf9160 not working sometimes

Hi, I have been using nrf52840(my application) and nrf9160(Serial LTE Modem : SLM , which modem firmware was ver1.3.6 and application firmware from switch science )

First, I tried HTTP access to my server on AWS.

For concise explanation, I put serial post into nrf9160 SLM.

(For some reason, I use "...' replace the original string)
Here is the log for using AT to do HTTPS POST:

AT#XHTTPCCON=1,"....amazonaws.com",443,222

#XHTTPCCON: 1

OK
AT#XHTTPCREQ="POST","/...","User-Agent: slm\r\naccept: */*\r\n","2024/08/01 10:00:39,...",32

OK

#XHTTPCREQ: 1
...
+++
#XDATAMODE: 0

#XHTTPCREQ: 0
HTTP/1.1 200 OK
Date: Thu, 01 Aug 2024 01:35:43 GMT
Content-Type: application/json
Content-Length: 26
Connection: keep-alive
x-amzn-RequestId: ...
x-amz-apigw-id: ...
X-Amzn-Trace-Id: ...

As I succeeded in access, I made the serial sending program to SLM with nrf52840 instead of my hand.

But, SLM responces as below.

AT#XHTTPCCON=1,"....amazonaws.com",443,222

#XHTTPCCON: 1

OK
AT#XHTTPCREQ="POST","/...","User-Agent: slm\r\naccept: */*\r\n","2024/08/01 10:00:39,...",32

OK

#XHTTPCREQ: 1
...
+++
#XDATAMODE: 0

#XHTTPCREQ: -128

ERROR

Is this normal that the modem still return "-128" regardless of the 'timed out' .

According to docs (https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/applications/serial_lte_modem/doc/HTTPC_AT_commands.html ),
it just written "Negative integer - Error code".
What happen to the "XHTTPCREQ: -128" after payload send?

Kind regards.

  • Hello,

    the 128 error code means socket not connected. Could be that you have left some TLS socket open without closing. IIRC the modem is not able to handle more than three concurrent TLS sessions. Also, can you please show in more detail what you code is doing?

  • Hello,

    Thank you for reply. I don't know how to deal with TLS communication.

    Before uploading, I tried below the detail sequence.

    1. put Credential storage management "AT%CMNG=0,222,0," ,..." " command , which used for route certificate to AWS.

    (... here means route certificate texts )

    2.  configure systemmode with "AT\%XSYSTEMMODE=1,0,0,0" command

    3. set PLMN command "AT+COPS=1,2,"..." " (... : PLMN)

    4. configure APN "AT+CGDCONT=0,\"IP\",\"...\"\n"

    5. activate modem "AT+CFUN=1" and check and wait until the device connected to APN.

    6. connect with HTTP "AT#XHTTPCCON=1,"...",443,..." (... : aws url and sec tag)

    7.  HTTP post ,  AT#XHTTPCREQ="POST","/...","User-Agent: slm\r\naccept: */*\r\n","2024/08/01 10:00:39,...",32 (same as first one, I use a reference example https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/applications/serial_lte_modem/doc/HTTPC_AT_commands.html)

    In the step 1, I found RTS from the modem(nrf9160 SLM) was high in sending the certificate, then my application(nrf52) waited for a while (until RTS).

    After the step 7,

    In the step 7, I found some cases that my application program stopped or clushed,

    or the modem just responsed only ERROR .

    I tried putting "AT#XRESET" for avoid the problem, but the modem responces ERROR.

    Additionaly, your mention means every TLS session requires close , alright ?

    I tried after step7, when my application also stops.

    thanks.

Related