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

AWS FOTA fails when using my upload.bin file for nrf9160

Previously I have been successful getting the AWS FOTA update working using the AWS FOTA example project, the example update.bin file and location provided

by Nordic for the nrf9160. I did have excellent help from Nordic to get that working.

Now I have created my own update.bin from the AWS FOTA project

1) Create update.bin by making a build (get its exact file size from Windows Explorer)

2) Create an s3 bucket for the update.bin file (it has logging turned on)

3) Create another s3 bucket for the logging of events from the bucket with update.bin

4) Upload the update.bin file to the s3 bucket

5) Create a json file to point to the update.bin file

6) Upload code to nrf9160 using Segger

7) Wait for LTE connect complete and board ready for update by observing Termite terminal 

8) Create a job to perform FOTA update using the update.bin file

9) Get MQTT disconnect error

here are related screen shots

Parents
  • Hello,

    First of all, what version of NCS are you running and what is current modem FW?

    I see that you have configured your job file for an HTTPS address. Have you configured this accordingly as described in the download client? In the original job file example shown in AWS FOTA library, the address points to a nRFCloud address using HTTP.

    Error message -57 is defined as follows:

    ENOTCONN 57     /* Socket is not connected */

    Kind regards,

    Øyvind

  • Dear Øyvind

    The NCS version is 1.0.0

    The Modem Firmware is 1.0.0

  • I would say there is not a change in download speed. I would say that after waiting several minutes for the download for my update.bin in my s3 bucket the download is stuck and therefore failed.

    The "Nordic provided update.bin" is the one referred to in the AWS FOTA library example. I use that as a reference because I can always run that update successfully.

    So when my FOTA update fails i rerun the example FOTA from Nordic to make sure there is not some other problem like a lost cell signal or something else.

  • The issue seems to be with what a described in this answer regarding HTTPS. You need to configure the Download Client to support HTTPS, as the limitations states:

    • Currently, the library only uses HTTP for downloading the firmware. It is, however, possible to have it work with HTTPS - see Download client. These changes need to be applied to Firmware over-the-air download to enable downloading firmware through HTTPS.
    • The library requires content-range header to be present in the HTTP response from the server. This limitation is inherited from Download client which is used by Firmware over-the-air download.

    Kind regards,
    Øyvind

  • Thanks for the update. Right now my json file is set to HTTP and the FOTA using a FW image I am hosting on AWS is still failing. As I mentioned above the FOTA starts and then hangs. See the text cut from the terminal window below: Note that I have added some printfk statements to the aws_fota.c and you will see them in the output

    ***** Booting Zephyr OS v1.14.99-ncs2 *****
    The MQTT AWS Jobs FOTA Sample Start Image
    nrf_inbuilt_key_delete(16842753, 0) => result=0
    nrf_inbuilt_key_delete(16842753, 1) => result=0
    nrf_inbuilt_key_delete(16842753, 2) => result=0
    nrf_inbuilt_key_write => result=0
    nrf_inbuilt_key_write => result=0
    nrf_inbuilt_key_write => result=0
    LTE Link Connecting ...
    LTE Link Connected!
    IPv4 Address 0x072adf12
    client_id: My_nRF9160_Brd01B
    aws_fota_init
    construct_notify_next_topic
    aws_fota_mqtt_evt_handler
    update_device_shadow_version
    [mqtt_evt_handler:129] MQTT client connected!
    aws_fota_mqtt_evt_handler
    [mqtt_evt_handler:194] SUBACK packet id: 2112
    aws_fota_mqtt_evt_handler
    [mqtt_evt_handler:184] PUBACK packet id: 31846
    aws_fota_mqtt_evt_handler
    aws_fota_on_publish_evt
    publish_get_payload
    publish_get_payload mqtt_read_publish_payload_blocking
    construct_job_id_update_topic
    construct_job_id_update_topic
    aws_fota_mqtt_evt_handler
    [mqtt_evt_handler:199] default: 8
    aws_fota_mqtt_evt_handler
    update_job_execution
    aws_fota_mqtt_evt_handler
    [mqtt_evt_handler:184] PUBACK packet id: 12393
    aws_fota_mqtt_evt_handler
    aws_fota_on_publish_evt
    publish_get_payload
    publish_get_payload mqtt_read_publish_payload_blocking

  • The following snapshot shows a comparison of the printfk statements when running the Nordic example of the AWS FOTA update on the left and my example using my image stored in an AWS S3 bucket on the right.

  • There are two different links in use here: 

    1. From https://firmware.nrfcloud.com/, the link generated for your file is in the format given in the job-file example.
      http://s3.amazonaws.com/nordic-firmware-files/fcb2394f-49cf-4d66-826c-b5f2d04828b3
      An image from my account on nRF Cloud:
    2. From https://s3.console.aws.amazon.com, the link to your file will have this format:
      https://[USERNAME].s3.eu-north-1.amazonaws.com/update.bin

    As our sample does not support HTTPS out-of-box, it is not sufficient to change the protocol in the job file to "HTTPS" when trying to download from AWS S3. You must follow the instructions given in this link.

    Please try this solution, 
    and let me know how this works for you.

    Kind regards,
    Øyvind

Reply Children
Related