Skip to content

Commit 04f3a61

Browse files
committed
samples: DFU over Bluetooth SMP rework
- Add DFU over Bluetooth SMP support for the light bulb sample - Create a snippet for the Zigbee FOTA support, used by both light bulb and light switch samples - Update documentation with DFU over Bluetooth SMP support Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
1 parent 804716f commit 04f3a61

72 files changed

Lines changed: 1008 additions & 492 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/includes/matter_extension_activation.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ To produce a size-optimized release build (no logging, console or shell), add :f
2626

2727
Use ``nrf54lm20dk/nrf54lm20b/cpuapp`` as the board target for the nRF54LM20B SoC variant.
2828

29+
.. include:: /includes/matter_extension_bt_dfu.txt
30+
2931
See |sample matter limitations ref| for supported board targets and incompatible options.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Device firmware upgrade over Bluetooth SMP
2+
--------------------------------------------
3+
4+
The Matter extension builds include Matter over-the-air (OTA) update support through MCUboot by default.
5+
Device Firmware Upgrade (DFU) over Bluetooth LE using the Simple Management Protocol (SMP) is also enabled by default in the :file:`prj_matter_fota.conf` configuration selected by ``FILE_SUFFIX=matter_fota``.
6+
7+
Matter OTA and SMP DFU are independent transports.
8+
SMP is not part of the Matter specification.
9+
Use `mcumgr`_ or `nRF Connect Device Manager`_ to perform the update.
10+
11+
See |sample matter bt dfu testing ref| for step-by-step testing instructions.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
To test DFU over Bluetooth SMP, complete the following steps:
2+
3+
1. Build and flash the sample with the Matter extension (see |sample matter activating variants ref|).
4+
#. Ensure the device runs the Matter stack (see |sample matter testing ref|).
5+
#. Press Button 0 briefly.
6+
7+
* If the device is not commissioned to a Matter fabric, this starts both Matter commissioning advertising and the SMP server.
8+
* If the device is already commissioned, this re-enables only the SMP server for firmware transfer.
9+
10+
LED 0 blinks while Bluetooth LE advertising for SMP is active.
11+
#. Perform the update using one of the following methods:
12+
13+
* Smartphone — Install `nRF Connect Device Manager`_ and use :file:`dfu_application.zip` from the build directory.
14+
See `FOTA updates on nRF54L Series devices`_ (nRF54L15 and nRF54LM20 DKs) or `FOTA updates with nRF5340 DK`_ (nRF5340 DK).
15+
* PC (mcumgr) — Upload the signed application image from the build directory:
16+
17+
.. parsed-literal::
18+
:class: highlight
19+
20+
|matter mcumgr smp upload|
21+
22+
Then list images, mark the new slot as pending, and reset the device.
23+
See the `MCUmgr Command-line tool`_ page for the full mcumgr procedure (image upload, list, test, and reset).
24+
25+
The Bluetooth LE advertised name is |bt device name| (set by ``CONFIG_BT_DEVICE_NAME`` in :file:`prj_matter_fota.conf`).
26+
27+
After the update, MCUboot applies the new image on the next reboot.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Activating optional extensions
2+
------------------------------
3+
4+
To activate the :ref:`lib_zigbee_fota`, use the :file:`prj_fota.conf` configuration file together with the ``zigbee_fota_ext_flash`` snippet.
5+
The snippet provides external-flash partition layouts, sysbuild MCUboot settings, and the matching MCUboot configuration (via ``zigbee_fota_mcuboot_ext_flash``).
6+
For example, when building from the command line, use the following command:
7+
8+
.. parsed-literal::
9+
:class: highlight
10+
11+
west build |sample dir| -b *board_target* -- -DFILE_SUFFIX=fota -DSNIPPET=zigbee_fota_ext_flash
12+
13+
The FOTA variant enables `MCUboot image compression`_.
14+
The generated Zigbee update file contains a compressed MCUboot image, and MCUboot decompresses it while applying the update.
15+
This setting reduces the update image size, but the MCUboot must run in the overwrite-only mode, so the device cannot revert to the previous image after the update is applied.
16+
17+
Alternatively, you can :ref:`configure Zigbee FOTA manually <ug_zigbee_configuring_components_ota>`.
18+
19+
.. note::
20+
The decompression support increases the size of the MCUboot image.
21+
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.
22+
The FOTA variant uses devicetree-based partitioning with Partition Manager disabled; see :ref:`zigbee_ug_static_partition` for the partition layout requirements.
23+
24+
Device firmware upgrade over Bluetooth SMP (Zigbee-only builds)
25+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26+
27+
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:
28+
29+
.. parsed-literal::
30+
:class: highlight
31+
32+
west build |sample dir| -b *board_target* -- -DFILE_SUFFIX=fota -DSNIPPET=zigbee_fota_ext_flash -DCONFIG_ZIGBEE_BT_DFU=y
33+
34+
This option enables the MCUmgr SMP server over Bluetooth LE alongside :ref:`lib_zigbee_fota`.
35+
It cannot be combined with the |sample matter ref| (``CONFIG_CHIP``).
36+
For Matter extension builds, SMP DFU is provided through ``CONFIG_CHIP_DFU_OVER_BT_SMP`` instead.
37+
38+
See |sample zigbee bt dfu testing ref| for step-by-step testing instructions.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
To test DFU over Bluetooth SMP in a Zigbee-only build, complete the following steps:
2+
3+
1. Build and flash the sample with ``CONFIG_ZIGBEE_BT_DFU=y`` (see |sample activating variants ref|).
4+
#. After the device boots, it starts Bluetooth LE connectable advertising for the SMP server automatically.
5+
The advertised name is |zigbee bt device name| (set by ``CONFIG_BT_DEVICE_NAME`` when ``CONFIG_ZIGBEE_BT_DFU`` is enabled).
6+
#. Perform the update using one of the following methods:
7+
8+
* Smartphone — Install `nRF Connect Device Manager`_ and use :file:`dfu_application.zip` from the build directory.
9+
See `FOTA updates on nRF54L Series devices`_ (nRF54L15 and nRF54LM20 DKs) or `FOTA updates with nRF5340 DK`_ (nRF5340 DK).
10+
* PC (mcumgr) — Upload the signed application image from the build directory:
11+
12+
.. parsed-literal::
13+
:class: highlight
14+
15+
|zigbee mcumgr smp upload|
16+
17+
Then list images, mark the new slot as pending, and reset the device.
18+
See the `MCUmgr Command-line tool`_ page for the full mcumgr procedure (image upload, list, test, and reset).
19+
20+
Zigbee OTA and SMP DFU are independent transports.
21+
SMP is not part of the Zigbee specification.
22+
Use `mcumgr`_ or `nRF Connect Device Manager`_ to perform the update over Bluetooth LE.
23+
24+
After the update, MCUboot applies the new image on the next reboot.

docs/links.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@
4848
.. _`Release notes for the nRF Connect SDK`: https://docs.nordicsemi.com/bundle/ncs-3.2.0/page/nrf/releases_and_maturity/release_notes.html
4949

5050
.. _`CHIP Tool`: https://docs.nordicsemi.com/bundle/ncs-3.2.0/page/matter/chip_tool_guide.html
51+
.. _`mcumgr`: https://docs.nordicsemi.com/bundle/ncs-3.2.0/page/zephyr/services/device_mgmt/mcumgr.html
52+
.. _`nRF Connect Device Manager`: https://www.nordicsemi.com/Products/Development-tools/nrf-connect-device-manager
53+
.. _`FOTA updates on nRF54L Series devices`: https://docs.nordicsemi.com/bundle/ncs-3.2.0/page/nrf/app_dev/device_guides/nrf54l/fota_update.html
54+
.. _`FOTA updates with nRF5340 DK`: https://docs.nordicsemi.com/bundle/ncs-3.2.0/page/nrf/app_dev/device_guides/nrf53/fota_update_nrf5340.html
55+
.. _`MCUmgr Command-line tool`: https://docs.nordicsemi.com/bundle/ncs-3.2.0/page/nrf/app_dev/bootloaders_dfu/dfu_tools_mcumgr_cli.html
5156

5257
.. _`DFU over Zigbee`: https://docs.nordicsemi.com/bundle/nrfutil/page/guides-nrf5sdk/dfu_performing.html#dfu-over-zigbee
5358

samples/light_bulb/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ endchoice
1717

1818
endif # OPENTHREAD
1919

20+
if ZIGBEE_BT_DFU
21+
22+
config BT_DEVICE_NAME
23+
default "Zigbee_Bulb"
24+
25+
endif # ZIGBEE_BT_DFU
26+
2027
config MPSL_THREAD_COOP_PRIO
2128
default 8
2229

samples/light_bulb/Kconfig.sysbuild

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,39 @@ endchoice
2020

2121
endif # MATTER
2222

23+
if BOOTLOADER_MCUBOOT
24+
25+
#### DFU multi-image support
26+
config DFU_MULTI_IMAGE_PACKAGE_BUILD
27+
default y
28+
29+
config DFU_MULTI_IMAGE_PACKAGE_APP
30+
default y
31+
32+
#### DFU dual core configuration
33+
if SOC_SERIES_NRF53
34+
35+
config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY
36+
default y
37+
38+
config MCUBOOT_UPDATEABLE_IMAGES
39+
default 2
40+
41+
choice MCUBOOT_MODE
42+
default MCUBOOT_MODE_OVERWRITE_ONLY
43+
endchoice
44+
45+
config SECURE_BOOT_NETCORE
46+
default y
47+
48+
config NETCORE_APP_UPDATE
49+
default y
50+
51+
config DFU_MULTI_IMAGE_PACKAGE_NET
52+
default y
53+
54+
endif # SOC_SERIES_NRF53
55+
56+
endif # BOOTLOADER_MCUBOOT
57+
2358
source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"

samples/light_bulb/README.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ Configuration
8282

8383
|config|
8484

85+
Source file setup
86+
=================
87+
88+
This sample is split into the following source files:
89+
90+
* The :file:`main` file is the application entry point only.
91+
* The :file:`app_task_zigbee` file manages the application task flow, user input handling, and Zigbee-specific startup and control logic.
92+
It also implements the dimmable light device behavior, including cluster handling and PWM-based brightness control.
93+
* The :file:`app_task_matter` file is used in the Matter extension build only.
94+
It implements the Matter application task flow, button input, and On/Off and Level Control cluster state for the dimmable light endpoint.
95+
8596
..
8697
FEM support
8798
===========
@@ -93,10 +104,20 @@ Configuration
93104
Configuration files for sample extensions
94105
=========================================
95106

107+
The sample provides predefined configuration files for optional extensions.
108+
You can find the configuration files in the :file:`samples/light_bulb` directory.
109+
96110
.. |sample matter ref| replace:: :ref:`zigbee_light_bulb_sample_matter`
97111
.. |sample matter limitations ref| replace:: :ref:`zigbee_light_bulb_matter_limitations`
112+
.. |sample matter bt dfu testing ref| replace:: :ref:`zigbee_light_bulb_testing_matter_bt_dfu`
113+
.. |sample matter testing ref| replace:: :ref:`zigbee_light_bulb_testing_matter`
114+
.. |sample matter activating variants ref| replace:: :ref:`zigbee_light_bulb_activating_variants`
115+
.. |sample activating variants ref| replace:: :ref:`zigbee_light_bulb_activating_variants`
116+
.. |sample zigbee bt dfu testing ref| replace:: :ref:`zigbee_light_bulb_testing_zigbee_bt_dfu`
98117
.. |sample dir| replace:: samples/light_bulb
99118

119+
.. include:: /includes/zigbee_bt_dfu_activation.txt
120+
100121
.. include:: /includes/matter_extension_activation.txt
101122

102123
User interface
@@ -263,6 +284,27 @@ Complete the following steps to exercise the full Zigbee-to-Matter flow:
263284
* Or trigger a Matter factory reset from the controller (for example, ``chip-tool pairing unpair …``).
264285
The device reboots as a fresh Zigbee Router with Matter Bluetooth LE advertising active again, and Matter storage is cleared.
265286

287+
.. _zigbee_light_bulb_testing_matter_bt_dfu:
288+
289+
Testing Matter extension DFU over Bluetooth SMP
290+
-----------------------------------------------
291+
292+
.. |bt device name| replace:: MatterZigbee
293+
.. |app name| replace:: light_bulb
294+
.. |matter mcumgr smp upload| replace:: mcumgr --conntype ble --hci 0 --connstring peer_name='MatterZigbee' image upload build/light_bulb/zephyr/zephyr.signed.bin
295+
296+
.. include:: /includes/matter_extension_bt_dfu_testing.txt
297+
298+
.. _zigbee_light_bulb_testing_zigbee_bt_dfu:
299+
300+
Testing Zigbee FOTA DFU over Bluetooth SMP
301+
------------------------------------------
302+
303+
.. |zigbee bt device name| replace:: Zigbee_Bulb
304+
.. |zigbee mcumgr smp upload| replace:: mcumgr --conntype ble --hci 0 --connstring peer_name='Zigbee_Bulb' image upload build/light_bulb/zephyr/zephyr.signed.bin
305+
306+
.. include:: /includes/zigbee_bt_dfu_testing.txt
307+
266308
Dependencies
267309
************
268310

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2026 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#include <nrf52840_partitions.dtsi>
8+
#include <ext_flash/nrf52840dk_partitions.dtsi>
9+
10+
/ {
11+
pwmleds {
12+
pwm_led3: pwm_led_3 {
13+
pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
14+
};
15+
};
16+
17+
chosen {
18+
ncs,zigbee-timer = &timer2;
19+
};
20+
};
21+
22+
&pwm0 {
23+
pinctrl-0 = <&pwm0_default_alt>;
24+
pinctrl-1 = <&pwm0_sleep_alt>;
25+
pinctrl-names = "default", "sleep";
26+
};
27+
28+
&pinctrl {
29+
pwm0_default_alt: pwm0_default_alt {
30+
group1 {
31+
psels = <NRF_PSEL(PWM_OUT1, 0, 16)>;
32+
nordic,invert;
33+
};
34+
};
35+
36+
pwm0_sleep_alt: pwm0_sleep_alt {
37+
group1 {
38+
psels = <NRF_PSEL(PWM_OUT1, 0, 16)>;
39+
low-power-enable;
40+
};
41+
};
42+
};
43+
44+
&timer2 {
45+
status = "okay";
46+
};

0 commit comments

Comments
 (0)