Updated on 2023-11-14 GMT+08:00

Upgrade Guide

Overview

Software includes system software and application software. The system software provides the basic device functions, such as the compilation tool and system file management. The application software provides functions such as data collection, analysis, and processing, depending on the features the device provides.

Software upgrade, also called software over the air (SOTA), allows users to upgrade the software of LwM2M or MQTT devices in OTA mode. For an LwM2M product model, the software upgrade complies with PCP. For details, see PCP Introduction. You must comply with PCP during device adaptation development of software upgrades. For details on the adaptation method, see Adaptation Development on the Device Side. For an MQTT product model, the software upgrade protocol is not verified.

Software Upgrade for Devices Using LwM2M over CoAP

The software upgrade process for a device using LwM2M over CoAP is as follows:

1–2: A user uploads a software package on the IoTDA console and creates a software upgrade task on the console or an application.

3: A device reports data to the platform. The platform detects that the device is online and triggers the upgrade negotiation process. (The timeout interval is 24 hours.)

4–5: The platform delivers a command to the device to query its software version and determines whether an upgrade is required based on the target version. (In step 4, the timeout interval for the device to report the software version is 3 minutes.)
  • If the returned software version is the same as the target version, no upgrade is required.
  • If the returned software version is different from the target version, the platform continues the upgrade.

6: The platform subscribes to the software upgrade status from the device.

7–8: The platform queries the radio coverage of the cell where the device resides, and obtains the cell ID, reference signal received power (RSRP), and signal to interference plus noise ratio (SINR). (The timeout interval for the reporting of the radio coverage level and cell ID is about 3 minutes.)
  • If the query is successful, the platform calculates the number of concurrent upgrade tasks based on the RSRP and SINR ranges described in the figure below, and continues with 10.
    • RSRP and SINR in range 0: 50 devices in the cell can be upgraded simultaneously.
    • RSRP in range 0 and SINR in range 1: 10 devices in the cell can be upgraded simultaneously.
    • RSRP in range 1 and SINR in range 2: Only one device in the cell can be upgraded at a time.

    • RSRP and SINR can be queried but are not within any of the three ranges: Only one device in the cell can be upgraded at a time.

      If only a small number of devices can be upgraded simultaneously, you can contact the local carrier to see if coverage can be improved.

  • If the query fails, the process continues with 9.
9: The platform delivers a command to query the cell ID of the device.
  • If the query is successful, 10 devices in the cell can be upgraded simultaneously.
  • If the query fails, the upgrade fails.

10–12: The platform notifies the device of a new software package version. The device starts to download the software package. Software packages can be downloaded in segments, and resumable download is supported. The versionCheckCode field carried in a software package segment determines the software package to which the segment belongs. After the download is complete, the device notifies the platform. (The timeout interval for step 11 is 60 minutes.)

13–14: The platform delivers an upgrade command to the device, and the device performs the upgrade. After the upgrade is complete, the device notifies the platform. (The timeout interval for the device to report the upgrade result and status is 30 minutes.)

15: The platform notifies the IoTDA console or application of the upgrade result.

Software Upgrade for Devices Using MQTT

The software upgrade process for a device using MQTT is as follows:

1–2: A user uploads a software package on the IoTDA console and creates a software upgrade task on the console or an application.

3: The platform checks whether the device is online and triggers the upgrade negotiation process immediately when the device is online. If the device is offline, the platform waits for the device to go online and subscribes to the upgrade topic. After detecting that the device goes online, the platform triggers the upgrade negotiation process. (The timeout interval for the device to go online is within 25 hours.)

4–5: The platform delivers a command to the device to query its software version and determines whether an upgrade is required based on the target version. (The timeout interval for step 5 is 3 minutes.)
  • If the returned software version is the same as the target version, no upgrade is required. The upgrade task is marked successful.
  • If the returned software version is different from the target version and this version supports upgrades, the platform continues the upgrade.

6–7: The platform delivers the package download URL, token, and package information. The user downloads the software package using HTTPS based on the package download URL and token. The token is valid for 24 hours. (The timeout interval for package download and upgrade status reporting is 24 hours.)

8: The device upgrades the software. After the upgrade is complete, the device returns the upgrade result to the platform. (If the version number returned after the device upgrade is the same as the configured version number, the upgrade is successful.)

9: The platform notifies the IoTDA console or application of the upgrade result.

Uploading a Software Package

You need to upload a software upgrade package before creating a batch software upgrade task. The platform supports the following upload modes:

  1. The application calls the API for Creating an OTA Upgrade Package.
  2. On the console, choose Software/Firmware Upgrades, and upload a software upgrade package. For details, see Software/Firmware Package Upload.
    • The OTA upgrade package uploaded using the API can be used only for upgrading MQTT devices.
    • If the upgrade package is an OBS object, the delivered upgrade package link is the OBS link no matter whether the CDN domain name acceleration is configured for the OBS bucket.

Upgrading the Software for a Batch of Devices

There are two ways to upgrade the software for a batch of devices:

  1. Call the API Creating a Batch Task to create an upgrade task for a batch of devices.
  2. Create a software upgrade task on the IoTDA console.

The following describes how to create a software upgrade task for a batch of devices on the console.

  1. Access the IoTDA service page and click Access Console.
  2. In the left navigation pane, choose Devices > Software/Firmware Upgrades, and click Create Upgrade Task.
  3. On the Software Upgrades tab page, click Create Task.

  4. In the Set Basic Information pane, set the task name, execution time, and retry policy.

    If Retry is enabled, you can set the number of retry attempts and retry interval. You are advised to set Retry Attempts to 2 and Retry Interval to 5 minutes. If an upgrade fails, the upgrade will be retried 5 minutes later.

  5. Select a software package.

  6. Select the device or device group to upgrade and click Create Now.

    For details on how to create a group and add devices to the group, see Group.

  7. View the result on the task list. You can click Detail to view the result for each device on the execution details page.

    An upgrade task that is being executed cannot be deleted. To delete an upgrade task, manually stop the task first.