Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion doc/nrf-bm/release_notes/release_notes_changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ No changes since the latest nRF Connect SDK Bare Metal release.
Bluetooth LE samples
--------------------

No changes since the latest nRF Connect SDK Bare Metal release.
* Added:

* The :ref:`ble_device_name_sample` sample.

NFC samples
-----------
Expand Down
12 changes: 12 additions & 0 deletions samples/bluetooth/ble_device_name/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright (c) 2026 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(ble_device_name)

target_sources(app PRIVATE src/main.c)
23 changes: 23 additions & 0 deletions samples/bluetooth/ble_device_name/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Copyright (c) 2026 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

menu "Bluetooth LE Device Name sample"

config SAMPLE_BLE_DEVICE_NAME
string "Device name"
default "nRF_BM_Device"

config SAMPLE_BM_ZMS_SECTOR_SIZE
int "Sector size"
default 512

endmenu

module=SAMPLE_BLE_DEVICE_NAME
module-str=BLE Device Name Sample
source "$(ZEPHYR_BASE)/subsys/logging/Kconfig.template.log_config"

source "Kconfig.zephyr"
86 changes: 86 additions & 0 deletions samples/bluetooth/ble_device_name/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
.. _ble_device_name_sample:

Bluetooth: Device name
#################################

.. contents::
:local:
:depth: 2

The device name sample demonstrates how the connected peer can change the Bluetooth LE GAP Device name characteristic using |BMlong| and how to store the name in non-volatile memory.

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

The sample supports the following development kits:

.. tabs::

.. group-tab:: Simple board variants

The following board variants do **not** have DFU capabilities:

.. include:: /includes/supported_boards_all_non-mcuboot_variants_s115.txt

.. include:: /includes/supported_boards_all_non-mcuboot_variants_s145.txt

.. group-tab:: MCUboot board variants

The following board variants have DFU capabilities:

.. include:: /includes/supported_boards_all_mcuboot_variants_s115.txt

.. include:: /includes/supported_boards_all_mcuboot_variants_s145.txt

Overview
********

The sample advertises with a configurable device name and allows any connected peer to write a new name to the GAP Device Name characteristic (UUID 0x2A00).
When a new name is written:

* The Bluetooth LE GAP name is updated in both the SoftDevice and in the advertising data.
* The device name is saved to non-volatile memory to persist across reboots and power loss.

During initialization, the sample reads the device name to use from non-volatile memory.
If none exists, it uses the devise name set by the :kconfig:option:`CONFIG_SAMPLE_BLE_DEVICE_NAME` Kconfig option.

User interface
**************

LED 0:
Lit when the device is initialized.

LED 1:
Lit when a device is connected.

Building and running
********************

This sample can be found under :file:`samples/bluetooth/ble_device_name/` in the |BMshort| folder structure.

For details on how to create, configure, and program a sample, see :ref:`getting_started_with_the_samples`.

Testing
=======

1. Compile and program the application.
#. Connect the device to the computer.
#. Connect to the kit with a terminal emulator (for example, the `Serial Terminal app`_).
#. Reset the kit.
#. Observe that ``Advertising as nRF_BM_Device`` is printed in the terminal.
You can configure the default name using :kconfig:option:`CONFIG_SAMPLE_BLE_DEVICE_NAME` Kconfig option.
#. Open the nRF Connect for Mobile or Desktop app and connect to the device.
#. In the GAP service, find the **Device Name** characteristic (UUID 0x2A00).
#. Read the current name to verify it matches the advertised name.
#. Write a new name (for example, ``MyDevice``).
#. Observe that the terminal prints::

Device name updated (8 bytes)
New name
4d 79 44 65 76 69 63 65 |MyDevice

#. Observe that ``Device name persisted to storage`` is printed shortly after.
#. Disconnect from the device.
#. Refresh and scan again using the nRF Connect for Mobile or Desktop.
#. Observe that the device now advertises with the new name ``MyDevice``.
#. Reset the kit and observe that the saved name is loaded from storage and used for advertising.
17 changes: 17 additions & 0 deletions samples/bluetooth/ble_device_name/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Logging
CONFIG_LOG=y
CONFIG_LOG_BACKEND_BM_UARTE=y

# SoftDevice
CONFIG_SOFTDEVICE=y

# RNG (required by SoftDevice)
CONFIG_NRF_SECURITY=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
CONFIG_PSA_WANT_GENERATE_RANDOM=y

# Advertising library
CONFIG_BLE_ADV=y

# ZMS
CONFIG_BM_ZMS=y
33 changes: 33 additions & 0 deletions samples/bluetooth/ble_device_name/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
sample:
name: Bluetooth LE Device Name Sample
tests:
sample.ble_device_name:
build_only: true
integration_platforms:
- bm_nrf54lv10dk/nrf54lv10a/cpuapp/s115_softdevice
platform_allow:
- bm_nrf54l15dk/nrf54l05/cpuapp/s115_softdevice
- bm_nrf54l15dk/nrf54l05/cpuapp/s115_softdevice/mcuboot
- bm_nrf54l15dk/nrf54l05/cpuapp/s145_softdevice
- bm_nrf54l15dk/nrf54l05/cpuapp/s145_softdevice/mcuboot
- bm_nrf54l15dk/nrf54l10/cpuapp/s115_softdevice
- bm_nrf54l15dk/nrf54l10/cpuapp/s115_softdevice/mcuboot
- bm_nrf54l15dk/nrf54l10/cpuapp/s145_softdevice
- bm_nrf54l15dk/nrf54l10/cpuapp/s145_softdevice/mcuboot
- bm_nrf54l15dk/nrf54l15/cpuapp/s115_softdevice
- bm_nrf54l15dk/nrf54l15/cpuapp/s115_softdevice/mcuboot
- bm_nrf54l15dk/nrf54l15/cpuapp/s145_softdevice
- bm_nrf54l15dk/nrf54l15/cpuapp/s145_softdevice/mcuboot
- bm_nrf54lm20dk/nrf54lm20a/cpuapp/s115_softdevice
- bm_nrf54lm20dk/nrf54lm20a/cpuapp/s115_softdevice/mcuboot
- bm_nrf54lm20dk/nrf54lm20a/cpuapp/s145_softdevice
- bm_nrf54lm20dk/nrf54lm20a/cpuapp/s145_softdevice/mcuboot
- bm_nrf54ls05dk/nrf54ls05b/cpuapp/s115_softdevice
- bm_nrf54ls05dk/nrf54ls05b/cpuapp/s115_softdevice/mcuboot
- bm_nrf54ls05dk/nrf54ls05b/cpuapp/s145_softdevice
- bm_nrf54ls05dk/nrf54ls05b/cpuapp/s145_softdevice/mcuboot
- bm_nrf54lv10dk/nrf54lv10a/cpuapp/s115_softdevice
- bm_nrf54lv10dk/nrf54lv10a/cpuapp/s115_softdevice/mcuboot
- bm_nrf54lv10dk/nrf54lv10a/cpuapp/s145_softdevice
- bm_nrf54lv10dk/nrf54lv10a/cpuapp/s145_softdevice/mcuboot
tags: ci_build
Loading
Loading