Skip to content

Commit 120274b

Browse files
npal-cyaescolar
authored andcommitted
Bluetooth: Samples: periodical_adv_rps: Added sync wait delay
Problem: on cyw208xx devices i see sometime `Timed out while synchronizing` error in samples periodical_adv_rps/periodical_sync_rps. log: <err> bt_scan: Could not lookup connection handle from PAST <err> bt_scan: Unknown handle 0x0000 for periodic advertising report Timed out while synchronizing ... After investigation i can confirm, the sync was created successful, but in application (periodical_sync_rsp) terminated the sync when the connection is not valid. periodical_adv_rps doesn't have any mechanism to wait for sync and after gatt write (subevent, response_slot information) it immediately performs disconnection. Solution: Added sync wait delay before make disconnection, to ensure sync is established before disconnection. Signed-off-by: Nazar Palamar <[email protected]>
1 parent 9a112dc commit 120274b

File tree

1 file changed

+6
-0
lines changed
  • samples/bluetooth/periodic_adv_rsp/src

1 file changed

+6
-0
lines changed

samples/bluetooth/periodic_adv_rsp/src/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,12 @@ int main(void)
366366
printk("PAwR config written to sync %d, disconnecting\n", num_synced - 1);
367367

368368
disconnect:
369+
/* Adding delay (2ms * interval value, using 2ms intead of the 1.25ms
370+
* used by controller) to ensure sync is established before
371+
* disconnection.
372+
*/
373+
k_sleep(K_MSEC(per_adv_params.interval_max * 2));
374+
369375
err = bt_conn_disconnect(default_conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN);
370376
if (err) {
371377
return 0;

0 commit comments

Comments
 (0)