zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.16k stars 6.22k forks source link

Bluetooth: controller: Improve window widening accuracy #35804

Open wopu-ot opened 3 years ago

wopu-ot commented 3 years ago

The current window widening algorithm widens the window more aggressively than necessary. This can lead to higher radio duty cycles than needed, which can strain battery-powered devices when approaching a link supervision timeout. Greater accuracy in calculating the reception window reduces the radio duty cycle and thus reduces current draw.

The current window widening algorithm operates at the granularity of microseconds. Every connection interval, the reception window is widened by an integral number of microseconds. The increment is rounded up from the theoretical/ideal value. This is fine in the short run, but the error can accumulate when approaching a link supervision timeout.

Consider a connection with a connection interval of 7.5ms and a maximum drift (SCA central + SCA peripheral) of 150ppm. The theoretical drift per connection interval is 1.125us, which is rounded up to 2us. If the LSTO is 6 seconds (800 events), the reception window will be 3200us (42.6% duty cycle), when it would only need to be 1800us (24% duty cycle).

Doing the window widening calculations with greater accuracy would keep the actual reception window close to the desired reception window. For example, using a unit of 1/160us could accurately represent the theoretical drift per connection interval (SCA values are multiples of 5, connection intervals are multiples of 1250, and their product is divided by 1000000 to calculate the drift per interval; 5*1250/1000000==1/160). However, care must be taken to avoid overflows when introducing this increased accuracy. An alternative could be to explicitly calculate the desired window based on the last anchor point rather than accumulating per connection event.

zephyrbot commented 5 months ago

Hi @cvinayak,

This issue, marked as an Enhancement, was opened a while ago and did not get any traction. It was just assigned to you based on the labels. If you don't consider yourself the right person to address this issue, please re-assing it to the right person.

Please take a moment to review if the issue is still relevant to the project. If it is, please provide feedback and direction on how to move forward. If it is not, has already been addressed, is a duplicate, or is no longer relevant, please close it with a short comment explaining the reason.

@wopu-ot you are also encouraged to help moving this issue forward by providing additional information and confirming this request/issue is still relevant to you.

Thanks!