This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

MQTT 128kB packet size

Hello,

I am using NRF9160 running the Serial LTE Modem application in NCS 1.5.0.

When connecting with AWS IoT over a secure MQTT connection the maximum MQTT packet size allowed by AWS IoT is 128kB. When I publish a message of this size from an external device my nrf9160 device outputs the error -128. What is this error? 128 does not appear in errno.h.

How can I allow the maximum packet size of 128kB from AWS IoT to be received by the nrf9160? If this size is not reachable what is the maximum limit and how do I enable that limit?

What is the maximum outgoing limit and how do I enable that limit?

  • I am able to write the certificates with native TLS using the Certificate Manager in the LTE Link Monitor application.

    However, I did have a problem reading the private key back out when I tried to use it. The problem was that MAX_CRDL_LEN in slm_native_tls.c was too small to hold all three certificate types.

    But, the TLS handshake is still failing. I'll keep trying to debug this, and let you know when I know more (hopefully it won't be this long until my next update).


    Is did you use the code you attached to try to write the certificates?

    If so, you must write all certificate types as MODEM_KEY_MGMT_CRED_TYPE_CA_CHAIN, so that they can be read back out.

  • Hello

    I haven't received a reply in some time. I have attempted to repeat the process in NCS 1.6.1 but found the same results. Are there any updates on this topic? Thanks, Jack

  • Hi,

    Unfortunately, I have not been able to make much progress. I have been quite busy, especially the past couple of months, due to low staffing during the summer acation period.

    I am truly sorry for not having been able to work more on this.

    However, staffing should soon return to normal, which will make it easier to find the time needed to look properly into this issue.

    There has also been a lot of work done on the crypto side, with the inclusion of Trusted Firmware-M.

    This includes adding a sample to the master branch that shows how you can run the TLS stack in the secure domain: https://github.com/nrfconnect/sdk-nrf/tree/master/samples/crypto/psa_tls

    With sincere apologies,

    Didrik

  • Thanks  The Only reply button seems to be at the top so I'm replying to 


    Hi,

    Unfortunately, I have not been able to make much progress. I have been quite busy, especially the past couple of months, due to low staffing during the summer acation period.

    I am truly sorry for not having been able to work more on this.

    However, staffing should soon return to normal, which will make it easier to find the time needed to look properly into this issue.

    There has also been a lot of work done on the crypto side, with the inclusion of Trusted Firmware-M.

    This includes adding a sample to the master branch that shows how you can run the TLS stack in the secure domain: https://github.com/nrfconnect/sdk-nrf/tree/master/samples/crypto/psa_tls

    With sincere apologies,

    Didrik

    Understood. I will check that out. In the meantime I have found what looks like the point where my error first arises in rsa.c. You can see the Call stack and the line where the error code comes from in this image.

    Watch on "ret" doesn't work here but I do believe the value is -0x10 = MBEDTLS_ERR_MPI_ALLOC_FAILED.

    Hopefully that might be of use in the future.

    As a side note it's pretty difficult to step through this code because it is optimized and there is only Common Configuration in the drop down. Is it possible to run this SLM application in an unoptimized Debug configuration?

  • I was able to get past the handshake by increasing the CONFIG_MBEDTLS_HEAP_SIZE. In my case to 81920.

    Now the error is POLLHUP. From what I can tell at this moment this occurs immediately, the first time the socket is polled.

1 2 3