zephyr/samples/bluetooth/mesh
Benjamin Cabé 776c0cab9a doc: boards: nordic: Adopt zephyr:board directives
Migrate all Nordic boards to leverage the full extent of zephyr:board
directives.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-03-31 22:00:02 +02:00
..
boards Bluetooth: Controller: Fix HCI command buffer allocation failure 2025-02-21 11:30:38 +00:00
src samples: fix zephyr/drivers/gpio.h usage 2024-12-18 18:15:15 +01:00
CMakeLists.txt
microbit_gatt.conf
prj.conf Bluetooth: Mesh: use secure storage in ble mesh 2025-01-14 13:23:47 +01:00
README.rst doc: boards: nordic: Adopt zephyr:board directives 2025-03-31 22:00:02 +02:00
sample.yaml

.. zephyr:code-sample:: ble_mesh
   :name: Mesh
   :relevant-api: bt_mesh bluetooth

   Use basic Bluetooth Mesh functionality.

Overview
********

This sample demonstrates Bluetooth Mesh functionality. It has several
standard mesh models, and supports provisioning over both the
Advertising and the GATT Provisioning Bearers (i.e. PB-ADV and PB-GATT).
The application also needs a functioning serial console, since that's
used for the Out-of-Band provisioning procedure.

On boards with LEDs, a Generic OnOff Server model exposes functionality for
controlling the first LED on the board over the mesh.

On boards with buttons, a Generic OnOff Client model will send Onoff messages
to all nodes in the network when the button is pressed.

Requirements
************

* A board with Bluetooth LE support, or
* QEMU with BlueZ running on the host

Building and Running
********************

This sample can be found under :zephyr_file:`samples/bluetooth/mesh` in the
Zephyr tree.

See :zephyr:code-sample-category:`bluetooth` samples for details on how
to run the sample inside QEMU.

For other boards, build and flash the application as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/bluetooth/mesh
   :board: <board>
   :goals: flash
   :compact:

Refer to your :ref:`board's documentation <boards>` for alternative
flash instructions if your board doesn't support the ``flash`` target.

To run the application on an :zephyr:board:`nrf5340dk`, a Bluetooth controller application
must also run on the network core. The :zephyr:code-sample:`bluetooth_hci_ipc` sample
application may be used. Build this sample with configuration
:zephyr_file:`samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf`
to enable mesh support.

Interacting with the sample
***************************

The sample can either be provisioned into an existing mesh network with an
external provisioner device, or self-provision through a button press.

When provisioning with a provisioner device, the provisioner must give the
device an Application key and bind it to both Generic OnOff models.

When self-provisioning, the device will take a random unicast address and
bind a dummy Application key to these models.

Once provisioned, messages to the Generic OnOff Server will be used to turn
the LED on or off, and button presses will be used to broadcast OnOff
messages to all nodes in the same network.