-
Notifications
You must be signed in to change notification settings - Fork 23
samples: DFU over Bluetooth SMP rework #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| Device firmware upgrade over Bluetooth SMP | ||
| ------------------------------------------ | ||
|
|
||
| You can update your device's firmware over the air using two methods, both enabled by default in the Matter extension builds: | ||
|
|
||
| * Matter OTA – Updates your device through MCUboot, satisfying the Matter specification's requirement to support at least one over-the-air software update method. | ||
|
|
||
| * Device Firmware Upgrade (DFU) over Bluetooth LE – Updates your device using the `Simple Management Protocol`_ (SMP). | ||
| To enable this method, select the :file:`prj_matter_fota.conf` configuration by setting the ``FILE_SUFFIX=matter_fota`` option. | ||
|
|
||
| Matter OTA and SMP DFU are independent transports. | ||
| SMP is not part of the Matter specification. | ||
| Use `mcumgr`_ or `nRF Connect Device Manager`_ to perform the update. | ||
|
|
||
| For step-by-step instructions on testing the update process, see |sample matter bt dfu testing ref|. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| To test DFU over Bluetooth LE SMP, complete the following steps: | ||
|
|
||
| 1. Build and flash the sample with the Matter extension (see |sample matter activating variants ref|). | ||
| #. Confirm the device is running the Matter stack (see |sample matter testing ref|). | ||
| #. Briefly press **Button 0** to start Bluetooth LE advertising for SMP. | ||
|
|
||
| The behavior depends on the device's commissioning state: | ||
|
|
||
| * If the device is not commissioned to a Matter fabric, this starts both Matter commissioning advertising and the SMP server. | ||
| * If the device is already commissioned, this re-enables only the SMP server for firmware transfer. | ||
|
|
||
| **LED 0** blinks while Bluetooth LE advertising for SMP is active. | ||
| The advertised device name is |bt device name|, set by the ``CONFIG_BT_DEVICE_NAME`` Kconfig option in the :file:`prj_matter_fota.conf` file. | ||
|
|
||
| #. Perform the update using one of the following methods: | ||
|
|
||
| .. tabs:: | ||
|
|
||
| .. group-tab:: Smartphone | ||
|
|
||
| a. Install `nRF Connect Device Manager`_. | ||
| #. Use the :file:`dfu_application.zip` file from the build directory. | ||
|
|
||
| For detailed instructions, see `FOTA updates on nRF54L Series devices`_ (nRF54L15 and nRF54LM20 DKs) or `FOTA updates with nRF5340 DK`_ (nRF5340 DK) depending on the device you are using. | ||
|
|
||
| .. group-tab:: PC (mcumgr) | ||
|
|
||
| Upload the signed images from the build directory: | ||
|
|
||
| * On single-core SoCs (for example, nRF54L Series), upload the application image: | ||
|
|
||
| .. parsed-literal:: | ||
| :class: highlight | ||
|
|
||
| |matter mcumgr smp upload| | ||
|
|
||
| * On dual-core SoCs (for example, nRF5340 DK), upload the application and network core images separately: | ||
|
|
||
| .. parsed-literal:: | ||
| :class: highlight | ||
|
|
||
| |matter mcumgr smp upload| | ||
|
|
||
| |matter mcumgr net smp upload| | ||
|
|
||
| After uploading, list the images, mark each new slot as pending, and reset the device. | ||
| For the full procedure, see `Performing Device Firmware Upgrade in the nRF Connect examples`_. | ||
|
|
||
| After the update completes, MCUboot applies the new image on the next reboot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| Activating optional extensions | ||
| ------------------------------ | ||
|
|
||
| To activate the :ref:`lib_zigbee_fota`, use the :file:`prj_fota.conf` configuration file together with the ``zigbee_fota_ext_flash`` snippet. | ||
| The snippet provides external-flash partition layouts, sysbuild MCUboot settings, and the matching MCUboot configuration (through ``zigbee_fota_mcuboot_ext_flash``). | ||
| For example, when building from the command line, use the following command: | ||
|
|
||
| .. parsed-literal:: | ||
| :class: highlight | ||
|
|
||
| west build |sample dir| -b *board_target* -- -DFILE_SUFFIX=fota -DSNIPPET=zigbee_fota_ext_flash | ||
|
|
||
| The FOTA variant enables `MCUboot image compression`_. | ||
| The generated Zigbee update file contains a compressed MCUboot image, and MCUboot decompresses it while applying the update. | ||
| This setting reduces the size of the update image. | ||
| However, it requires MCUboot to run in overwrite-only mode, which means the device cannot revert to the previous image after an update is applied. | ||
|
|
||
| Alternatively, you can :ref:`configure Zigbee FOTA manually <ug_zigbee_configuring_components_ota>`. | ||
|
|
||
| .. note:: | ||
| The decompression support increases the size of the MCUboot image. | ||
| When adapting this FOTA configuration to a custom board or application, make sure that the MCUboot partition is large enough for the generated bootloader image. | ||
| The FOTA variant uses devicetree-based partitioning with Partition Manager disabled; see :ref:`zigbee_ug_static_partition` for the partition layout requirements. | ||
|
|
||
| Device firmware upgrade over Bluetooth SMP (Zigbee-only builds) | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| To additionally enable Device Firmware Upgrade (DFU) over Bluetooth LE using the Simple Management Protocol (SMP) in a Zigbee-only build, add ``CONFIG_ZIGBEE_BT_DFU=y`` to the FOTA build command: | ||
|
|
||
| .. parsed-literal:: | ||
| :class: highlight | ||
|
|
||
| west build |sample dir| -b *board_target* -- -DFILE_SUFFIX=fota -DSNIPPET=zigbee_fota_ext_flash -DCONFIG_ZIGBEE_BT_DFU=y | ||
|
|
||
| This option enables the MCUmgr SMP server over Bluetooth LE alongside :ref:`lib_zigbee_fota`. | ||
| It cannot be combined with the |sample matter ref| (``CONFIG_CHIP``). | ||
| For Matter extension builds, SMP DFU is provided through ``CONFIG_CHIP_DFU_OVER_BT_SMP`` instead. | ||
|
|
||
| See |sample zigbee bt dfu testing ref| for step-by-step testing instructions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| To test DFU over Bluetooth SMP in a Zigbee-only build, complete the following steps: | ||
|
|
||
| 1. Build and flash the sample with the ``CONFIG_ZIGBEE_BT_DFU=y`` Kconfig option (see |sample activating variants ref|). | ||
| #. Wait for the device to boot. | ||
|
|
||
| After booting, the device automatically starts Bluetooth LE connectable advertising for the SMP server. | ||
| The advertised device name is |zigbee bt device name|, set by ``CONFIG_BT_DEVICE_NAME`` when ``CONFIG_ZIGBEE_BT_DFU`` is enabled. | ||
|
|
||
| #. Perform the update using one of the following methods: | ||
|
|
||
| .. tabs:: | ||
|
|
||
| .. group-tab:: Smartphone | ||
|
|
||
| a. Install `nRF Connect Device Manager`_. | ||
| #. Use the :file:`dfu_application.zip` file from the build directory. | ||
|
|
||
| For detailed instructions, see `FOTA updates on nRF54L Series devices`_ (nRF54L15 and nRF54LM20 DKs) or `FOTA updates with nRF5340 DK`_ (nRF5340 DK). | ||
|
|
||
| .. group-tab:: PC (mcumgr) | ||
|
|
||
| Upload the signed application image from the build directory: | ||
|
|
||
| .. parsed-literal:: | ||
| :class: highlight | ||
|
|
||
| |zigbee mcumgr smp upload| | ||
|
|
||
| After uploading, list the images, mark the new slot as pending, and reset the device. | ||
| For the full procedure (image upload, list, test, and reset), see the `MCUmgr Command-line tool`_ page. | ||
|
|
||
| After the update completes, MCUboot applies the new image on the next reboot. | ||
|
|
||
| .. note:: | ||
| Zigbee OTA and SMP DFU are independent transports, and SMP is not part of the Zigbee specification. | ||
| You can use either `mcumgr`_ or `nRF Connect Device Manager`_ to perform the update over Bluetooth LE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
samples/light_bulb/boards/nrf52840dk_nrf52840_fota.overlay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * Copyright (c) 2026 Nordic Semiconductor ASA | ||
| * | ||
| * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
| */ | ||
|
|
||
| #include <nrf52840_partitions.dtsi> | ||
| #include <ext_flash/nrf52840dk_partitions.dtsi> | ||
|
|
||
| / { | ||
| pwmleds { | ||
| pwm_led3: pwm_led_3 { | ||
| pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>; | ||
| }; | ||
| }; | ||
|
|
||
| chosen { | ||
| ncs,zigbee-timer = &timer2; | ||
| }; | ||
| }; | ||
|
|
||
| &pwm0 { | ||
| pinctrl-0 = <&pwm0_default_alt>; | ||
| pinctrl-1 = <&pwm0_sleep_alt>; | ||
| pinctrl-names = "default", "sleep"; | ||
| }; | ||
|
|
||
| &pinctrl { | ||
| pwm0_default_alt: pwm0_default_alt { | ||
| group1 { | ||
| psels = <NRF_PSEL(PWM_OUT1, 0, 16)>; | ||
| nordic,invert; | ||
| }; | ||
| }; | ||
|
|
||
| pwm0_sleep_alt: pwm0_sleep_alt { | ||
| group1 { | ||
| psels = <NRF_PSEL(PWM_OUT1, 0, 16)>; | ||
| low-power-enable; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| &timer2 { | ||
| status = "okay"; | ||
| }; |
49 changes: 49 additions & 0 deletions
49
samples/light_bulb/boards/nrf5340dk_nrf5340_cpuapp_fota.overlay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /* | ||
| * Copyright (c) 2026 Nordic Semiconductor ASA | ||
| * | ||
| * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
| */ | ||
|
|
||
| #include <nrf5340_cpuapp_partitions.dtsi> | ||
| #include <ext_flash/nrf5340dk_cpuapp_partitions.dtsi> | ||
|
|
||
| / { | ||
| pwmleds { | ||
| compatible = "pwm-leds"; | ||
|
|
||
| pwm_led3: pwm_led_3 { | ||
| pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>; | ||
| }; | ||
| }; | ||
|
|
||
| chosen { | ||
| ncs,zigbee-timer = &timer2; | ||
| }; | ||
| }; | ||
|
|
||
| &pwm0 { | ||
| status = "okay"; | ||
| pinctrl-0 = <&pwm0_default_alt>; | ||
| pinctrl-1 = <&pwm0_sleep_alt>; | ||
| pinctrl-names = "default", "sleep"; | ||
| }; | ||
|
|
||
| &pinctrl { | ||
| pwm0_default_alt: pwm0_default_alt { | ||
| group1 { | ||
| psels = <NRF_PSEL(PWM_OUT1, 0, 31)>; | ||
| nordic,invert; | ||
| }; | ||
| }; | ||
|
|
||
| pwm0_sleep_alt: pwm0_sleep_alt { | ||
| group1 { | ||
| psels = <NRF_PSEL(PWM_OUT1, 0, 31)>; | ||
| low-power-enable; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| &timer2 { | ||
| status = "okay"; | ||
| }; |
8 changes: 8 additions & 0 deletions
8
samples/light_bulb/boards/nrf54l15dk_nrf54l10_cpuapp_fota.overlay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| /* | ||
| * Copyright (c) 2026 Nordic Semiconductor ASA | ||
| * | ||
| * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
| */ | ||
|
|
||
| #include <nrf54l10_cpuapp_partitions.dtsi> | ||
| #include <ext_flash/nrf54l10dk_cpuapp_partitions.dtsi> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.