Cellular: HTTP modem delta update

The HTTP modem delta update sample demonstrates how to do a delta update of the modem firmware. A delta update is an update that contains only the code that has changed, not the entire firmware.

The sample uses the FOTA download library to download a file from a remote server and write it to the modem.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Board target

nRF9161 DK

PCA10153

nrf9161dk

nrf9161dk/nrf9161/ns

nRF9160 DK

PCA10090

nrf9160dk

nrf9160dk/nrf9160/ns

nRF9151 DK

PCA10171

nrf9151dk

nrf9151dk/nrf9151/ns

When built for a board target with the */ns variant, the sample is configured to compile and run as a non-secure application with Cortex-M Security Extensions enabled. Therefore, it automatically includes Trusted Firmware-M that prepares the required peripherals and secure services to be available for the application.

Overview

The sample connects to an HTTP server to download a signed modem delta image. The delta images are part of the official modem firmware releases. The sample automatically downloads the correct delta image to go from the base version to the test version, or the test version to the base version, depending on the currently installed version.

Sending traces over UART on an nRF91 Series DK

To send modem traces over UART on an nRF91 Series DK, configuration must be added for the UART device in the devicetree and Kconfig. This is done by adding the modem trace UART snippet when building and programming.

Use the Cellular Monitor app for capturing and analyzing modem traces.

TF-M logging must use the same UART as the application. For more details, see shared TF-M logging.

Building and running

This sample can be found under samples/cellular/http_update/modem_delta_update in the nRF Connect SDK folder structure.

When built as firmware image for a board target with the */ns variant, the sample has Cortex-M Security Extensions (CMSE) enabled and separates the firmware between Non-Secure Processing Environment (NSPE) and Secure Processing Environment (SPE). Because of this, it automatically includes the Trusted Firmware-M (TF-M). To read more about CMSE, see Processing environments.

To build the sample, follow the instructions in Building an application for your preferred building environment. See also Programming an application for programming steps and Testing and optimization for general information about testing and debugging in the nRF Connect SDK.

Note

When building repository applications in the SDK repositories, building with sysbuild is enabled by default. If you work with out-of-tree freestanding applications, you need to manually pass the --sysbuild parameter to every build command or configure west to always use it.

Testing

After programming the sample to your development kit,, test it by performing the following steps:

  1. Note the LED pattern (1 or 2 LEDs).

  2. Press Button 1 on the nRF91 Series DK or type “download” in the terminal emulator to start downloading the delta modem firmware update. Wait for the download to complete.

  3. Press Button 1 on the nRF91 Series DK or type “apply” in the terminal emulator to apply the delta modem firmware update. Once the modem update procedure is complete, the modem is reinitialized to run the new firmware.

  4. Observe that the LED pattern has changed (1 vs 2).

  5. Start over from point 1, to perform the delta update back to the previous version.

Dependencies

This sample uses the following nRF Connect SDK libraries:

It uses the following sdk-nrfxlib library:

It uses the following Zephyr libraries:

In addition, it uses the following secure firmware component: