nRF9160 FOTA from custom HTTP server

Hello,

I am experimenting with FOTA updates on a nRF9160DK. I tested the samples "HTTP application update" sample (developer.nordicsemi.com/.../README.html), which work out of the box.


I am now trying to download a firmware from my own HTTP server, hosted on my computer (Windows).
To do that, I created an basic HTTP server using python http.server.
Then, I used Tunnelmole to make it visible to the world.
This server holds the app_update.bin firmware file.

The server works fine. I can download files from any remote computer using the redirected link.

Then I modify the server URL in prj.conf : for example CONFIG_DOWNLOAD_HOST="gron3q-ip-***-253-36-***.tunnelmole.com"
When run the firmware, I get the following log.

uart:~$ LTE Link Connecting ...
LTE Link Connected!
Press Button 1 or enter 'download' to download firmware update
I: Connecting to gron3q-ip-185-253-36-140.tunnelmole.com
I: Downloading: app_update.bin [0]
E: Unexpected HTTP response: 200 ok
E: Download client error
Received error from fota_download

I tried many times, and the error is always the same.

I first though that it could be an issue related to Tunnelmole. I tried other services, such as ngrok, but got the same results.

I tested my HTTP server with the "http download" sample: it's working fine. I am a bit confused, as both samples use the same Download Client library.

Is there anything something I am missing with the HTTP update ?

Thanks.

Parents Reply Children
  • I am using NCS 2.3.0 and latest modem firmware 1.3.4.

    The HTTP server is hosted on my PC using Python3, and re-directed using TunnelMole.
    No login or certificate is used.

    start py -m http.server 8000
    tmole 8000



    I used the "http application update" sample and tested it with default code: everything is fine.
    Then, I made the following modifications to prj.conf
     - CONFIG_DOWNLOAD_HOST="d9wdas-ip-185-253-***-***.tunnelmole.com" (instead of AWS S3 bucket)
     - CONFIG_NRF_MODEM_LIB_TRACE=y (to get trace info)
     


    I get the following console log :
    uart:~$ I: Trace thread ready
    I: Trace level override: 2
    LTE Link Connecting ...
    LTE Link Connected!
    Press Button 1 or enter 'download' to download firmware update
    I: Connecting to rxumpn-ip-185-253-***-***.tunnelmole.com
    I: Downloading: app_update.bin [0]
    E: Unexpected HTTP response: 200 ok
    E: Download client error
    Received error from fota_download


    On my Python3 server, I can see that the DK tried to download the file:
    ::ffff:127.0.0.1 - - [17/Apr/2023 15:28:06] "GET / HTTP/1.1" 200 -
    ::ffff:127.0.0.1 - - [17/Apr/2023 15:28:10] "GET /app_update.bin HTTP/1.1" 200 -


    I attached the collected trace.

    I then switch to the nRF9160/download sample. Using the same HTTP server. I updated the #define in main.c to match my server and file.

    #define URL "http://rxumpn-ip-185-253-***-***.tunnelmole.com/app_update.bin"

    This example work fine:

    Download client sample started
    Waiting for network.. OK
    Downloading http://rxumpn-ip-185-253-***-***.tunnelmole.com/app_update.bin
    [ 100% ] |==================================================| (157736/157736 bytes)
    Download completed in 9274 ms @ 17008 bytes per sec, total 157736 bytes
    Bye

    Trace _ HTTP Update.bin

  • Update.

    Replacing my Python3 http.server by a Node.js HTTP server (https://github.com/http-party/http-server), I was able to get the application update to download from my server, though redirection (TunnelMole).

    Good enough for me for now, for test purposes.

    However, I am still interested in getting some feedback on the initial issue, especially why "http download" was working fine but not "application update", even though they share the same library. Details might be useful for the final implementation.

Related