Decrease time to sync audio broadcast

We have a project with a device acting as a ble peripheral and a broadcast sink. First the ACL connection is set up and then it will scan for and sync to a broadcast with a configured name. 

In the current prototype the time from starting to scan for broadcast and until the audio stream is synced and ready is typically 10-20seconds, with getting the BASE and BIG sync taking the longest. Is this expected with LE Audio broadcast or should it be possible to significantly reduce this delay?

Here are some logs that shows the timing (in ms):

[15552::INFO] (broadcast_sink.cpp:1116) Scanning for broadcaster XXX
[15634::INFO] (broadcast_sink.cpp:428) Found broadcaster with ID 0x199823 and addr 02:97:3C:BC:C5:EF (
[15804::INFO] (broadcast_sink.cpp:428) Found broadcaster with ID 0x199823 and addr 02:97:3C:BC:C5:EF (
[15976::INFO] (broadcast_sink.cpp:428) Found broadcaster with ID 0x199823 and addr 02:97:3C:BC:C5:EF (
[16234::INFO] (broadcast_sink.cpp:428) Found broadcaster with ID 0x199823 and addr 02:97:3C:BC:C5:EF (
[16404::INFO] (broadcast_sink.cpp:428) Found broadcaster with ID 0x199823 and addr 02:97:3C:BC:C5:EF (
[16553::INFO] (broadcast_sink.cpp:999) Attempting to PA sync to the broadcaster with id 0x199823
[16554::INFO] (broadcast_sink.cpp:1006) Waiting for PA sync to complete
[16564::INFO] (broadcast_sink.cpp:428) Found broadcaster with ID 0x199823 and addr 02:97:3C:BC:C5:EF (
[17424::INFO] (broadcast_sink.cpp:428) Found broadcaster with ID 0x199823 and addr 02:97:3C:BC:C5:EF (
[17744::INFO] (broadcast_sink.cpp:473) PA sync 0x2000dbd8 synced for broadcast sink with broadcast ID 
[17744::INFO] (broadcast_sink.cpp:1013) Broadcast source PA synced, creating Broadcast Sink
[17745::INFO] (broadcast_sink.cpp:1020) Broadcast Sink created, waiting for BASE
[24944::INFO] (broadcast_sink.cpp:785) Received BASE with 1 subgroups from broadcast sink 0x2000e228
[24944::INFO] (broadcast_sink.cpp:791) Subgroup: 0 BIS: 0 index = 1
[24944::INFO] (broadcast_sink.cpp:621) Octets per frame: 40
[24944::INFO] (broadcast_sink.cpp:766) Codec info: id: 0x06, cid: 0x0000, vid: 0x0000, frequency: 2400
[24944::INFO] (broadcast_sink.cpp:830) Received SYNCABLE from broadcast sink 0x2000e228: unencrypted
[24944::INFO] (broadcast_sink.cpp:1027) BASE received, waiting for syncable 
[24944::INFO] (broadcast_sink.cpp:1034) Waiting for broadcast code
[24945::INFO] (broadcast_sink.cpp:1041) Waiting for BIS sync request
[24945::INFO] (broadcast_sink.cpp:1048) Syncing to broadcast
[00:00:24.945,129] <dbg> bt_bap_broadcast_sink: broadcast_sink_ep_init: ep 0x2000e338
[00:00:24.945,159] <dbg> bt_bap_iso: bt_bap_iso_bind_ep: iso 0x2000e100 ep 0x2000e338 dir sink
[00:00:24.945,556] <dbg> bt_bap_broadcast_sink: broadcast_sink_set_ep_state: ep 0x2000e338 id 0x00 idle -> qos-configured
[24945::INFO] (broadcast_sink.cpp:1055) Waiting for BIG sync
[32144::INFO] (broadcast_sink.cpp:785) Received BASE with 1 subgroups from broadcast sink 0x2000e228
[32144::INFO] (broadcast_sink.cpp:791) Subgroup: 0 BIS: 0 index = 1
[32144::INFO] (broadcast_sink.cpp:621) Octets per frame: 40
[32144::INFO] (broadcast_sink.cpp:766) Codec info: id: 0x06, cid: 0x0000, vid: 0x0000, frequency: 2400
[00:00:32.150,909] <dbg> bt_bap_broadcast_sink: broadcast_sink_iso_connected: stream 0x2000ca34
[00:00:32.150,909] <dbg> bt_bap_broadcast_sink: broadcast_sink_set_ep_state: ep 0x2000e338 id 0x00 qos-configured -> streaming
[32150::INFO] (broadcast_sink.cpp:339) Stream 0x2000ca34 started

Both sides (broadcast sink and broadcast source) is nrf5340 and running nrf Connect v2.6.0, so we're also wondering if there has been changes to the audio implementation lately that might be beneficial for this issue?

  • Hello,

    RakeLund said:
    I was able to build and run the samples in the end, but the broadcast sink is failing when I try to sync to our broadcast source, maybe because we only have 1 stream/1 channel while it's expecting 2?

    Maybe. A Kconfig symbol for selecting BIS channels was introduced to the sample after v2.6.0, so this may cause the sync to fail with your custom broadcaster. The broadcast sink (from v2.9.0) will print "Failed to find a valid BIS" in that case. The default should be that it expects the left channel (CONFIG_TARGET_BROADCAST_CHANNEL=1), but setting CONFIG_TARGET_BROADCAST_CHANNEL to 0 or 2 instead will make it expect mono or the right channel respectively.

    RakeLund said:
    I will compare the sample to our application to see if there any obvious differences. Do you have any other pointers as to what to look for? Or some debug logs I could add with configurations in prj.conf? 

    Would you be willing to share your prj.conf file so our developers can take a look. They would know if some configurations could cause increased sync times.

    Best regards,

    Maria

  • Here's our prj.conf I just removed a few names and ids
    # Debugging and Optimization
    CONFIG_DEBUG=y
    CONFIG_DEBUG_INFO=y
    CONFIG_DEBUG_OPTIMIZATIONS=y
    CONFIG_DEBUG_THREAD_INFO=y
    
    # C++ Support
    CONFIG_CPP=y
    CONFIG_STD_CPP17=y
    CONFIG_GLIBCXX_LIBCPP=y
    
    # Logging
    CONFIG_LOG=y
    CONFIG_LOG_MODE_MINIMAL=n
    CONFIG_LOG_MODE_DEFERRED=y
    CONFIG_LOG_BACKEND_UART=y
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BUFFER_SIZE=2048
    CONFIG_STDOUT_CONSOLE=y
    
    # Bluetooth Settings
    CONFIG_BT=y
    CONFIG_BT_HCI=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_PRIVACY=n
    CONFIG_BT_DEVICE_NAME="XXXX"
    CONFIG_BT_EXT_ADV=y
    CONFIG_BT_GATT_DYNAMIC_DB=y
    CONFIG_BT_OBSERVER=y
    CONFIG_BT_SCAN=y
    CONFIG_BT_PER_ADV_SYNC=y
    CONFIG_BT_HCI_VS_EXT=n
    CONFIG_BT_HCI_ACL_FLOW_CONTROL=n
    CONFIG_BT_MAX_CONN=2
    CONFIG_BT_SCAN_WITH_IDENTITY=y
    CONFIG_BT_PER_ADV=y
    CONFIG_BT_BUF_ACL_RX_SIZE=502
    CONFIG_BT_ATT_PREPARE_COUNT=2
    CONFIG_BT_L2CAP_TX_MTU=498
    CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
    CONFIG_BT_BUF_ACL_TX_COUNT=10
    CONFIG_BT_BUF_ACL_TX_SIZE=502
    CONFIG_BT_CTLR_DATA_LENGTH_MAX=1004
    CONFIG_BT_BAP_BROADCAST_SINK_LOG_LEVEL_DBG=y
    CONFIG_BT_BAP_ISO_LOG_LEVEL_DBG=y
    CONFIG_BT_SMP=y
    CONFIG_BT_AUDIO=y
    CONFIG_BT_BAP_BROADCAST_SINK=y
    CONFIG_BT_BAP_SCAN_DELEGATOR=y
    CONFIG_BT_PAC_SNK=y
    CONFIG_BT_BAP_BROADCAST_ASSISTANT=y
    CONFIG_BT_BAS=y
    CONFIG_BT_DIS=y
    CONFIG_BT_DIS_HW_REV_STR="XXX"
    CONFIG_BT_DIS_PNP=n
    CONFIG_BT_DIS_SERIAL_NUMBER=n
    CONFIG_BT_DIS_FW_REV=y
    CONFIG_BT_DIS_HW_REV=y
    CONFIG_BT_SETTINGS=y
    CONFIG_SETTINGS_RUNTIME=y
    CONFIG_SETTINGS=y
    CONFIG_SETTINGS_NONE=y
    CONFIG_BT_DIS_SETTINGS=y
    CONFIG_BT_DIS_STR_MAX=21
    CONFIG_BT_PER_ADV_SYNC_MAX=2
    CONFIG_BT_BAP_BROADCAST_SNK_SUBGROUP_COUNT=2
    CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT=2
    CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=y
    CONFIG_BT_PERIPHERAL_PREF_MAX_INT=32
    CONFIG_BT_PERIPHERAL_PREF_MIN_INT=32
    
    # Audio and Codec
    CONFIG_LIBLC3=y
    CONFIG_SW_CODEC_LC3_T2_SOFTWARE=y
    
    # Stack and Threading
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_TIMESLICING=y
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304
    
    # UART and Console
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_UART_LINE_CTRL=y
    CONFIG_UART_ASYNC_API=n
    CONFIG_UART_CONSOLE=y
    CONFIG_SERIAL=y
    CONFIG_CONSOLE=y
    
    # USB Device
    CONFIG_USB_DEVICE_STACK=y
    CONFIG_USB_DEVICE_PRODUCT="XXXX"
    CONFIG_USB_DEVICE_PID=0xXXXX
    CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n
    
    # Flash and Bootloader
    CONFIG_FLASH=y
    CONFIG_BOOTLOADER_MCUBOOT=y
    
    # MCU Manager
    CONFIG_MCUMGR=y
    CONFIG_MCUMGR_GRP_IMG=y
    CONFIG_MCUMGR_GRP_OS=y
    CONFIG_MCUMGR_TRANSPORT_BT=y
    CONFIG_MCUMGR_TRANSPORT_BT_AUTHEN=n
    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
    
    # Peripheral Drivers
    CONFIG_NRFX_I2S0=y
    CONFIG_DATA_FIFO=y
    CONFIG_I2C=y
    CONFIG_ADC=y
    CONFIG_ADC_NRFX_SAADC=y
    CONFIG_NRFX_SAADC=y
    CONFIG_SAMPLE_RATE_CONVERTER=y
    CONFIG_SAMPLE_RATE_CONVERTER_FILTER_SIMPLE=y
    
    # Floating Point Unit
    CONFIG_FPU=y
    CONFIG_FP_HARDABI=y
    
    # Power Management
    CONFIG_POWEROFF=y
    
    # Board and RPMsg
    CONFIG_BOARD_ENABLE_CPUNET=y
    CONFIG_NCS_INCLUDE_RPMSG_CHILD_IMAGE=y
    
    # RTT Console
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y

  • Hello, 

    Thank you for sharing your configuration file. I have shared it internally and I'll update you when I get some feedback.

    When looking through myself I found that CONFIG_BT_CTLR_DATA_LENGTH_MAX exceeds the upper limit of 251. I don't think this will affect the sync time, but it is outside the range for the symbol.

    Is it your intention to have your device act as a Broadcast Assistant and a Broadcast Sink? This configuration seems unusual, because a Broadcast Snk is able scan for Broadcast sources and the point of having a Broadcast Assistant is to have a separate device from the Broadcast Sink to offload the scanning to to concerve power.

    Best regards,

    Maria

  • Hi again,

    I got some feedback this morning.

    In nRF Connect SDK v2.9.0 we have the CONFIG_BT_AUDIO_SCAN_DELEGATOR option, which will make the sink device act as a peripheral to a broadcast assistant. Here is a log from the nRF5340 Audio application headset device with some explaining comments along the way:

              nRF5340 Audio nRF5340 Audio DK cpuapp
             NCS base version: 2.9.0
             Cmake run : Thu Mar 27 15:45:07 2025
    HL [00:00:00.308,746] <inf> fw_info: ------- DEBUG BUILD -------
    HL [00:00:00.308,746] <inf> fw_info: HEADSET left device
    HL [00:00:00.378,875] <inf> bt_mgmt_ctlr_cfg: Controller: SoftDevice: Version 6.0 (0x0e), Revision 8299
    HL [00:00:00.379,089] <inf> bt_mgmt: Local identity addr: CC:CF:B2:BE:15:80 (random)
    HL [00:00:00.408,111] <wrn> broadcast_sink: CSIP using the default SIRK, must be changed before production
    HL [00:00:00.409,118] <dbg> broadcast_sink: broadcast_sink_enable: Broadcast sink enabled
    HL [00:00:00.410,461] <inf> bt_mgmt_adv: Local addr: CC:CF:B2:BE:15:80 (random)
    HL [00:00:00.410,949] <inf> bt_mgmt_adv: Advertising successfully started
    
    // The time when BIS headset connected by a phone with broadcast assistant feature
    HL [00:01:20.222,503] <inf> bt_mgmt: Connected: 78:CE:74:BD:D4:CC (random)
    
    // The time when broadcast assistant from phone tell the BIS headset to sync with nearby nRF5340 broadcaster 
    HL [00:01:26.646,942] <inf> bt_mgmt_scan: broadcast ID received = 534BD0
    HL [00:01:26.858,306] <inf> bt_mgmt_scan: PA synced to name: , id: 0x534bd0, addr: 1D:78:B6:CF:B5:43 (random)
    HL [00:01:26.858,764] <dbg> broadcast_sink: broadcast_sink_pa_sync_set: Trying to set PA sync with ID: 5458896
    HL [00:01:27.458,190] <dbg> broadcast_sink: base_recv_cb: Received BASE with 1 subgroup(s) from broadcast sink
    HL [00:01:27.458,221] <dbg> broadcast_sink: base_subgroup_cb: Subgroup 0x2001f8e7 has 2 BISes
    HL [00:01:27.458,282] <dbg> broadcast_sink: base_subgroup_bis_cb: BIS found, index 1
    HL [00:01:27.458,282] <dbg> broadcast_sink: get_codec_info: Failed retrieving sampling frequency: -61
    HL [00:01:27.458,282] <dbg> broadcast_sink: get_codec_info: Failed retrieving frame duration: -61
    HL [00:01:27.458,312] <dbg> broadcast_sink: get_codec_info: Failed retrieving octets per frame: -61
    HL [00:01:27.458,312] <dbg> broadcast_sink: get_codec_info: Failed calculating bitrate: -61
    HL [00:01:27.458,343] <dbg> broadcast_sink: base_subgroup_bis_cb: Channel allocation: 0x1 for BIS index 1
    HL [00:01:27.458,343] <dbg> broadcast_sink: base_subgroup_bis_cb: BIS found, index 2
    HL [00:01:27.458,343] <dbg> broadcast_sink: get_codec_info: Failed retrieving sampling frequency: -61
    HL [00:01:27.458,374] <dbg> broadcast_sink: get_codec_info: Failed retrieving frame duration: -61
    HL [00:01:27.458,374] <dbg> broadcast_sink: get_codec_info: Failed retrieving octets per frame: -61
    HL [00:01:27.458,374] <dbg> broadcast_sink: get_codec_info: Failed calculating bitrate: -61
    HL [00:01:27.458,404] <dbg> broadcast_sink: base_subgroup_bis_cb: Channel allocation: 0x2 for BIS index 2
    HL [00:01:27.458,465] <dbg> broadcast_sink: base_recv_cb: Channel HL active
    HL [00:01:27.458,465] <dbg> broadcast_sink: base_recv_cb: Waiting for syncable
    HL [00:01:27.458,557] <dbg> broadcast_sink: syncable_cb: Broadcast sink is syncable
    HL [00:01:27.458,587] <inf> broadcast_sink: Syncing to broadcast stream index 0
    HL [00:01:27.458,801] <inf> main: Presentation delay 3000 us is set
    
    # It only took couple seconds to start the stream
    HL [00:01:28.062,957] <inf> broadcast_sink: Stream index 0 started
    HL [00:01:28.062,988] <inf> broadcast_sink: Codec config for LC3:
    HL [00:01:28.062,988] <inf> broadcast_sink:     Frequency: 48000 Hz
    HL [00:01:28.062,988] <inf> broadcast_sink:     Frame Duration: 10000 us
    HL [00:01:28.062,988] <inf> broadcast_sink:     Octets per frame: 120 (96000 kbps)
    HL [00:01:28.062,988] <inf> broadcast_sink:     Frames per SDU: 1
    HL [00:01:28.062,988] <inf> broadcast_sink:     Channel allocation: 0x1
    HL [00:01:28.063,964] <wrn> le_audio_rx: Not in streaming state (1), thrown 1 packet(s)
    HL [00:01:28.083,068] <inf> audio_datapath: Drft comp state: CALIB
    HL [00:01:28.084,045] <wrn> audio_datapath: Data received, total under-runs: 9
    HL [00:01:28.183,074] <inf> audio_datapath: Drft comp state: OFFSET
    HL [00:01:28.283,081] <inf> audio_datapath: Drft comp state: LOCKED
    HL [00:01:28.292,755] <inf> audio_datapath: Pres comp state: MEAS
    HL [00:01:28.402,740] <inf> audio_datapath: Pres comp state: WAIT
    HL [00:01:28.542,724] <inf> audio_datapath: Pres comp state: INIT
    HL [00:01:28.552,734] <inf> audio_datapath: Pres comp state: MEAS
    HL [00:01:28.662,750] <inf> audio_datapath: Pres comp state: LOCKED

    As you can see from the logs it takes a few seconds to start the stream after the Broadcast Assistant has set up which stream the headset should sync to. So it should be very possible to reduce the time from your case, especially when upgrading to nRF Connect SDK v2.9.0 or v2.9.1 to make use of the CONFIG_BT_AUDIO_SCAN_DELEGATOR feature.

    Best regards,

    Maria

  • I've been trying to upgrade to nRF Connect SDK v2.9.1, but having trouble getting it to work. I've finally managed to build, but when the application calls bt_enable I get an error return -12 (ENOMEM) so I assume I've done something wrong with the configuration of the network core. I copied the sysbuild folder and kconfig.sysbuild from nrf5340 audio application because I assume that should choose the correct controller?

    Any ideas of what could be wrong?

Related