From 7ec0be76aed9d84087f1b3970211f8bbfca94da2 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 13 Oct 2023 11:19:32 +0200 Subject: [PATCH] samples: Bluetooth: Add missing reset of sems in iso_receive In the iso_receive sample, the semaphores were not reset in each iteration. This caused the ISO receiver to act incorrectly and cause issues with some controllers. Signed-off-by: Emil Gydesen --- samples/bluetooth/iso_receive/src/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/samples/bluetooth/iso_receive/src/main.c b/samples/bluetooth/iso_receive/src/main.c index 90fdf767dc5..a746a2f2fd0 100644 --- a/samples/bluetooth/iso_receive/src/main.c +++ b/samples/bluetooth/iso_receive/src/main.c @@ -281,6 +281,16 @@ static struct bt_iso_big_sync_param big_sync_param = { .sync_timeout = 100, /* in 10 ms units */ }; +static void reset_semaphores(void) +{ + k_sem_reset(&sem_per_adv); + k_sem_reset(&sem_per_sync); + k_sem_reset(&sem_per_sync_lost); + k_sem_reset(&sem_per_big_info); + k_sem_reset(&sem_big_sync); + k_sem_reset(&sem_big_sync_lost); +} + int main(void) { struct bt_le_per_adv_sync_param sync_create_param; @@ -328,6 +338,7 @@ int main(void) printk("Success.\n"); do { + reset_semaphores(); per_adv_lost = false; printk("Start scanning...");