Bluetooth: Multiple advertising sets
The Multiple advertising sets sample demonstrates how to use the Bluetooth® advertising sets.
The sample supports the following development kits:
When built for an
_ns build target, the sample is configured to compile and run as a non-secure application with Cortex-M Security Extensions enabled.
Therefore, it automatically includes Trusted Firmware-M that prepares the required peripherals and secure services to be available for the application.
For testing this sample, you need to have the nRF Connect for Mobile app installed on your smartphone or tablet.
The sample implements two advertising sets:
Non-connectable advertising with the URI to the https://www.nordicsemi.com website in the advertising data. It shows the Bluetooth Broadcaster role (Beacon) functionality.
Connectable advertising with the 16-bit UUID of the Device Information GATT Service in the advertising data. It shows the Bluetooth Peripheral role functionality.
When you start the sample, it creates two advertising sets. Use your scanner device to observe the two advertisers:
Nordic Beaconthat you can use to open the nRF Beacon website.
Nordic multi adv setsthat you can use to establish a connection with the device.
Use your central device to establish the connection with this sample. When connected, the non-connectable advertiser is still shown on your scanner device. After disconnection, the connectable advertising starts again.
- LED 1:
Blinks with a period of two seconds with the duty cycle set to 50% when the main loop is running and the device is advertising.
- LED 2:
Lit when the development kit is connected.
Building and running
This sample can be found under
samples/bluetooth/multiple_adv_sets in the nRF Connect SDK folder structure.
When built as firmware image for the
_ns build target, the sample has Cortex-M Security Extensions (CMSE) enabled and separates the firmware between Non-Secure Processing Environment (NSPE) and Secure Processing Environment (SPE).
Because of this, it automatically includes the Trusted Firmware-M (TF-M).
To read more about CMSE, see Processing environments.
To build the sample with Visual Studio Code, follow the steps listed on the How to build an application page in the nRF Connect for VS Code extension documentation. See Building and programming an application for other building and programming scenarios and Testing and debugging an application for general information about testing and debugging in the nRF Connect SDK.
After programming the sample to your dongle or development kit, test it by performing the following steps:
Connect to the kit that runs this sample with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.
Reset the kit.
Start the nRF Connect for Mobile application on your smartphone or tablet.
The device is advertising as
Nordic multi adv setsand
Select the connectable variant and connect to the device from the application.
In the SCANNER tab check if
Nordic Beaconis still advertising.
You can use it to open the Nordic website.
Disconnect from the device.
In the SCANNER tab, check again if there is an advertiser with the name
Nordic multi adv sets.
This sample uses the following nRF Connect SDK libraries:
In addition, it uses the following Zephyr libraries:
The sample also uses the following secure firmware component: