nRF9161 FOTA + TLS Download Error

Hi,

We are using `fota_download` library on our nRF9161 design running mfw-nrf91x1_2.0.1 to download a firmware upgrade image from our Amazon AWS server location.

When trying to download with TLS enabled, fota_donwload_start function errors out with errno 122: EMSGSIZE, however everything works fine when TLS is not being used. We are also able to download the image if TLS is setup on our local PC/server.

Our current understanding is that the nRF9161 delegates TLS/socket processing to the modem firmware. Adjusting the fragment size in our firmware to a smaller value hasn't resolved the problem, and error 122 persists.
We’ve looked into modifying the TLS settings on AWS server, however that doesn’t seem to be an option as of now.

Wondering if you have any recommendations on how to work around the problem?

  • Thanks for your patience. Our TLS experts have had a look at this issue and the last modem trace you provided. They verify that the data sent it too large from the server. Still waiting for more details and suggestions to a work-around

    While waiting for more information, as you pointed out, it is difficult to alter the fragmentation size on the AWS server. But have you tested all possible combinations of HTTP_FRAG_SIZE and CLIENT_BUF_SIZE? I.e.:

    config DOWNLOAD_CLIENT_BUF_SIZE
    	int "Buffer size (static)"
    	range 256 4096
    	default 2048
    	help
    	  Size of the internal buffer used for incoming and
    	  outgoing packets. It must be large enough to
    	  acommodate for the largest between the HTTP fragment
    	  and CoAP block. In case of CoAP, the CoAP header
    	  length of 20 bytes should be taken into account.

    config DOWNLOAD_CLIENT_HTTP_FRAG_SIZE
    	int
    	default 256 if DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_256
    	default 512 if DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_512
    	default 1024 if DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_1024
    	default 2048 if DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_2048
    	default 4096 if DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_4096
    
    choice
    	prompt "HTTP(S) fragment size"
    	default DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_2048
    	help
    	  Size of the data fragments reported to the application when
    	  using HTTP or HTTPS. Use the largest fragment size when using HTTPS
    	  to reduce the bandwidth overhead due to the HTTP headers, which are
    	  sent for each fragment. When using the Modem library and TLS,
    	  the fragment size may not exceed 2 kB minus the largest HTTP header
    	  the application expects to receive.

    Did you test with e.g. CONFIG_DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_512 (or 256) and CONFIG_DOWNLOAD_CLIENT_BUF_SIZE=4096?

    Kind regards,
    Øyvind

Related