Skip to content

samples: Bluetooth: Broadcast multiple legacy and extended advertising #94304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

cvinayak
Copy link
Contributor

@cvinayak cvinayak commented Aug 10, 2025

Update broadcaster_multiple sample to start multiple advertising sets of type legacy and extended advertising.

How they appear on-air (BabbleSim import), for 4 advertising sets:
image

@cvinayak cvinayak force-pushed the github_broadcast_multiple_with_legacy branch 8 times, most recently from 49255ab to 771caba Compare August 10, 2025 21:00
Enable similar Controller Kconfig features between nRF52 and
nRF5340 BabbleSIM LE Audio testing.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Tune the aux offset calculation overhead assertion to use
EVENT_OVERHEAD_START_US; this is the correct maximum
overhead causing ISR latency for start of a radio event that
occurs thereafter.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Workaround by using `-start_offset` to ensure that the ACL
established does not overlap the sink being established.

Relates to commit 490da9e ("tests: bsim: Bluetooth:
Workaround overlapping ACL in BAP broadcast sink").

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Update broadcaster_multiple sample to start multiple
advertising sets of type legacy and extended advertising.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
@cvinayak cvinayak force-pushed the github_broadcast_multiple_with_legacy branch from 771caba to 7afe802 Compare August 11, 2025 04:29
Copy link

Copy link
Contributor

@Thalley Thalley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave the same comment here as I usually do when you modify the samples for testing purposes: IMO samples should not be used for this purpose, and should be kept as simple as possible. I don't think the changes to the sample here will help users, and it seems to only be done to help test some features, which should done in a separate test application, instead of (ab)using samples for test purposes

Comment on lines +91 to +113
/* Use Coded PHY */
if ((index % 4) == 3) {
adv_param.options = BT_LE_ADV_OPT_EXT_ADV;
adv_param.options |= BT_LE_ADV_OPT_CODED;
ad = ad_long;
ad_size = ARRAY_SIZE(ad_long);
/* Use 1M auxiliary PDU */
} else if ((index % 4) == 2) {
adv_param.options = BT_LE_ADV_OPT_EXT_ADV;
adv_param.options |= BT_LE_ADV_OPT_NO_2M;
ad = ad_long;
ad_size = ARRAY_SIZE(ad_long);
/* Use 2M auxiliary PDU */
} else if ((index % 4) == 1) {
adv_param.options = BT_LE_ADV_OPT_EXT_ADV;
ad = ad_long;
ad_size = ARRAY_SIZE(ad_long);
/* Use 1M legacy PDU */
} else {
adv_param.options = BT_LE_ADV_OPT_NONE;
ad = ad_short;
ad_size = ARRAY_SIZE(ad_short);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving this into a select function to simplify the loop.

Also consider storing this in an array like

struct {
    uint32_t options;
    const struct bt_data *ad;
    size_t ad_size
} adv_params[4];

So you can do things like (index % sizeof(adv_params) == 2U). Alternatively you can also make it a circular linked list and just get the next entry for each iteration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using an array is a better implementation, will update the PR.

printk("Failed to create advertising set %d (err %d)\n",
index, err);
/* Failed creating Coded PHY advertising set? */
if (adv_param.options & BT_LE_ADV_OPT_CODED) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (adv_param.options & BT_LE_ADV_OPT_CODED) {
if ((adv_param.options & BT_LE_ADV_OPT_CODED) != 0) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the changes to this file also be applied to the other bt_ll_sw_split files in hci_ipc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two added where the Kconfig defaults already... but made sense to have it here to be similar to one used for hci_uart, the overlay-all-bt_ll_sw_split.conf or the one used in audio bsim tests. Will review other files and make similar changes as required.

@cvinayak
Copy link
Contributor Author

I'll leave the same comment here as I usually do when you modify the samples for testing purposes: IMO samples should not be used for this purpose, and should be kept as simple as possible. I don't think the changes to the sample here will help users, and it seems to only be done to help test some features, which should done in a separate test application, instead of (ab)using samples for test purposes

There are no samples today demonstrating advertising both legacy and extended advertising (LL CI testing has coverage already); Certain phones do not fully/correctly support extended advertising and it has been a need to have advertising both legacy and extended in certain usecases to have a general inter-operability with phones not supporting versus ones that support.

Comment on lines +12 to +13
# Enable Coded PHY support in Zephyr Controller, if testing 4 advertising sets
# CONFIG_BT_CTLR_PHY_CODED=y
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhedberg Currently, the Controller specific is commented for this sample, do you agree that this be moved to a overlay and sample document/readme updated according to indicate the same, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

5 participants