nRF9160: nRF Cloud REST FOTA
The REST FOTA sample demonstrates how to use the nRF Cloud REST API to perform Firmware Over-the-Air (FOTA) updates on your device.
The sample supports the following development kits:
The sample requires an nRF Cloud account.
This sample requires modem firmware v1.3.x or later.
This sample requires the network carrier to provide date and time to the modem. Without a valid date and time, the modem cannot generate JWTs with an expiration time.
If you want to perform an update check immediately, press the button configured by the Kconfig option CONFIG_REST_FOTA_BUTTON_EVT_NUM. This will bypass the wait time specified by the CONFIG_REST_FOTA_JOB_CHECK_RATE_MIN option.
If you have the option CONFIG_REST_FOTA_DO_JITP enabled and you press the button configured by the CONFIG_REST_FOTA_BUTTON_EVT_NUM option when prompted at startup, it will request just-in-time provisioning (JITP) through REST with nRF Cloud. This is useful when initially provisioning and associating a device on nRF Cloud. You only need to do this once for each device.
When you start up your device and have not requested JITP, the sample will ask if FOTA should be enabled in the device’s shadow. Press the button configured by CONFIG_REST_FOTA_BUTTON_EVT_NUM to perform the shadow update. Depending on how you provisioned your device with nRF Cloud, this step might not be needed. You only need to do this once for each device.
See Configuring your application for information about how to permanently or temporarily change the configuration.
Check and configure the following configuration options for the sample:
- CONFIG_REST_FOTA_JOB_CHECK_RATE_MIN - Update check rate
This configuration option defines how often the sample checks for FOTA updates.
- CONFIG_REST_FOTA_DL_TIMEOUT_MIN - Download timeout value
This configuration option defines how long to wait for a download to complete.
- CONFIG_REST_FOTA_ENABLE_LED - Enable LED
This configuration option defines if the LED will be used to indicate connection to the LTE network.
- CONFIG_REST_FOTA_LED_NUM - Enable LED
This configuration option defines if the LED is to be used.
- CONFIG_REST_FOTA_DO_JITP - Enable prompt to perform JITP via REST
This configuration option defines if the application will prompt the user for just-in-time provisioning on startup.
This sample can be found under
samples/nrf9160/nrf_cloud_rest_fota in the nRF Connect SDK folder structure.
The sample is built as a non-secure firmware image for the
nrf9160dk_nrf9160_ns build target.
Because of this, it automatically includes the Secure Partition Manager.
You can also configure it to use TF-M instead of SPM.
See Building and programming an application for information about how to build and program the application.
The configuration file for this sample is located in
See Configuring your application for information on how to configure the parameters.
To create a FOTA test version of this sample, add the following parameter to your build command:
This sample uses the following nRF Connect SDK libraries: