9.4.6 OTA Implementation Details - OTAU Client Side

Follow the below step to add the Zigbee OTAU Client functionality in any of the zigbee application.

Pre-requisite

  1. Open any zigbee device type application based on MCC (Example project/ Custom created project).

  2. Launch MPLABx Code Configurator (MCC).

The below steps explains only the components/configurations needed for OTA functionality.

Figure 9-47. .

Pull-in MCC Components

  1. Configure "Zigbee Device Type" component as below to enable "OTA Client" capability.
    Figure 9-48. .
    Tip:

    Optional "Page mode" configuration - When enabled OTA client sends page request instead of block request to server (1 Page = 5 Blocks)

  2. Add the "Bootloader Services" dependent component for "Device Support" component in project graph. This component generates the supporting linker file and MPLABX script needed for generating OTA bin file.

    Figure 9-49. .
    Figure 9-50. .
  3. Image Decryption - If the upgradable image is secured (encrypted using AES128 CBC), the below configuration has to be enabled to do decryption of the received image. The AES Key should match with the Key in Zigbee OTA file generation configuration as shown below.

    1. wolfCrypto Library component - AES-CBC mode is enabled
      Figure 9-51. .
    2. System component - AES Hardware engine clock is enabled.
      Figure 9-52. .
  4. When upgrading the Image, OTA Server PC Tool gets the current running image version from the device. The upgradable image version has to be greater than running image to get upgraded. The version is referred to macro CS_ZCL_OTAU_FILE_VERSION in the code.

Generate Code

Generate Code by Clicking on "Generate" button

Figure 9-53. .

Files and Routines Automatically generated by MCC

After generating the code from MCC tool by clicking Generate, below is the project folder structure.

Figure 9-54. .