Skip to content

Commit 8f444e4

Browse files
cvinayakcarlescufi
authored andcommitted
Bluetooth: Controller: Fix missing offset adjust field assignment
Fix missing offset adjust field assignment in the Periodic Advertising's sync_info struct that is present in the Extended Advertising PDU. When the sync offset is equal or over 2.4576 seconds from the Extended Advertising PDU, then the sync offset has to be reduced by 2.4576 seconds and the offs_adjust flag be set in the sync_info field. This fixes a bug where Periodic Synchronization could not be established for Periodic Advertisings with intervals greater than 2.4576 seconds as the sync offset was incorrect due to rollover in the 13-bit offset field. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 2f4ab97 commit 8f444e4

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

subsys/bluetooth/controller/ll_sw/pdu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
#define OFFS_UNIT_VALUE_30_US 0
127127
#define OFFS_UNIT_VALUE_300_US 1
128128
/* Value specified in BT Spec. Vol 6, Part B, section 2.3.4.6 */
129-
#define OFFS_ADJUST_US 245760
129+
#define OFFS_ADJUST_US 2457600UL
130130

131131
/* Advertiser's Sleep Clock Accuracy Value */
132132
#define SCA_500_PPM 500 /* 51 ppm to 500 ppm */

subsys/bluetooth/controller/ll_sw/ull_adv_sync.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,12 @@ static inline void sync_info_offset_fill(struct pdu_adv_sync_info *si,
17341734
uint32_t offs;
17351735

17361736
offs = HAL_TICKER_TICKS_TO_US(ticks_offset) - start_us;
1737+
1738+
if (offs >= OFFS_ADJUST_US) {
1739+
offs -= OFFS_ADJUST_US;
1740+
si->offs_adjust = 1U;
1741+
}
1742+
17371743
offs = offs / OFFS_UNIT_30_US;
17381744
if (!!(offs >> OFFS_UNIT_BITS)) {
17391745
si->offs = sys_cpu_to_le16(offs / (OFFS_UNIT_300_US /

0 commit comments

Comments
 (0)