Docs 09 5264-23-00zi Zigbee Ota Upgrade Cluster Specification
Docs 09 5264-23-00zi Zigbee Ota Upgrade Cluster Specification
Docs 09 5264-23-00zi Zigbee Ota Upgrade Cluster Specification
12
13 Sponsored by:
14 ZigBee Alliance
18 Abstract:
19 This is an implementation specification requirements document that describes the ZigBee
20 Over The Air (OTA) image (FW) Upgrade. The document is to provide a standard for Over
21 The Air message format for upgrading image along with necessary commands and
22 parameters to ensure interoperability of Over The Air upgrading. Certain security aspects will
23 also be enforced or recommended to protect the network from any vulnerability that may be
24 exposed from the Over The Air upgrading.
25 Keywords:
26 ZigBee, Over The Air (OTA), Upgrade Server, Upgrade Client, digital signature, certificate
27
28
29
30
31 Copyright © ZigBee Alliance, Inc. (2003, 2004). All rights Reserved. This information within this
32 document is the property of the ZigBee Alliance and its use and disclosure are restricted.
33
34 Elements of ZigBee Alliance specifications may be subject to third party intellectual property rights,
35 including without limitation, patent, copyright or trademark rights (such a third party may or may not
Permission is granted to members of the ZigBee Alliance to reproduce this document for their own use or the use of
other ZigBee Alliance members only, provided this notice is included. All other rights reserved. Duplication for sale,
or for commercial or for-profit use is strictly prohibited without the prior written consent of the ZigBee Alliance.
ZigBee Document - 095264 ZigBee OTA Upgrade Cluster
36 be a member of ZigBee). ZigBee is not responsible and shall not be held responsible in any manner for
37 identifying or failing to identify any or all such third party intellectual property rights.
38
39 This document and the information contained herein are provided on an “AS IS” basis and ZigBee
40 DISCLAIMS ALL WARRANTIES EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
41 (A) ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT
42 INFRINGE ANY RIGHTS OF THIRD PARTIES (INCLUDING WITHOUT LIMITATION ANY
43 INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENT, COPYRIGHT OR TRADEMARK
44 RIGHTS) OR (B) ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
45 PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT. IN NO EVENT WILL ZIGBEE BE
46 LIABLE FOR ANY LOSS OF PROFITS, LOSS OF BUSINESS, LOSS OF USE OF DATA,
47 INTERRUPTION OF BUSINESS, OR FOR ANY OTHER DIRECT, INDIRECT, SPECIAL OR
48 EXEMPLARY, INCIDENTIAL, PUNITIVE OR CONSEQUENTIAL DAMAGES OF ANY KIND,
49 IN CONTRACT OR IN TORT, IN CONNECTION WITH THIS DOCUMENT OR THE
50 INFORMATION CONTAINED HEREIN, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
51 LOSS OR DAMAGE. All Company, brand and product names may be trademarks that are the sole
52 property of their respective owners.
53
54 The above notice and this paragraph must be included on all copies of this document that are made.
55
56 ZigBee Alliance, Inc.
57 2400 Camino Ramon, Suite 375
58 San Ramon, CA 94583, USA
59
60 Contact information
61 Much of the information in this document is preliminary and subject to change. Members of the ZigBee
62 Working Group are encouraged to review and provide inputs for this proposal. For document status
63 updates, please contact:
64 Rob Alexander
65 Ember Corporation
66 25 Thomson Place
67 Boston, MA 02210
68 Email: rob.alexander@ember.com
69 Phone: +1.617.951.1244
70
71
72 You can also submit comments using the ZigBee Alliance reflector. Its web site address is:
73 www.zigbee.org
74 The information on this page should be removed when this document is accepted.
Copyright ã 2016, The ZigBee Alliance. All rights reserved. Page iii
ZigBee Document - 095264 ZigBee OTA Upgrade Cluster
75 Participants
76 The following is a list of those who were members of the ZigBee Alliance Firmware OTA Task Group
77 leadership when this document was released:
78 Jack McPeck: Chair
79 Skip Ashton: Vice-Chair
80 Wally Barnum: Co-Vice-Chair
81 Michael Cowan: Technical Editor
82
83 The following members made specific contributions to this document:
84 Jack McPeck
85 Skip Ashton
86 Don Sturek
87 Dan Lohman
88 Wally Barnum
89 Areeya Vimayangkoon
90 Rob Alexander
91 Colby Gore
92 Don Sturek
93 John Mani
94 Jens Klostergaard Lyngsoe
95 Jeff Blevins
96 David Smith
97
98
99
100
101
102
104 1 Introduction............................................................................................................................................... 1
105 1.1 Purpose ............................................................................................................................................ 1
106 1.2 Scope................................................................................................................................................ 1
107 2 References................................................................................................................................................. 2
108 2.1 ZigBee Alliance Documents ............................................................................................................ 2
179
Copyright ã 2016, The ZigBee Alliance. All rights reserved. Page vii
ZigBee Document - 095264 ZigBee OTA Upgrade Cluster
Page viii Copyright ã 2016, The ZigBee Alliance. All rights reserved.
ZigBee Document – 095264
ZigBee OTA Upgrade Cluster
224 Error! Reference source not found. shows the change history for this specification.
225 Table 1-1 - Document revision history
17 1.0 Release
226
227
228 1 Introduction
229 1 .1 P u rp o s e
230 The objective of this document is to provide detailed technical requirements for Over The Air image
231 upgrade. This document captures the TRD resolution analysis and presents a clear methodology for
232 implementation of the OTA Upgrade cluster using the existing ZigBee stack(s), ZigBee Cluster Library
233 and this OTA cluster specification.
234 The main goal of Over The Air Upgrade cluster is to provide an interoperable mean for devices from
235 different manufacturers to upgrade each other’s image. Additionally, the OTA Upgrade cluster defines
236 a mechanism by which security credentials, logs and configuration file types are accessible by offering
237 a solution that utilizes a set of optional and mandatory commands.
238 1 .2 Scope
239 The document will only describe features that require implementation in order to be ZigBee OTA
240 upgrade (cluster) certified. Other optional features including using multicast for sending upgrade
241 messages and (upgrade) cloning will not be discussed in this document.
242 Currently, only Application Bootloader support is required in order to support ZigBee OTA Upgrade
243 cluster. MAC Bootloader upgrading is not supported at the moment.
244 2 References
245 2 .1 Z ig B e e A llia n c e D o c u m e n ts
246 [R1] 084912r05ZB_ZARC_Interest-OTA_Upgrades_MRD.doc
247 [R2] 085028r01ZB_ZARC_Interest-OTA_Upgrades_TRD.doc
248 [R3] 075123r02ZB_AFG-ZigBee_Cluster_Library_Specification.pdf
249 [R4] 075356r16ZB_AMI_PTG-AMI_Profile_Specification.pdf
250 [R5] 053474r18ZB_TSC-ZigBee-Specification.pdf
251 3 Definitions
267 3 .2 C o n fo r m a n c e le v e ls
268 3.2.1 expected: A key word used to describe the behavior of the hardware or software in the design
269 models assumed by this Draft. Other hardware and software design models may also be implemented.
270 3.2.2 may: A key word that indicates flexibility of choice with no implied preference.
271 3.2.3 shall: A key word indicating a mandatory requirement. Designers are required to implement all
272 such mandatory requirements.
273 3.2.4 should: A key word indicating flexibility of choice with a strongly preferred alternative.
274 Equivalent to the phrase is recommended.
325 5 .2 C lu s te r lis t
326 The clusters defined in this document are listed in Error! Reference source not found. 2.
327 Table 5-1 - Clusters specified in this document
OTA Upgrade 0x0019 Parameters and commands for upgrading image on devices Over The
Air.
328
329
C S
C = Client S = Server
345 6 .1 O v e rv ie w
346 The cluster provides a standard way to upgrade devices in the network via OTA messages. Thus the
347 upgrade process may be performed between two devices from different manufacturers. Devices are
348 required to have application bootloader and additional memory space in order to successfully
349 implement the cluster.
350
351 It is the responsibility of the server to indicate to the clients when the update images are available. The
352 client may be upgraded, downgraded or reinstalled. The upgrade server must know which client
353 devices to upgrade and to what file version. The upgrade server may be notified of such information
354 via the backend system. For ZR clients, the server may send a message to notify the device when an
355 updated image is available. It is assumed that ZED clients will not be awake to receive an unsolicited
356 notification of an available image. All clients (ZR and ZED) shall query (poll) the server periodically
357 to determine whether the server has an image update for them1.
358
359 The cluster is implemented in such a way that the client service works on both ZED and ZR devices.
360 Being able to handle polling is mandatory for all server devices while being able to send a notify is
361 optional. Hence, all client devices must be able to use a ‘poll’ mechanism to send query message to the
362 server in order to see if the server has any new file for it. The polling mechanism also puts fewer
363 resources on the upgrade server. It is ideal to have the server maintain as little state as possible since
364 this will scale when there are hundreds of clients in the network. The upgrade server is not required to
365 keep track of what pieces of an image that a particular client has received; instead the client shall do
366 that. Lastly poll makes more sense for devices that may need to perform special setup to get ready to
367 receive an image, such as unlocking flash or allocating space for the new image.
368
369 6 .2 S e c u rity
370 Security for the OTA Upgrade cluster encompasses these areas: image verification, image transport,
371 and image encryption. The OTA Upgrade cluster is intended to be used with all ZigBee application
372 profiles. Security mechanism of each application profile dictates the security level of over-the-air
373 image upgrading. For example application profile with strict security policies (such as Smart Energy)
374 may support image signature as well as encryption in both network and APS layers; while Home
375 Automation application profile may only support network encryption . Each application profile must
376 decide the list of required security policies for their use of the OTA Upgrade cluster.
1
CCB 1373 – Image notify is optional
389 Availability – This refers to the property that resources are available when they are required and
390 cannot be unfairly consumed by an attacker. The OTA Upgrade cluster does not address this; as such it
391 will not be discussed any further.
392 Non-repudiation – This refers to the property where a sender/receiver cannot deny that a security
393 exchange took place. The OTA Upgrade cluster does not address this; as such it will not be discussed
394 any further.
437 A secured ZigBee network uses network security for all messages, but that does not provide point-to-
438 point security. APS security should be used to assure that messages are sent from only the trusted
439 source (the upgrade server). This will be utilized to provide implicit and explicit authorization by the
440 upgrade server about when devices will initiate bootload events.
441 Distribution of upgrade image via broadcast or multicast messages is not recommended because its lack
442 of point-to-point security. Reception of upgrade images via broadcast or multicast should not be
443 inferred as authorization by the upgrade server to initiate the upgrade. In this case, the act of receiving
444 the image and upgrading it should be split up into separate events. The latter communications should
445 be done via unicast to verify that the upgrade server has authorized a device to upgrade to a previously
446 received image. Application profiles must determine what level of authorization is required by the
447 upgrade server.
457 6 .3 O T A F ile F o rm a t
465
466 The OTA header will not describe details of the particular sub-elements. Each sub-element is self-
467 describing. With exception of a few sub-elements, the interpretation of the data contained is up to the
468 manufacturer of the device.
471 The first entry of the table above (OTA upgrade file identifier) represents the first field in the OTA
472 header, and the last entry represents the last field. The endianness used in each data field shall be little
473 endian in order to be compliant with general ZigBee messages.
474 Please refer to section 2.5.2 in [R3] for more description on data types.
486 The current OTA header version shall be 0x0100 with major version of “01” and minor version of
487 “00”.
Bits Name
3 - 15 Reserved
500 Security credential version present bit indicates whether security credential version field is present or
501 not in the OTA header.
502 Device specific file bit in the field control indicates that this particular OTA upgrade file is specific to a
503 single device.
504 Hardware version present bit indicates whether minimum and maximum hardware version fields are
505 present in the OTA header or not.
2
CCB 1478
3
CCB 1478
4
CCB 1478
5
CCB 1474
0x0003 ZigBee IP
0x00 SE 1.0
0x01 SE 1.1
0x02 SE 2.0
595
596 Sub-elements provide a mechanism to denote separate sections of data utilized by the device for the
597 upgrade. For example, a device that has multiple processors each with their own firmware image could
598 use a separate sub-element for each one. The details of how this is handled would be up to the
599 manufacturer of the device.
600 A few sub-elements are not manufacturer specific and defined by the OTA cluster itself. See section
601 6.3.4 below.
616 Manufacturers may define tag identifiers for their own use and dictate the format and behavior of
617 devices that receive images with that data.
Data Tag ID: 0x0001 Length Field: Signer IEEE Signature Data
0x00000032 Address
660 If a profile does not require the use of signatures then devices may still choose to use images with
661 signatures. However it is highly recommended that such a device only accept images either with
662 signatures or without, but not accept both. A device greatly reduces its security if it will accept signed
663 or unsigned upgrade files.
711 c. If the addresses do not match then the image shall be discarded as invalid and no
712 further processing shall be done.
713 3. The device shall then obtain the CA public key associated with the signer.
714 a. The device shall obtain the IEEE of the CA public key from the issuer field within
715 the ECDSA certificate data of the ECDSA signing certificate sub-element.
716 b. If the IEEE of the CA does not match its list of known CAs, or the public key for that
717 CA could not be locally obtained, then the image shall be discarded as invalid and no
718 further processing shall be done.
719 4. The device shall then calculate the message digest of the image.
720 a. The digest shall be calculated using the Matyas-Meyer-Oseas cryptographic hash
721 function over the entire image except for the signature data of the ECDSA signature
722 sub-element.
723 i. Note: The calculation shall include the signature tag ID of the ECDSA
724 signature sub-element, the length field of the ECDSA signature sub-elment,
725 and the signer IEEE field of the ECDSA signature sub-element.
726 5. The signer’s public key shall be obtained by extracting it from the signer certificate.
727 6. The device shall then pass the calculated digest value, signer certificate, and CA public key to
728 the ECDSA verification algorithm.
729 7. If the ECDSA algorithm returns success, then the image shall be considered valid.
730 8. If the ECDSA algorithm returns any other result, then the image shall be discarded as invalid
731 and no further processing shall be done.
755 1. A valid OTA image shall have previously been created including all the necessary header
756 fields, tags, and their data, in the image.
757 2. An AES-MMO hash value tag sub-element header shall be constructed including only the tag
758 ID and the length of the sub-element data (16 bytes). No actual data shall be included yet. The
759 tag header shall be appended to the image.
760 3. The OTA image header shall be updated with a new total image size, including the hash tag
761 sub-element header that was added, and the full size of the hash tag sub-element (6 + 16 = 22
762 bytes).
763 4. The hash value shall be calculated using the Matyas-Meyer-Oseas cryptographic hash
764 specified in section B.6 of [R5]. The hash is calculated starting with the OTA image header
765 and spanning just before the hash sub-element header, i.e. the calculation takes in to account
766 the first byte of the image header up to the last byte of the sub-element preceding the hash
767 sub-element.
768 5. The computed hash value shall be appended to the image.
782 6 .4 D is c o v e r y o f th e U p g ra d e S e rv e r
783 Before becoming part of the network, a device may be preprogrammed with the IEEE address of the
784 authorized upgrade server. In this case, once the device is part of the network, it shall discover the
785 network address of the upgrade server via ZDO network address discovery command.
786
787 If the device is not preprogrammed with the upgrade server’s IEEE address, the device shall discover
788 the upgrade server before it participates in any upgrade process. The device shall send Match
789 Descriptor Request (ZDO command) to discover an upgrade server by specifying a single OTA cluster
790 ID in the input Cluster attribute. If the receiving node is an upgrade server, it shall reply with Match
791 Descriptor Response, with the (active) endpoint that the OTA cluster is implemented on, hence,
792 identifying itself as acting as server in OTA Upgrade cluster. Since Match descriptor request may be
793 sent as unicast or broadcast, the client may get multiple responses if there are more than one server in
794 the network. The client shall use the first response received6.. Each application profile should specify
795 the frequency of OTA server discovery done by the client. After discovering the OTA server’s short
796 ID via the ZDO Match descriptor request the client shall discover the IEEE address of the upgrade
797 server via ZDO IEEE address discovery command and store the value in UpgradeServerID attribute.
798
799 A node shall have an application link key with the Upgrade server; it shall request one prior to any
800 OTA operations.
801 1. If the upgrade server is the trust center, it should use its trust center link key.
802 2. If the upgrade server is not the trust center, the device shall perform partner link key request,
803 in case of SE profile or use the global link key in case of other profiles.
804
805 6 .5 S e rv e r a n d C lie n t
806 The server must be able to store one or more OTA upgrade image(s). The server may notify devices in
807 the network when it receives new OTA upgrade image by sending an Image Notify Command. The
808 Image Notify Command will be received reliably only on ZR devices since ZED devices may have
809 their radio off at the time. The Image Notify Command may be sent as unicast or broadcast. If sent as
810 broadcast, the message also has a jitter mechanism built in to avoid the server being overwhelmed by
811 the requests from the clients. If sent as unicast, the client shall ignore the jitter value.
6
CCB 1314.
812 The client device will send Query Next Image Request Command if the information in the Image
813 Notify Command is of interest and after applying the jitter value. All devices shall send in a Query
814 Next Image Request Command periodically regardless of whether an Image Notify was sent by the
815 OTA server. 7
816 When the device has received a response to its query indicating a new OTA upgrade image is available,
817 the client device shall request blocks of the OTA upgrade image. The process continues until the client
818 receives all image data. At that point, the client shall verify the integrity of the whole image received
819 and send Upgrade End Request Command along with the upgrade status. The server shall notify the
820 client of when to upgrade to new image in the Upgrade End Response.
821 It is the responsibility of the server to ensure that all clients in the network are upgraded. The server
822 may be told which client to upgrade or it may keep a database of all clients in the network and track
823 which client has not yet been upgraded.
842 6 .6 D e p e n d e n c ie s
843 Each device that wishes to implement the OTA Upgrade cluster shall have the following:
844 - ZigBee Device Object (ZDO) match descriptor request and response commands. The
845 command is used to discover upgrade server.
846 - ZigBee Cluster Library (ZCL) global commands and basic cluster attributes.
847 - Application Bootloader: To actually upgrade existing image with newly installed one on the
848 additional memory space. The implementation of the Bootloader along with its specification,
849 for example, where it lives and its size are outside the scope of this document.
850 - Additional Memory Space shall be large enough to hold the whole OTA Upgrade Image: It is
851 important to be able to store the new image until the device receives a signal from the server
852 to switch to running the image. This is because it may be necessary for all devices in the
853 network to switch their images at once if the new image is not OTA compatible with the old
854 one.
855 In addition, if the client device is composed of multiple processors; each requires separate
856 image, then the additional memory space shall be large enough to hold all the images for all
857 the processors that make up the device. In case of server devices, its additional memory space
858 will depend on how many images the devices are planning to hold.
7
CCB 1315
859 The specification of the additional memory space and its connection to the processor is outside
860 the scope of this document.
861 6 .7 O T A C lu s te r A ttrib u te s
862 Below are attributes defined for OTA Upgrade cluster. Currently, all attributes are client side attributes
863 (only stored on the client). There is no server side attribute at the moment. All attributes with the
864 exception of UpgradeServerID should be initialized to their default values before being used.
865 Table 6-14 - Attributes of OTA Upgrade Cluster
Attribute Ma Stored
Identifier nda On
tory
Acc
Name Type Range Default /
ess
Opt
ion
al
IEEE
0x0000 UpgradeServerID - Read 0xffffffffffffffff M Client
Address
Unsigne 0x0000
d 0000 –
0x0001 FileOffset Read 0xffffffff O Client
32-bit 0xfffffff
integer f
Unsigne 0x0000
d 0000 –
0x0002 CurrentFileVersion Read 0xffffffff O Client
32-bit 0xfffffff
integer f
Unsigne
CurrentZigBeeStack d 0x0000
0x0003 Read 0xffff O Client
Version 16-bit – 0xffff
integer
Unsigne 0x0000
DownloadedFileVers d 0000 –
0x0004 Read 0xffffffff O Client
ion 32-bit 0xfffffff
integer f
Unsigne
DownloadedZigBeeS d 0x0000
0x0005 Read 0xffff O Client
tackVersion 16-bit – 0xffff
integer
8-bit
0x00 –
0x0006 ImageUpgradeStatus enumer Read 0x00 M Client
0xff
ation
Unsigne
0x0000-
0x0007 Manufacturer ID d 16-bit Read - O Client
0xffff
integer
Attribute Ma Stored
Identifier nda On
tory
Acc
Name Type Range Default /
ess
Opt
ion
al
Unsigne
0x0000-
0x0008 Image Type ID d 16-bit Read - O Client
0xffff
integer
Unsigne
MinimumBlockReque 0x0000-
0x0009 d 16-bit Read - O Client
stDelay 0x0258
integer
Unsigne 0x0000
d 0000 –
0x000A Image Stamp Read O Client
32-bit 0xfffffff
integer f
0x00 Normal
908 Normal status typically means the device has not participated in any download process. Additionally,
909 the client shall set its upgrade status back to Normal if the previous upgrade process was not successful.
910 Download in progress status is used from when the client device receives SUCCESS status in the
911 Query Next Image Response command from the server prior to when the device receives all the image
912 data it needs.
913 Download complete status indicates the client has received all data blocks required and it has already
914 verified the OTA Upgrade Image signature (if applied) and has already written the image onto its
915 additional memory space. The status will be modified as soon as the client receives Upgrade End
916 Response command from the server.
917 Wait to upgrade status indicates that the client is told by the server to wait until another (upgrade)
918 command is sent from the server to indicate the client to upgrade its image.
919 Count down status indicates that the server has notified the client to count down to when it shall
920 upgrade its image.
921 Wait for more (upgrade) image indicates that the client is still waiting to receive more OTA upgrade
922 image files from the server. This is true for a client device that is composed of multiple processors and
923 each processor requires different image. The client shall be in this state until it has received all
924 necessary OTA upgrade images, then it shall transition to Download complete state.
950 6 .8 O T A C lu s te r P a r a m e te r s
951 Below are defined parameters for OTA Upgrade cluster server. These values are considered as
952 parameters and not attributes because their values tend to change often and are not static. Moreover,
953 some of the parameters may have multiple values on the upgrade server at one instance. For example,
954 for DataSize parameter, the value may be different for each OTA upgrade process. These parameters
955 are included in commands sent from server to client. The parameters cannot be read or written via
956 ZCL global commands.
957 Table 6-16 - Parameters of OTA Upgrade Cluster
Mandatory
Name Type Range Default
/ Optional
Unsigned
QueryJitter 8-bit 0x01 – 0x64 0x32 M
integer
Mandatory
Name Type Range Default
/ Optional
Unsigned
DataSize 8-bit 0x00 – 0xff 0xff M
integer
Unsigned
0x00000000
CurrentTime 32-bit 0xffffffff M
– 0xffffffff
integer
Unsigned
0x00000000
UpgradeTime or RequestTime 32-bit 0xffffffff M
– 0xffffffff
integer
989 The value of the parameters and their interpretation may be different depending on whether the devices
990 support ZCL Time cluster or not. If ZCL Time cluster is supported, the values of both parameters may
991 indicate the UTC Time values that represent the Universal Time Coordinated (UTC) time. If the
992 device does not support ZCL Time cluster, then it shall compute the offset time value from the
993 difference between the two time parameters. The resulted offset time is in seconds. A device that does
994 support the time cluster may use offset time instead of UTC Time when it sends messages that
995 reference the time according to Table 6-17.
996 The table below shows how to interpret the time parameter values depending on whether Time cluster
997 is supported on the device. The intention here is to be able to support a mixed network of nodes that
998 may not all support Time cluster.
999 Table 6-17 - Meaning of CurrentTime and UpgradeTime Parameters
UpgradeTime or
CurrentTime
Value RequestTime Description
Value
1000 Using value of all 0xFF’s for UpgradeTime to indicate a wait (for Upgrade End Response command
1001 from the server) on ZED client devices is not recommended since upgrade server should not be
1002 assumed to know the wake up cycle of the end device, hence, it is not guaranteed that the end device
1003 will receive the upgrade command. If the wait value (0xffffffff) is used on ZED client, the client
1004 should keep querying the server at a reasonable rate (not faster than once every 60 minutes) to see if it
1005 is time to upgrade.
1006 Using value of all 0xFF’s for RequestTime to indicate an indefinite wait time is not recommended. If
1007 the server does not know when it will have the image data ready, it shall use a reasonable wait time and
1008 when the client resend the image request, the server shall keep telling it to wait. There is no limit to
1009 how many times the server should the client to wait for the upgrade image. Using value of 0xffffffff
1010 shall cause the client to wait indefinitely and server may not have a way to tell the client to stop waiting
1011 especially for ZED client.
1012 6 .9 O T A U p g ra d e D ia g ra m
(Block/Page 0)
(Block 0)
...
(Block/Page n)
(Block n)
(Retrieval Complete)
1013
1014 Figure 2 - OTA Upgrade Message Diagram
1015 Please refer to section 6.10 for the command description used in the diagram above.
1016 6 .1 0 C o m m a n d F r a m e s
1017 OTA upgrade messages do not differ from typical ZigBee APS messages so the upgrade process should
1018 not interrupt the general network operation. All OTA Upgrade cluster commands shall be sent with
1019 APS retry option, hence, require APS acknowledgement; unless stated otherwise.
1020 OTA Upgrade cluster commands, the frame control value shall follow the description below:
1021 • Frame type is 0x01: commands are cluster specific (not a global command).
1022 • Manufacturer specific is 0x00: commands are not manufacturer specific.
1023 • Direction: shall be either 0x00 (client->server) or 0x01 (server->client) depending on the
1024 commands.
1025 • Disable default response is 0x00 for all OTA request commands sent from client to server:
1026 default response command shall be sent when the server receives OTA Upgrade cluster
1027 request commands that it does not support or in case an error case happens. A detailed
1028 explanation of each error case along with its recommended action is described for each OTA
1029 cluster command.
1030 • Disable default response is 0x01 for all OTA response commands (sent from server to client)
1031 and for broadcast/multicast Image Notify command: default response command is not sent
1032 when the client receives a valid OTA Upgrade cluster response commands or when it receives
1033 broadcast or multicast Image Notify command. However, if a client receives invalid OTA
1034 Upgrade cluster response command, a default response shall be sent. A detailed explanation of
1035 each error case along with its recommended action is described for each OTA cluster
1036 command.
Command Direction Disable Default
Mandator
Identifier Description Response
y
Field
/Optional
Value
Set if sent as
Server -> Client(s) broadcast or
0x00 Image Notify O
(0x01) multicast; Not Set
if sent as unicast
Command Direction Disable Default
Mandator
Identifier Description Response
y
Field
/Optional
Value
CRC check)
1047
Payload Type Values Description
0x03 Query jitter, manufacturer code, image type, and new file version
1084 However, payload type value of 0x03 has a slightly different effect. If the client device has all the
1085 information matching those included in the command including the new file version, the device shall
1086 then ignore the command. This indicates that the device has already gone through the upgrade process.
1087 This is to prevent the device from downloading the same image version multiple times. This is only
1088 true if the command is sent as broadcast/multicast8.
1089 Query jitter value indicates how the server wants to space out the responses from the client; generally
1090 as a result of sending the command as broadcast or multicast. The client will only respond back if it
1091 randomly picks a value that is equal or smaller than the query jitter value. When sending Image Notify
1092 command as broadcast or multicast, the Disable Default Response bit in ZCL header must be set (to
1093 0x01) to avoid the client from sending any default response back to the upgrade server. This agrees
1094 with section 2.4.12 in [R3].
1095 If the command is sent as unicast, the payload type value may be zero and the Query jitter value may
1096 be the maximum value of 100 to signal the client to send in Query Next Image Request. The server
1097 may choose to use other payload type values besides zero when sending as unicast. However, since the
1098 server already knows the specific client (address) it wants to upgrade so other information is generally
1099 irrelevant.
1100 The upgrade server may choose to send Image Notify command to avoid having ZR clients sending in
1101 Query Next Image Request to it periodically.
8
CCB1470
Octets 1 2 2 4 0/2
Bits Name
1-7 Reserved
9
CCB 1373 – Image notify is optional
Bits Name
1 BlockRequestDelay present
2-7 Reserved
1302 the upgrade server. The client knows the total number of request commands it needs to send from the
1303 image size value received in Query Next Image Response command.
1304
1305 The client repeats Image Block Requests until it has successfully obtained all data. Manufacturer code,
1306 image type and file version are included in all further queries regarding that image. The information
1307 eliminates the need for the server to remember which OTA Upgrade Image is being used for each
1308 download process.
1309
1310 If the client supports the BlockRequestDelay attribute it shall include the value of the attribute as the
1311 BlockRequestDelay field of the Image Block Request message. The client shall ensure that it delays at
1312 least BlockRequestDelay milliseconds after the previous Image Block Request was sent before sending
1313 the next Image Block Request message. A client may delay its next Image Block Requests longer than
1314 its BlockRequestDelay attribute.
1315
Octets 1 2 2 4 4 1 2 2 0/8
Data Unsigned Unsigned 16- Unsigned Unsigned Unsigned Unsigned Unsigned Unsigned IEEE
Type 8-bit bit 16-bit 32-bit 32-bit 8-bit 16-bit 16-bit Address
Field Field Manufacturer Image File File Maximum Page size Response Request
Name control code type version offset data size Spacing node
address
Bits Name
1-7 Reserved
Octets 1 2 2 4 4 1 Variable
1461
1462 Table 6-30 - Image Block Response Command Payload with WAIT_FOR_DATA status
Octets 1 4 4 2
1463
1464 Table 6-31 - Image Block Response Command Payload with ABORT status
Octets 1
1520 rate, it will respond with a status of SUCCESS and it will include all the fields in the payload. The use
1521 of file offset allows the server to send packets with variable data size during the upgrade process. This
1522 allows the server to support a case when the network topology of a client may change during the
1523 upgrade process, for example, mobile client may move around during the upgrade process. If the client
1524 has moved a few hops away, the data size shall be smaller. Moreover, using file offset eliminates the
1525 need for data padding since each Image Block Response command may contain different data size. A
1526 simple server implementation may choose to only support largest possible data size for the worst-case
1527 scenario in order to avoid supporting sending packets with variable data size.
1528
1529 The server shall respect the maximum data size value requested by the client and shall not send the data
1530 with length greater than that value. The server may send the data with length smaller than the value
1531 depending on the network topology of the client. For example, the client may be able to receive 100
1532 bytes of data at once so it sends the request with 100 as maximum data size. But after considering all
1533 the security headers (perhaps from both APS and network levels) and source routing overhead (for
1534 example, the client is five hops away), the largest possible data size that the server can send to the
1535 client shall be smaller than 100 bytes.
1536
1537 If the server simply wants to cancel the download process, it shall respond with ABORT status. An
1538 example is while upgrading the client the server may receive newer image for that client. It may then
1539 choose to abort the current process so that the client may reinitiate a new upgrade process for the newer
1540 image.
1541
1542 If the server does not have the image block available for the client yet or it wants to slow down (pause
1543 or rate-limit) the download process, it shall send the response back with status WAIT_FOR_DATA and
1544 with RequestTime value that the client shall wait before resending the request. This is a one-time
1545 (temporary) delay of the download for the client.
1546
1547 If the Image Block Request message contains the BlockRequestDelay field and the server wishes to
1548 slow the client’s rate of sending Image Block requests, then the server shall send an Image Block
1549 Response with status WAIT_FOR_DATA. In this case the RequestTime and CurrentTime in the
1550 message shall be set so that their delta is zero, and the BlockRequestDelay field shall be set to the
1551 minimum delay that server wants the client to add between all subsequent Image Block Requests.
1552
1574
Octets 1 2 2 4
Octets 2 2 4 4 4
1686
1687 For device specific file download, the client should not always expect the server to respond back with
1688 Upgrade End Response command. For example, in a case of a client has just finished retrieving a log
1689 file from the server, the server may not need to send Upgrade End Response command. However, if
1690 the client has just retrieved a security credential or a configuration file, the server may send Upgrade
1691 End Response command to notify the client of when to apply the file. The decision of whether
1692 Upgrade End Response command should be sent for device specific file download is manufacturer
1693 specific.
Octets 8 2 2 4 2
1793 A status of NO_IMAGE_AVAILABLE indicates that the server currently does not have the device
1794 specific file available for the client. A status of NOT_AUTHORIZED indicates the server is not
1795 authorized to send the file to the client.
10
1815 6 .1 1 M u ltip le F ile s R e q u ire d fo r a B o o tlo a d
1816 Zigbee devices may require multiple boatload files in order to be upgraded correctly. These files often
1817 correspond to multiple embedded chips contained within the physical device that have separate
1818 firmware images to run them.
1819
1820 A device has a number of options for managing these files depending on its own internal configuration
1821 or dependencies. This section describes the three main options:
1822
1881 6 .1 2 O T A U p g ra d e C lu s te r M a n a g e m e n t
1882 This section provides ways for the upgrade server to monitor and manage the network-wide OTA
1883 upgrade process. It is important to realize that the server cannot reliably query the upgrade status of the
1884 sleepy devices.
1922
1923 Figure 3 - Rate Limiting Exchange
1924
1925
1926 6.12.4 Current Time, Request Time, and Minimum Block Request Delay
1927 When a server sends an Image Block Response with a status of WAIT_FOR_DATA, it can delay the
1928 client’s next Image Block Request. This can be done persistently for all subsequent requests, or
1929 temporarily as a onetime delay.
1930 The onetime delay can be created by setting the Current Time and Request Time fields as described in
1931 section Error! Reference source not found. Error! Reference source not found.. This might occur if
1932 the server does not immediately have access to the block of the upgrade image requested by the client,
1933 and the server must fetch the block from another location.
1934 The persistent delay can be enabled by setting the Minimum Block Request Period as described in
1935 section 6.10.8.2.9 Block Request , however this only works if the client and server support this
1936 functionality.
1937
1938 6 .1 3 O T A U p g ra d e P ro c e s s
1939 Once a device has completely downloaded the image and returned a status of SUCCESS in the
1940 Upgrade End Request, it shall obey the server’s directive based on when it should upgrade. However
1941 there are many failure scenarios where this may not be possible. In such failure case, the device should
1942 attempt to contact the server and determine what should be done, but if that has failed as well, then it
1943 may apply its update without an explicit command by the server.
1944
1945 After receiving an Upgrade End Response from the server the client will apply the upgrade according
1946 to time values specified in the message. If the response directs the device to wait forever, it shall
1947 periodically query the server about when it should apply the new upgrade. This shall happen at a
1948 period no more often than once every 60 minutes. If the server is unreachable after 3 retries, the device
1949 may apply the upgrade.
1950
1951 The client does not need to persistently store the time indicating when to apply the upgrade. If the
1952 client feels that it has lost connection to the upgrade server, it shall first try to rediscover the upgrade
1953 server perhaps by rejoining to the network and performing network address discovery using the stored
1954 UpgradeServerID attribute. Once the server is found, the client shall resend an Upgrade End Request
1955 command with a status of SUCCESS to the server, including the relevant upgrade file
1956 information. The server shall send it a response again indicating when it should upgrade. If the device
1957 is unable to communicate to the upgrade server or it cannot synchronize the time, it may apply the
1958 upgrade anyway.
1959
1960 When the time comes for the client to upgrade, the device should begin the manufacturer specific
1961 method to upgrade its image. The upgrade may involve one or more hardware resets. Once the device
1962 has completed the upgrade it should be able to reinitialize itself and start communicating on the
1963 network again. Previous network information such as channel, power, short pan id, extended pan id
1964 should be preserved across the upgrade.
1993 A client should request new security data necessary for SE Profile 2.0 via Query Specific File Request
1994 command. After obtaining the security data file, the server will include the file information in the
1995 Query Specific File Response command in response to the client’s request. Upon reception the
1996 response, the client then shall obtain the file via Image Block or Page Request command. Query
1997 Specific File Request and Response commands are described in section 6.10.11 and 6.10.12
1998 respectively.
1999 6 .1 5 O T A U p g ra d e R e c o v e ry
2000 Each manufacturer is encouraged to implement a recovery method that should be used to recover the
2001 node in a case when the OTA upgrade fails. The recovery method is particularly important in a case
2002 where the device may not be able to communicate to the server over-the-air. The actual recovery
2003 implementation is manufacturer specific, however, some of the options are discussed in this section.
2004 One option for recovery method is the ability for the application bootloader to swap the images
2005 between its external flash and its internal flash, rather than just overwriting the internal with the
2006 external. A sample use case is where the upgraded device is functional enough to receive a message,
2007 but broken enough to not be able to initiate OTA upgrade process again. A manufacturer specific
2008 command may be sent from the server to notify the device to revert back to its previous image.
2009 In a case where the device is no longer able to communicate to the server over-the-air; the application
2010 bootloader could revert to the previous image via a button press on power up.
2011