Skip to main content

Firmware Upgrade (OTA)

OTA stands for "Over-The-Air technology", which enables remote management of software through mobile communication interfaces. Simply put, it is remote firmware upgrading.

Function Description

  • Upgrade Package Management: Add upgrade packages for different versions of different products.
  • Task Management: Create upgrade tasks, set upgrade time (immediate or scheduled), select devices to upgrade (all or partial).
  • Upgrade Report: View statistics of Pending, Pushed, Upgrading, Success, Failure, and Cancelled. View upgrade progress, and retry failed upgrades.

OTA Upgrade Process

The OTA upgrade process under MQTT protocol is shown below. OTA Process

OTA Upgrade Description

  • If the device needs to report the version number before the first upgrade, it is recommended to report it once during system startup, without periodic reporting. After a successful upgrade, report the version immediately.
  • After receiving the upgrade notification from the IoT platform, the device can download the upgrade package immediately or fetch upgrade info later when idle.
  • The IoT platform determines if the OTA upgrade is successful based on whether the progress reported by the device is 100%.
  • For upgrading devices, if the pushed version matches the current version, the platform defaults to pushing the latest version info 3 times. The 4th time counts as failure (retry allowed).
  • Supports breakpoint resume (see interface docs).

Data Format Description

Topics and data formats used in OTA:

  1. (Optional) Device connects to OTA service and reports version. Device pushes current OTA module version to Topic: ota/device/inform.

    {
    "id": "147258369",
    "params": {
    "version": "v1.0.1",
    "module": "default"
    }
    }
    ParamTypeDescription
    idStringMessage ID. Length 10, unique in current device.
    versionStringOTA module version.
    moduleStringOTA module name. 'default' represents entire firmware.
  2. After triggering upgrade in console, device receives upgrade package URL. Device subscribes to Topic: ota/device/inform/\$\{AccessToken\}.

    {
    "id":"147258369",
    "code": 200,
    "params":{
    "version":"v1.1",
    "size":432945,
    "url":"http://dev.thingspane.cn/files/ota/s121jg3245gg.zip",
    "signMethod":"Md5",
    "sign":"a243fgh4b9v",
    "module":"MCU",
    "extData":{
    "key1":"value1",
    "key2":"value2"
    }
    }
    }
    ParamTypeDescription
    idLongMessage ID.
    codeStringStatus code.
    versionStringUpgrade package version.
    sizeLongFile size (bytes).
    urlStringStorage URL on OSS.
    signStringFile signature.
    signMethodStringSign method (SHA256, MD5). Android diff supports MD5 only.
    moduleStringModule name. Default module implies no module param.
    extDataObjectCustom info. _package_udi is reserved.
  3. During upgrade, device reports progress to Topic: ota/device/progress.

    {
    "step":"100",
    "desc":"Upgrade Progress 100%",
    "module": "MCU"
    }
    ParamTypeDescription
    stepStringProgress percentage (1-100). -1: Failed. -2: Download failed. -3: Check failed. -4: Write failed.
    descStringDescription (<128 chars). Can carry error info on exception.
    moduleStringModule name. Optional.

Operation Steps

  1. Product Management -> Firmware Upgrade -> Add Upgrade Package. Add Package
  2. Click View to enter Task List. Task List
  3. Click Add Upgrade Task. Add Task
  4. Click View to enter Upgrade Details. View progress, retry failures, or cancel. Upgrade Details