Configuring Bluetooth Mesh in nRF Connect SDK

The Bluetooth® mesh support is controlled by CONFIG_BT_MESH, which depends on the following configuration options:

Optional features configuration

Optional features in the Bluetooth Mesh stack must be explicitly enabled:

The persistent storage of the Bluetooth Mesh provisioning and configuration data is enabled by CONFIG_BT_SETTINGS. See the Persistent storage section of Bluetooth Stack Architecture for details.

Mesh models

The nRF Connect SDK Bluetooth Mesh model implementations are optional features, and each model has individual Kconfig options that must be explicitly enabled. See Bluetooth Mesh models for details.

Mesh settings/performance

The following configuration options are used to configure the behavior and performance of a Bluetooth Mesh network. For more information about configuration options affecting the memory footprint of Bluetooth Mesh, see memory footprint optimization guide for Bluetooth Mesh.

Additional configuration options

This section lists additional configuration options that can be used to configure behavior and performance of Bluetooth Mesh. The provided values are meant as suggestions only, and should be individually adjusted for each application.

Logging

  • CONFIG_NCS_SAMPLES_DEFAULTS - Enables the Zephyr system logger with minimal logging implementation. This is enabled by default for all samples in nRF Connect SDK. For more information, see Zephyr system logger.

  • CONFIG_LOG_MODE_DEFERRED - Enables deferred logging. Setting this configuration option is recommended to avoid slowing down the processing of mesh messages. It improves the LPN power consumption when the friendship is established.

  • CONFIG_LOG_BUFFER_SIZE - Sets the number of bytes dedicated for the logger internal buffer. Increase the number to avoid missing logs in case of a complex protocol or functionality issue.

  • CONFIG_LOG_PROCESS_THREAD_SLEEP_MS - Sets the sleep period for the internal log processing thread. Decrease the value to flush logs more quickly.

GATT Proxy performance

These options are only compatible with devices supporting Bluetooth Low Energy (LE) v4.2 or higher.

Bluetooth settings/performance

The following configuration options are used to configure the Bluetooth Low Energy behavior and performance:

Disabled and unused Bluetooth features

The following feature options are by default disabled in the samples, but it needs to be considered if any of them are required by the application and thus should be enabled:

Emergency data storage (EMDS)

The following configuration options should be considered in case of large networks with high demands on storing the replay protection list (RPL) data. This will require additional hardware. For more information, see Emergency data storage.

Low Power node (LPN)

The Low Power node (LPN) is a power optimization feature specific to Bluetooth Mesh.

The following configuration options are relevant when using the LPN feature:

Persistent storage

Zephyr’s Mesh implementation has been designed to use the settings subsystem to store internal states and options in the persistent storage. The settings subsystem can be used with different backends. Bluetooth Mesh is configured with the non-volatile storage (NVS) as the settings backend.

Using the settings subsystem based on NVS can in some cases result in a significant store time increase. In a worst case scenario, the store time can be up to several minutes. This can for example happen when storing a large size replay protection list. It is recommended to configure the settings subsystem’s internal caches to improve the performance.

  • The Settings NVS name cache reduces the number of search loops of internal parameter identifiers, keeping them in memory.

  • The size of the Settings NVS name cache is recommended to be set to the maximum number of devices the configured device communicates with. For example, if a device communicates with 255 other devices, it is worth setting the cache to minimum 255.

  • NVS lookup cache reduces the number of search loops within NVS’ application table.