Multiple Advertising Sets

Background

Bluetooth 5 introduces a number of useful new features, such as multiple advertising sets. This feature supports having more than one advertising sets concurrently without having to stop and restart advertising.

All parameters including the advertising interval, advertising data, discoverability, connectability and number of advertisements to send before stopping can be configured independently for each advertising set. The most relevant APIs for configuring advertising sets are discussed below.

Maximum Advertising Sets

To enable multiple advertising, the MAX_ADVERTISERS value should be set greater than one. The default value is 1.

Advertising Data

To set the advertising data, use the API gecko_cmd_le_gap_bt5_set_adv_data(handle, scan_rsp, adv_data_len, adv_data_data), where:

Maximum Advertising Power

Users can also set the maximum advertising TX power on a given advertising set by calling the API gecko_cmd_le_gap_set_advertise_tx_power(handle,power), where power is the TX power in units of 0.1 dBm on a given advertising set specified by handle. For instance, value of 80 sets the TX power to 8dBm.

Note that if the TX power value goes over the global value that was set using gecko_cmd_system_set_tx_power command, the global value will be the maximum limit.

Advertising Parameters

To control advertising parameters , use gecko_cmd_le_gap_set_advertise_timing(handle, interval_min, interval_max, duration, maxevents), where:

Start Advertising

Finally, advertising on a given advertising set can be started using gecko_cmd_le_gap_start_advertising(handle, discover, connect), where

Note that the number of concurrent advertising is limited by the MAX_ADVERTISERS configuration discussed above. Similarly, the number of connectable advertising is also limited by MAX_CONNECTIONS configuration. For example, only one connectable advertising can be enabled if the device has (MAX_CONNECTIONS - 1) connections when this command is called. The limitation does not apply to non-connectable advertising, though.

Description

The example code below demonstrates multiple advertising features in Bluetooth 5. Two advertising sets, one connnectable, and another non-connectable (iBeacon), are configured separately using their respective handles. The advertising interval and TX power values used for each advertising set is different so that they can easily be distinguished from the Energy Profile perspective in Simplicity Studio.

In addition to debug print out messages, LED0 is used to indicate the connection status. Follow the instructions below and verify the result using the Energy Profile perspective in Simplicity Studio, and the LED0 status on the controller board.

Setting up

  1. Create a new SOC - Empty project in Simplicity Studio.

  2. Open app.c and app.h file and replace the content in each file with the respective contents provided under source.

  3. Build the project and download to your target device.

Usage

  1. Open Energy Profile perspective in Simplicity Studio and Start Energy Capture on your device (Quick Access menu). You should be able to see the following linear plot for the current consumption of your device.

  2. Open EFR Connect app and try to connect with your target device. LED0 will be ON when connection is established. Meanwhile, beacons are still broadcast.

  3. Disconnect the connection and the advertising should start again. The following figure shows the debug print out messages.

Source

app.c

app.h