Bluetooth: Multiple advertising sets

The Multiple advertising sets sample demonstrates how to use the Bluetooth® advertising sets.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Build target

nRF5340 DK

PCA10095

nrf5340dk_nrf5340

nrf5340dk_nrf5340_cpuapp

nrf5340dk_nrf5340_cpuapp_ns

nRF52840 DK

PCA10056

nrf52840dk_nrf52840

nrf52840dk_nrf52840

nRF52 DK

PCA10040

nrf52dk_nrf52832

nrf52dk_nrf52832

nRF52833 DK

PCA10100

nrf52833dk_nrf52833

nrf52833dk_nrf52833

nRF52833 DK (emulating nRF52820)

PCA10100

nrf52833dk_nrf52820

nrf52833dk_nrf52820

nRF21540 DK

PCA10112

nrf21540dk_nrf52840

nrf21540dk_nrf52840

Overview

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 Beacon that you can use to open the nRF Beacon website.

  • Nordic multi adv sets that 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 presented on your scanner device. After disconnection, the connectable advertising starts again.

User interface

LED 1:

Blinks when the main loop is running (that is, the device is advertising) with a period of two seconds, duty cycle 50%.

LED 2:

On 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.

See Building and programming an application for information about how to build and program the application.

Testing

After programming the sample to your dongle or development kit, test it by performing the following steps:

  1. 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.

  2. Reset the kit.

  3. Start the nRF Connect for Mobile application on your smartphone or tablet.

    The device is advertising as Nordic multi adv sets and Nordic Beacon.

  4. Select the connectable variant and connect to the device from the application.

  5. On the scanner tab check if Nordic Beacon still advertises.

    You can use it to open the Nordic website.

  6. Disconnect from the device.

  7. In the scanner tab, check again if there is an advertiser with the name Nordic multi adv sets.

Dependencies

This sample uses the following nRF Connect SDK libraries:

In addition, it uses the following Zephyr libraries:

  • include/kernel.h

  • Bluetooth:

    • include/bluetooth/bluetooth.h

    • include/bluetooth/conn.h

    • include/bluetooth/uuid.h

    • include/bluetooth/services/dis.h