Firmware update

This page will guide you through the available firmware update mechanisms for the nRF Door Lock and Access Control Application.

For build variants and flashing instructions, see Application guide.

Matter OTA

The application allows you to update the firmware of the device using the Matter Over-The-Air (OTA) update mechanism. This allows you to remotely upgrade the door lock firmware without physical access to the device.

This guide uses CHIP Tool as a Matter controller and assumes you have a commissioned Matter device. For details on CHIP Tool usage, see the Matter chip-tool guide.

Prerequisites

Before starting the OTA update process, ensure that:

  • The Matter device is commissioned to the network (see the commissioning instructions in the Aliro door lock provisioning with Matter section).

  • You have built the new Matter application with a higher version number than the one that is currently running on the device to be updated. The version is configured in the applications/matter-aliro-door-lock-app/VERSION file. The matter.ota file generated in the build directory will be used as the OTA firmware image file.

  • You have the Matter OTA provider application available on your PC. You can download the precompiled OTA provider application from the Matter fork release page.

OTA update process

The following steps will guide you through the complete OTA update process:

  1. Start and run the OTA provider application to make the new firmware image accessible to the target device:

    chip-ota-provider-app -f <ota-file-path>
    

    Where <ota-file-path> is a path to the OTA firmware image file. For example:

    chip-ota-provider-app -f ./build/matter.ota
    
  2. Commission and pair the OTA provider with the Matter network using the default pairing credentials:

    chip-tool pairing onnetwork <provider-node-id> <pin-code>
    

    Where:

    • <provider-node-id> is the node ID for the OTA provider (must be unique on the network)

    • <pin-code> is the setup PIN code for the OTA provider

    For example:

    chip-tool pairing onnetwork 2 20202021
    
  3. Configure the Access Control List (ACL) to allow the target device access to the OTA provider:

    chip-tool accesscontrol write acl <acl-entries> <provider-node-id> <provider-endpoint-id>
    

    Where:

    • <acl-entries> refers to the Access Control List entries

    • <provider-node-id> is the node ID of the OTA provider

    • <provider-endpoint-id> is the endpoint ID of the ACL cluster

    For example:

    chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' 2 0
    

    Note

    The ACL contains two entries: the first one grants administrative privileges to the controller (subject 112233), and the second one grants operational privileges to all subjects (subjects: null) for general OTA operations.

  4. Register the target device to use the OTA provider.

    chip-tool otasoftwareupdaterequestor write default-otaproviders <attribute-value> <target-node-id> <target-endpoint-id>
    

    Where:

    • <attribute-value> is the attribute value

    • <target-node-id> is the node ID of the target door lock device

    • <target-endpoint-id> is the endpoint ID of the OTA Software Update Requestor cluster

    For example:

    chip-tool otasoftwareupdaterequestor write default-otaproviders '[{"fabricIndex": 1, "providerNodeID": 2, "endpoint": 0}]' 1 0
    
  5. Initiate the OTA update by announcing the OTA provider to the target device to start the update process.

    chip-tool otasoftwareupdaterequestor announce-otaprovider <provider-node-id> <vendor-id> <announcement-reason> <provider-endpoint-id> <target-node-id> <target-endpoint-id>
    

    Where

    • <provider-node-id> is the node ID of the OTA provider

    • <vendor-id> is the vendor ID

    • <announcement-reason> is the announcement reason (0 = simple announcement)

    • <provider-endpoint-id> is the endpoint ID of the OTA Software Update Provider cluster

    • <target-node-id> is the node ID of the target device

    • <target-endpoint-id> is the endpoint ID of the OTA Software Update Requestor cluster

    For example:

    chip-tool otasoftwareupdaterequestor announce-otaprovider 2 0 0 0 1 0
    
  6. Monitor the automatic OTA update process. Track the progress through the device and OTA provider logs. The device will reboot with the new firmware upon successful update:

    *** Booting My Application <new-version>-<sha> ***
    ...
    <inf> chip: [SWU] New firmware image confirmed
    

    Note

    The update process can take several minutes depending on the firmware size and network conditions. Do not power off the device during the update process.

DFU over Bluetooth LE SMP

The Matter and Aliro Door Lock Application supports field firmware updates over Bluetooth LE using the Simple Management Protocol (SMP protocol).

See Device Firmware Update over SMP and DFU SMP service.

Prerequisites

Before starting the DFU update process, ensure that:

  • The application is built with the dfu_smp snippet.

  • You have built the new application with a higher version number than the one currently running on the device. Set the version in the application VERSION file before building.

  • You have the firmware update image from the build directory (see Output build files in the nRF Connect SDK documentation).

Enabling Bluetooth LE SMP advertising

SMP advertising is not started automatically after boot, press Button 3 to toggle it.

Alternatively, you can use the shell commands:

uart:~$ dfu_smp on
uart:~$ dfu_smp off

Updating firmware

Set the application version in the applications/matter-aliro-door-lock-app/VERSION file before building the update image.

Upload the new firmware image to the device using one of the following methods:

Use nRF Connect Device Manager on a smartphone or tablet.

  1. Build the update image and locate build/dfu_application.zip in the build directory.

  2. Enable SMP advertising on the device (see above).

  3. Open nRF Connect Device Manager, scan for the device, and connect.

  4. Start the firmware update and select dfu_application.zip.

  5. Wait for the upload to finish; the device reboots with the new image.

For a step-by-step walkthrough, see the Nordic Developer Academy course DFU over Bluetooth LE using device manager app.