Skip to content

Conversation

@Thalley
Copy link
Contributor

@Thalley Thalley commented Nov 11, 2024

Update the connection and advertising intervals of the
broadcast and connected ISO samples (including benchmark
samples) to work better with the selected SDU intervals
and the resulting ISO intervals.

@Thalley Thalley force-pushed the iso_samples_intervals branch 3 times, most recently from 370d61d to a154502 Compare November 18, 2024 19:29
@Thalley Thalley self-assigned this Nov 18, 2024
@Thalley Thalley marked this pull request as ready for review November 18, 2024 23:58
@zephyrbot zephyrbot added area: Samples Samples area: Bluetooth area: Bluetooth ISO Bluetooth LE Isochronous Channels labels Nov 18, 2024
Copy link
Contributor

@rugeGerritsen rugeGerritsen left a comment

Choose a reason for hiding this comment

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

It would be nice if the commit message could state that the workarounds applied are specific to the Zephyr Bluetooth Controller and may not be needed for others. It would also be nice to document with meant with "works better with". Maybe something like: "These changes ensure that the controller selects conflict-free scheduling patterns to avoid packet loss".

Also, there is a typo in the commit header Bluetoot -> Bluetooth :)

Added some other minor comments

Copy link
Contributor

Choose a reason for hiding this comment

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

Some controllers are able to select a "good" connection interval if the connection interval range passed to the controller is sufficiently large. Can the zephyr controller do that?

That would result in a simpler implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At this point the controller would be unaware of any future ISO connections, and can thus not decide on a good interval that works with the future and unknown ISO interval, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

This depends a bit upon if the application uses the test command or not. If not using the test command, the controller can select an ISO interval which fits with the other activities.

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 controller can select an ISO interval which fits with the other activities.

To some extend; for unframed ISO the ISO interval shall be a multiple of the SDU inteval.

But are you suggesting that I revert this change, and leave it up to the controller?
Alternatively we can also ask the user for the conn parameters, as we do for the ISO parameters

Copy link
Contributor

Choose a reason for hiding this comment

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

Some controllers are able to select a "good" connection interval if the connection interval range passed to the controller is sufficiently large. Can the zephyr controller do that?

As the CIG has not been established yet (or never requested under non ISO applications), Zephyr Controller uses the minimum requested connection interval.

Applications can perform a connection update, if required, post CIS established; again, Zephyr Controller will only use the minimum connection interval but use a window offset to place the ACL in a non-overlapping offset wrt the CIS.

As applications could give incompatible min-max connection interval that can have overlapping intervals with CIS, the complexity in the Controller to have a resolution is not justified.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could a generic solution instead be:

  1. Create CIG
  2. Connect ACL
  3. Connect CIS

This sample is today doing

  1. Connect ACL
  2. Create CIG
  3. Connect CIS

Would it help creating the CIG before establishing the ACL to help the controller pick reasonable ACL intervals?
Or is it better to create the ACL first so that the controller can pick reasonable ISO intervals, assuming that the test params are not used?

Ideally the host should just sending a reasonable interval range and have the controller do the intervals, as that is (or should be) controller agnostic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could a generic solution instead be:

Create CIG
Connect ACL
Connect CIS

Modified the sample to do this instead. That should give the controller as much information as possible to select the best ISO and ACL intervals, and should be a controller agnostic solution.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a comment:

Suggested change
*/
* Other controllers are able to generate conflict-free scheduling patterns without setting the advertising interval
* in this way.
*/

Copy link
Contributor Author

@Thalley Thalley Nov 19, 2024

Choose a reason for hiding this comment

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

Sure :) This one is very specific to ZLL, and not 100% sure if host samples should assume that ZLL is being used. For single-CPU builds we can check it, but for multi-CPU boards like the nRF5340 we cannot tell (unless we can read out some controller information at runtime).

Copy link
Contributor

Choose a reason for hiding this comment

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

Having the documentation for Zephyr Controller specific (limitation) is correct, and not to comment on other controller that may or may not support. (if they support handling overlaps, the specific interval are not problem anyway).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cvinayak since we have samples that have host features not supported by the controller, there is already a general understanding/consensus that BT samples are not specific for any controller, not even the Zephyr controller. I'm unsure whether we should mention that specifically here. Coul also just be vague and say "some controllers"?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for mentioning that other controllers may not need this. We have a similar case for documenting scan window when CONFIG_BT_SCAN_AND_INITIATE_IN_PARALLEL is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replaced the specific mentioning of Zephyr with Some controllers work best. Is that OK?

Copy link
Contributor

Choose a reason for hiding this comment

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

I was initially thinking it was fine to mention that the zephyr controller needs this but others don't. But I don't have a strong preference here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Given that these samples are not ZLL specific, I'd rather keep it vague but still explain that it may be required.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change this warning to LOG_INF? Other controllers may not have this limitation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps you can elaborate? My understanding is that having ISO and ACL/ADV intervals be a multiple of one or the other is generally better, as that could prevent from any future overlap.

Are other controllers able to handle this better, and how?

Copy link
Contributor

Choose a reason for hiding this comment

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

Because of the randomness of the advertising event, a controller may "move" the advertising events in such a way that they do not overlap with other ISO-activities. This is possible because the randomness is in the range of 10 ms

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cvinayak is this something we could do with ZLL?

This is possible because the randomness is in the range of 10 ms

But if it is random, how can the controller move things? Wouldn't that make it non-random?

Copy link
Contributor

Choose a reason for hiding this comment

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

"Random enough" is the key here. It is possible to move the advertising event slightly and still preserve some randomness

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Thalley This logging is redundant as #80733 ensures BIG events are not skipped.

So we do not "need" to have the ISO interval as a multiple of the ADV interval?

Copy link
Contributor

Choose a reason for hiding this comment

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

Correction, I got confused, this is related to SDU interval not in multiple of 0.625 ms. If unframed ISO SDU in use, yes the log is a good suggestion to the user which will ensure all periodic advertising PDU do not overlap and hence faster periodic sync established.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it makes sense to not log this for framed. Will add a check for framing.

For framed, can/should the host do anything?

Copy link
Contributor

Choose a reason for hiding this comment

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

When framed is used, the controller should be able to select a "nice" ISO interval similar to #81227 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to only check for unframed and changed to LOG_INF

@Thalley Thalley requested a review from cvinayak November 19, 2024 10:08
@Thalley Thalley force-pushed the iso_samples_intervals branch 3 times, most recently from 2477dc7 to 9177709 Compare November 22, 2024 13:18
@Thalley Thalley force-pushed the iso_samples_intervals branch from 9177709 to 1aadbac Compare November 22, 2024 13:22
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the debug logging?

@Thalley Thalley force-pushed the iso_samples_intervals branch 2 times, most recently from ff03670 to eaafda2 Compare November 22, 2024 13:56
Update the connection and advertising intervals of the
broadcast and connected ISO samples (including benchmark
samples) to work better with the selected SDU intervals
and the resulting ISO intervals.

For the ISO connected benchmark the order of CIG and ACl
has changed, so that we create the CIG before connecting
the ACL for the purpose of providing as much information
as possible to the controller.

Signed-off-by: Emil Gydesen <[email protected]>
@Thalley Thalley force-pushed the iso_samples_intervals branch from eaafda2 to e5e7395 Compare November 22, 2024 20:42
@cvinayak cvinayak changed the title samples: Bluetoot: ISO: Update conn and adv intervals samples: Bluetooth: ISO: Update conn and adv intervals Nov 24, 2024
@kartben kartben merged commit 420cafc into zephyrproject-rtos:main Nov 25, 2024
21 checks passed
@Thalley Thalley deleted the iso_samples_intervals branch November 25, 2024 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Bluetooth ISO Bluetooth LE Isochronous Channels area: Bluetooth area: Samples Samples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants