bt_bap_broadcast_sink: Failed to add sync as Receive State for sink 0x2000a218

I'm using nrf52840, v3.0.2, scanning BIG/BIS and printing out the BASE.

I first scan the extended broadcast with the label broadcast_id, and then establish synchronization: bt_le_per_adv_sync_create(&sync_create_param, &g_sync_state.sync); in the sync_cb of bt_le_per_adv_sync_cb, I then go to bt_bap_broadcast_sink_create(sync, g_sync_state.broadcast_id, &g_sync_state.sink); in the base_recv callback of bt_bap_broadcast_sink_cb, I parse the BASE content. After parsing, I do bt_le_per_adv_sync_recv_disable(g_sync_state.sync); In state_changed in bt_le_per_adv_sync_cb, call bt_bap_broadcast_sink_delete(g_sync_state.sink);bt_le_per_adv_sync_delete(g_sync_state.sync); and then repeat this process.

An error like <wrn> bt_bap_broadcast_sink: Failed to addsync as Receive State for sink 0x2000a218: -120 will appear.

Parents
  • Hi,

    An error like <wrn> bt_bap_broadcast_sink: Failed to addsync as Receive State for sink 0x2000a218: -120 will appear.

    This is an error code meaning "Operation already in progress" as shown in the documentation here.

    Please doublecheck your cleanup logic and consider adjusting your sync options to avoid this issue. If the problem persists, ensure that you are not starting a new sync or sink operation before the previous one is fully cleaned up and completed.

    Also check the peripheral instance count (CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT) in your final .config and see if you increasing the number by one helps (note that this will just be a workaround for the issue and not a fix, actual fix is to cleanup the disconnect and connect logic properly)

  • I use these two functions to delete sink and sync

    if (g_sync_state.sink) {
        err = bt_bap_broadcast_sink_delete(g_sync_state.sink);
        if (err) {
        	printk("Failed to delete broadcast sink: %d\n", err);
        	/* Continue cleanup even if this fails */
        }
        printk("-> Deleting sink\n");
        g_sync_state.sink = NULL; /* Mark as deleted */
    }
    if (g_sync_state.sync) {
        printk("-> Deleting sync.\n");
        err = bt_le_per_adv_sync_delete(g_sync_state.sync);
        if (err) {
        	printk("Failed to delete periodic advertising sync: %d\n", err);
        }
    }

    The log also shows that it has been deleted.

    -> Delayed delete work handler sink 0x2000a218, sync 0x20009d60.
    -> Deleting sink
    -> Deleting sync.

    I modified CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT in the nRF Kconfig GUI, but when I clicked Apply or Save to File, it said "No change to save"

Reply
  • I use these two functions to delete sink and sync

    if (g_sync_state.sink) {
        err = bt_bap_broadcast_sink_delete(g_sync_state.sink);
        if (err) {
        	printk("Failed to delete broadcast sink: %d\n", err);
        	/* Continue cleanup even if this fails */
        }
        printk("-> Deleting sink\n");
        g_sync_state.sink = NULL; /* Mark as deleted */
    }
    if (g_sync_state.sync) {
        printk("-> Deleting sync.\n");
        err = bt_le_per_adv_sync_delete(g_sync_state.sync);
        if (err) {
        	printk("Failed to delete periodic advertising sync: %d\n", err);
        }
    }

    The log also shows that it has been deleted.

    -> Delayed delete work handler sink 0x2000a218, sync 0x20009d60.
    -> Deleting sink
    -> Deleting sync.

    I modified CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT in the nRF Kconfig GUI, but when I clicked Apply or Save to File, it said "No change to save"

Children
  • try to change that to higher value than 1 in your prj.conf

    CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT=2

    I am not sure why GUI behaves the way it does in your case, but we can try to solve that later.

  • Parsing C:/ncs/bluetooth_sample/periodic_sync_multi/Kconfig
    warning: user value 2 on the int symbol BT_CTLR_SDC_PERIPHERAL_COUNT (defined at C:/ncs/v3.0.2/nrf\subsys\bluetooth\controller/Kconfig:138) ignored due to being outside the active range ([0, 1]) -- fa
    lling back on defaultsLoaded configuration 'C:/ncs/v3.0.2/zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig'
    Merged configuration 'C:/ncs/bluetooth_sample/periodic_sync_multi/prj.conf'
    Merged configuration 'C:/ncs/bluetooth_sample/periodic_sync_multi/52840dk/periodic_sync_multi/zephyr/.config.sysbuild'


    error: Aborting due to Kconfig warnings 

    Is BT_CTLR_SDC_PERIPHERAL_COUNT defined to support peripheral connections? I am only scanning for BIG/BIS now, 

Related