Basic Firmware Update

Demonstrates activating a device with a specified product, using the DMS.

API Features Demonstrated

Platforms

This app works on:

Requirements and Prerequisites

This app requires a ZentriOS evaluation board. See the Platforms list above.

Description

This demonstration 'activates' a device with the specified product.

This is for demonstration purposes only.

Typically the device is activated with a product during manufacturing.

This allows for switching the device's product and thus switching the device's firmware.

Note: The account which 'claims' this device must have access to the given product. See zn_dms_claim for more information.

Usage Instructions

Open a ZentriOS serial terminal to the device. See Getting Started, Opening a ZentriOS Terminal.

This app requires your ZentriOS device to be set up with the credentials to join your local network. If you have not already set up network credentials, on the ZentriOS terminal, run the commands:

network_up -s
save

See the Wi-Fi Command API documentation for network_up and save.

You may have to change the defined PRODUCT_CODE to a product accessible to your device and account. In the output below the value is:

#define PRODUCT_CODE "ZENTRI-BAHELLOWORLD"

No interaction is required.

After building, downloading and running the ZAP, the output is similar to the following:

> Firmware Update Example App start ...
[Associating to Zentri_Guest]
> Obtaining IPv4 address via DHCP
IPv4 address: 192.168.6.94
[Associated]
>
Current firmware verison: ZENTRI-OM13086SCCK_ZAP-3.1.0.2-beta, 2016-04-22T07:24:59Z, ZentriOS-WZ-3.1.0.2-beta
Activating device with product code: ZENTRI-BAHELLOWORLD
Request POST /activate
Connecting (https): ota.zentri.com:443
Starting TLS
Checking for new firmware ...
Request GET /ota?bundle_id=213142c9-a635-4d35-86f6-793e818a457c
Connecting (https): ota.zentri.com:443
Starting TLS
New firmware available: ZENTRI-BAHELLOWORLD-1.0.0.1, 2016-02-24T04:00:50Z, ZentriOS-WZ-3.0.0.23

*** Starting firmware update ...

Request GET /ota?bundle_id=213142c9-a635-4d35-86f6-793e818a457c
Connecting (https): ota.zentri.com:443
Starting TLS
UUID: 4BA004772430020F45501EAA52139254C50700F5
Connecting to network
Request POST /ota
Connecting (https): ota.zentri.com:443
Starting TLS
Bundle size: 638976, Free space: 827392, Core size: 442368
Bundle version: ZENTRI-BAHELLOWORLD-1.0.0.1, 2016-02-24T04:00:50Z, ZentriOS-WZ-3.0.0.23
...
Bundle ID: ce76c661-acae-4766-a36d-493d8080c8f8
Downloading new firmware...
...
Setting boot image to sys/services.bin (0)
Booting to new image
JTAG debug enabled
Posting OTA result to DMS
[Associating to Zentri_Guest]
> [Associated]
> Request POST /ota/result
Connecting (https): ota.zentri.com:443
Starting TLS
JTAG debug enabled
OTA completed successfully
[Ready]
> zap_run
Success
> Hello world!!
Rebooting
JTAG debug enabled
[Ready]
>

Implementation

firmware_update.c

zn_app_init

This demonstration runs once and then terminates.

The sequence of steps is:

Source

See: