Skip to content

Commit b150d3a

Browse files
cvinayaknashif
authored andcommitted
Bluetooth: controller: Fix repeated offsets in CPR PDU
Fix repeated offsets in LE Connection Parameter Request PDU due to rounding errors. Use tick units of connection interval to calculate the offset units. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent a8e25d9 commit b150d3a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

subsys/bluetooth/controller/ll_sw/ull_sched.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,10 @@ static void win_offset_calc(struct ll_conn *conn_curr, uint8_t is_select,
470470
ticks_to_expire_prev) >=
471471
(ticks_slot_abs_prev + ticks_slot_abs +
472472
ticks_slot_margin))) {
473-
offset = HAL_TICKER_TICKS_TO_US(
474-
ticks_to_expire_prev +
475-
ticks_slot_abs_prev) /
476-
CONN_INT_UNIT_US;
473+
offset = (ticks_to_expire_prev +
474+
ticks_slot_abs_prev) /
475+
HAL_TICKER_US_TO_TICKS(
476+
CONN_INT_UNIT_US);
477477
if (offset >= conn_interval) {
478478
ticks_to_expire_prev = 0U;
479479

@@ -511,9 +511,8 @@ static void win_offset_calc(struct ll_conn *conn_curr, uint8_t is_select,
511511
}
512512

513513
while (offset_index < *offset_max) {
514-
offset = HAL_TICKER_TICKS_TO_US(ticks_to_expire_prev +
515-
ticks_slot_abs_prev) /
516-
CONN_INT_UNIT_US;
514+
offset = (ticks_to_expire_prev + ticks_slot_abs_prev) /
515+
HAL_TICKER_US_TO_TICKS(CONN_INT_UNIT_US);
517516
if (offset >= conn_interval) {
518517
ticks_to_expire_prev = 0U;
519518

0 commit comments

Comments
 (0)