Unable to get UnicastClient to connect to UnicastServer that only supports stereo audio stream

My application is based on the ncs nrf5340_audio application, but my application and hardware target are both out-of-tree and I am using ncs v2.9.0.

I am able to connect to several different models of earbuds that support BLE audio where the UnicastClient connects to two independent BT addresses and sends a mono audio stream to each earbud.  However, if I connect to the TWS style of earbuds that only expose one BT address I get an error when parsing the PACS records.  I'll insert the debug log output below.

W [00:01:14.304,992] <inf> main: Device connected
GW [00:01:16.020,324] <dbg> bt_mgmt: security_changed_cb: Security changed: level 2
GW [00:01:16.020,355] <inf> main: Security changed
GW [00:01:16.367,340] <wrn> unicast_client: Got err: 0 from conn: 0x20006110
GW [00:01:16.367,340] <dbg> unicast_client: unicast_discovery_complete_cb: Unicast discovery complete cb
GW [00:01:16.367,523] <dbg> main: le_audio_msg_sub_thread: Received event = 8, current state = 1
GW [00:01:16.367,523] <wrn> main: Unexpected/unhandled le_audio event: 8
GW [00:01:16.967,193] <inf> bt_vol_ctlr: VCS discover finished
GW [00:01:19.367,309] <dbg> unicast_client: available_contexts_cb: conn: 00:02:3C:AC:F7:CB (public), snk ctx 3983 src ctx 587
GW [00:01:20.467,285] <wrn> unicast_client: More than one sink endpoint found, idx 0 is used by default
GW [00:01:20.867,248] <wrn> bt_bap_unicast_client: No space left to parse ASE

I have tried increasing several of the configuration variables that seem like they would allow the firmware to parse all of the endpoints, but so far I have not been able to get the nrf5340 firmware to connect to these kinds of earbuds.  Here are the configuration variables that I have updated to try to resolve this issue:

# Gor testing Creative Aurvana earbuds
#CONFIG_BT_MAX_CONN=6
#CONFIG_BT_BUF_ACL_RX_COUNT=8
#CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT=12
#CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT=4

Do you have any other suggestions on how to make the nrf5340 firmware connect to this type of earbud system?

Best regards,

Kristopher

Parents
  • Hi Kristopher,

    We may be able to get some more details logged if you enable CONFIG_BT_AUDIO_EP_PRINT in the project.

    Also, just to be thorough, the syntax for the Kconfig symbols you mention indicates that they are commented out. You have uncommented them in the active configuration file, right?

    Best regards,

    Maria

  • Hi Maria,

    Apologies for my slow response, I have been trying to do some more debugging of this issue and have made a few discoveries.

    I did enable the CONFIG_BT_AUDIO_EP_PRINT and I am able to see some additional endpoint capability printouts for the earbuds that work and stream audio, but for the newer earbuds that don't work, the connection process fails before it gets to the point where the endpoint configurations are printed.

    In my previous post I mentioned that in the past I had set CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT=12, but I discovered that another project config file was overriding this so the code was actually building with the ASE_SNK_COUNT set to 2, which is the default.  After I updated the build config files so the ASE_SNK_COUNT value is actually used, I then ran into another issue.  If I set the ASE_SNK_COUNT to a value greater than 2 the code won't build because of the following assertion:

    /src/bluetooth/bt_stream/unicast/unicast_client.c:85:1: note: in expansion of macro 'BUILD_ASSERT'
    85 | BUILD_ASSERT(ARRAY_SIZE(unicast_servers[0][0]) >= CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT,
    "We need to have at least one unicast_server per ASE SINK");

    The unicast_servers array is defined in unicast_client.c:76 as:

    static struct le_audio_unicast_server unicast_servers[CONFIG_BT_ISO_MAX_CIG][1][CONFIG_BT_MAX_CONN];
    By default the CONFIG_BT_MAX_CONN is set to 2, so it appears I would need to make the CONFIG_BT_MAX_CONN equal to the CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT to avoid the build assertion, but that does not seem like the correct solution because for these newer earbuds, I believe we need to have one BLE link, but enable multiple audio streaming endpoints using the single BLE link.
    Out of curiosity, I disabled the build assertion and set CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT to 6.  With this change I am now able to connect to the earbuds and see the following output:
    GW [00:00:49.782,409] <inf> main: Device connected
    GW [00:00:51.638,671] <dbg> bt_mgmt: security_changed_cb: Security changed: level 2
    GW [00:00:51.638,702] <inf> main: Security changed
    GW [00:00:51.883,941] <dbg> unicast_client: unicast_discovery_complete_cb: Remote device does not support CSIS.
    GW [00:00:51.883,972] <dbg> unicast_client: unicast_discovery_complete_cb: Unicast discovery complete cb
    GW [00:00:51.884,155] <dbg> main: le_audio_msg_sub_thread: Received event = 8, current state = 1
    GW [00:00:51.884,155] <wrn> main: Unexpected/unhandled le_audio event: 8
    GW [00:00:52.483,978] <inf> bt_vol_ctlr: VCS discover finished
    GW [00:00:56.283,843] <dbg> unicast_client: available_contexts_cb: conn: 00:02:3C:AC:F7:CB (public), snk ctx 3983 src ctx 587
    GW [00:00:57.883,789] <wrn> unicast_client: More than one sink endpoint found, idx 0 is used by default
    GW [00:00:58.283,813] <wrn> unicast_client: More than one sink endpoint found, idx 0 is used by default
    GW [00:00:58.683,807] <wrn> unicast_client: More than one sink endpoint found, idx 0 is used by default
    GW [00:01:00.283,874] <inf> unicast_client: Discovered 2 sink endpoint(s) for device 0
    GW [00:01:00.283,905] <inf> unicast_client:
    GW [00:01:00.283,905] <inf> unicast_client: Dev: 0 Sink EP 0
    GW [00:01:00.284,027] <inf> unicast_client:     Frequencies kHz: 8, 11.025, 16, 22.05, 24, 32, 44.1, 48, 88.2, 96, 176, 192,
    GW [00:01:00.284,057] <inf> unicast_client:     Frame duration ms: 7.5, 10
    GW [00:01:00.284,118] <inf> unicast_client:     Channels supported: 1, 2, 3, 4, 5, 6, 7, 8
    GW [00:01:00.284,118] <inf> unicast_client:     Frame length bytes: 75 - 155
    GW [00:01:00.284,118] <inf> unicast_client:     Max frames per SDU: 2
    GW [00:01:00.284,118] <inf> unicast_client: __________________________
    GW [00:01:00.384,216] <inf> unicast_client:
    GW [00:01:00.384,216] <inf> unicast_client: Dev: 0 Sink EP 1
    GW [00:01:00.384,338] <inf> unicast_client:     Frequencies kHz: 8, 11.025, 16, 22.05, 24, 32, 44.1, 48, 88.2, 96, 176, 192,
    GW [00:01:00.384,368] <inf> unicast_client:     Frame duration ms: 7.5, 10
    GW [00:01:00.384,429] <inf> unicast_client:     Channels supported: 1, 2, 3, 4, 5, 6, 7, 8
    GW [00:01:00.384,429] <inf> unicast_client:     Frame length bytes: 30 - 80
    GW [00:01:00.384,429] <inf> unicast_client:     Max frames per SDU: 2
    GW [00:01:00.384,429] <inf> unicast_client: __________________________
    GW [00:01:00.584,808] <inf> unicast_client: LEFT sink stream configured
    GW [00:01:00.584,838] <inf> le_audio: LC3 codec config for sink:
    GW [00:01:00.584,838] <inf> le_audio:   Frequency: 24000 Hz
    GW [00:01:00.584,869] <inf> le_audio:   Duration: 10000 us
    GW [00:01:00.584,869] <inf> le_audio:   Channel allocation: 0x1
    GW [00:01:00.584,869] <inf> le_audio:   Octets per frame: 60 (48000 bps)
    GW [00:01:00.584,869] <inf> le_audio:   Frames per SDU: 1
    GW [00:01:00.584,869] <dbg> unicast_client: stream_configured_cb: Configured Stream info: LEFT, 0x20011970, dir 1
    GW [00:01:00.584,899] <dbg> unicast_client: device_pres_delay_find: Index: 0, Pref min: 0, pref max: 0, pres_min: 25000, pres
    GW [00:01:00.584,899] <dbg> unicast_client: check_and_update_pd_in_group: Set LEFT, connection 0x20010d54, stream 0x20011970
    GW [00:01:00.585,144] <dbg> main: le_audio_msg_sub_thread: Received event = 1, current state = 1
    GW [00:01:00.585,144] <dbg> main: le_audio_msg_sub_thread: LE audio config received
    GW [00:01:00.585,144] <dbg> main: le_audio_msg_sub_thread:      Sampling rate: 24000 Hz
    GW [00:01:00.585,174] <dbg> main: le_audio_msg_sub_thread:      Bitrate (compressed): 48000 bps

    Even though the firmware is now able to connect to the earbuds, I still am unable to stream audio to the earbuds.  This is likely a side effect of disabling the build assertion.
    If I revert the firmware so CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT=2, then when I connect to these new earbuds I get a different failure.  Here's the log output that shows the error right after connecting:
    GW [00:01:31.775,756] <inf> main: Device connected
    GW [00:01:33.634,368] <dbg> bt_mgmt: security_changed_cb: Security changed: level 2
    GW [00:01:33.634,399] <inf> main: Security changed
    GW [00:01:33.877,319] <dbg> unicast_client: unicast_discovery_complete_cb: Remote device does not support CSIS.
    GW [00:01:33.877,319] <dbg> unicast_client: unicast_discovery_complete_cb: Unicast discovery complete cb
    GW [00:01:33.877,502] <dbg> main: le_audio_msg_sub_thread: Received event = 8, current state = 1
    GW [00:01:33.877,502] <wrn> main: Unexpected/unhandled le_audio event: 8
    GW [00:01:34.477,325] <inf> bt_vol_ctlr: VCS discover finished
    GW [00:01:38.277,221] <dbg> unicast_client: available_contexts_cb: conn: 00:02:3C:AC:F7:CB (public), snk ctx 3983 src ctx 587
    GW [00:01:39.777,191] <wrn> unicast_client: More than one sink endpoint found, idx 0 is used by default
    GW [00:01:40.227,142] <wrn> bt_bap_unicast_client: No space left to parse ASE
    GW [00:01:40.227,142] <err> unicast_client: Discovery failed: -12
    Do you have any ideas for other build configuration values that might help make the code work with this kind of earbud, or are there any other tests I should try to help discover more detail about these new earbuds?
    Best regards,
    Kristopher
Reply
  • Hi Maria,

    Apologies for my slow response, I have been trying to do some more debugging of this issue and have made a few discoveries.

    I did enable the CONFIG_BT_AUDIO_EP_PRINT and I am able to see some additional endpoint capability printouts for the earbuds that work and stream audio, but for the newer earbuds that don't work, the connection process fails before it gets to the point where the endpoint configurations are printed.

    In my previous post I mentioned that in the past I had set CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT=12, but I discovered that another project config file was overriding this so the code was actually building with the ASE_SNK_COUNT set to 2, which is the default.  After I updated the build config files so the ASE_SNK_COUNT value is actually used, I then ran into another issue.  If I set the ASE_SNK_COUNT to a value greater than 2 the code won't build because of the following assertion:

    /src/bluetooth/bt_stream/unicast/unicast_client.c:85:1: note: in expansion of macro 'BUILD_ASSERT'
    85 | BUILD_ASSERT(ARRAY_SIZE(unicast_servers[0][0]) >= CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT,
    "We need to have at least one unicast_server per ASE SINK");

    The unicast_servers array is defined in unicast_client.c:76 as:

    static struct le_audio_unicast_server unicast_servers[CONFIG_BT_ISO_MAX_CIG][1][CONFIG_BT_MAX_CONN];
    By default the CONFIG_BT_MAX_CONN is set to 2, so it appears I would need to make the CONFIG_BT_MAX_CONN equal to the CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT to avoid the build assertion, but that does not seem like the correct solution because for these newer earbuds, I believe we need to have one BLE link, but enable multiple audio streaming endpoints using the single BLE link.
    Out of curiosity, I disabled the build assertion and set CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT to 6.  With this change I am now able to connect to the earbuds and see the following output:
    GW [00:00:49.782,409] <inf> main: Device connected
    GW [00:00:51.638,671] <dbg> bt_mgmt: security_changed_cb: Security changed: level 2
    GW [00:00:51.638,702] <inf> main: Security changed
    GW [00:00:51.883,941] <dbg> unicast_client: unicast_discovery_complete_cb: Remote device does not support CSIS.
    GW [00:00:51.883,972] <dbg> unicast_client: unicast_discovery_complete_cb: Unicast discovery complete cb
    GW [00:00:51.884,155] <dbg> main: le_audio_msg_sub_thread: Received event = 8, current state = 1
    GW [00:00:51.884,155] <wrn> main: Unexpected/unhandled le_audio event: 8
    GW [00:00:52.483,978] <inf> bt_vol_ctlr: VCS discover finished
    GW [00:00:56.283,843] <dbg> unicast_client: available_contexts_cb: conn: 00:02:3C:AC:F7:CB (public), snk ctx 3983 src ctx 587
    GW [00:00:57.883,789] <wrn> unicast_client: More than one sink endpoint found, idx 0 is used by default
    GW [00:00:58.283,813] <wrn> unicast_client: More than one sink endpoint found, idx 0 is used by default
    GW [00:00:58.683,807] <wrn> unicast_client: More than one sink endpoint found, idx 0 is used by default
    GW [00:01:00.283,874] <inf> unicast_client: Discovered 2 sink endpoint(s) for device 0
    GW [00:01:00.283,905] <inf> unicast_client:
    GW [00:01:00.283,905] <inf> unicast_client: Dev: 0 Sink EP 0
    GW [00:01:00.284,027] <inf> unicast_client:     Frequencies kHz: 8, 11.025, 16, 22.05, 24, 32, 44.1, 48, 88.2, 96, 176, 192,
    GW [00:01:00.284,057] <inf> unicast_client:     Frame duration ms: 7.5, 10
    GW [00:01:00.284,118] <inf> unicast_client:     Channels supported: 1, 2, 3, 4, 5, 6, 7, 8
    GW [00:01:00.284,118] <inf> unicast_client:     Frame length bytes: 75 - 155
    GW [00:01:00.284,118] <inf> unicast_client:     Max frames per SDU: 2
    GW [00:01:00.284,118] <inf> unicast_client: __________________________
    GW [00:01:00.384,216] <inf> unicast_client:
    GW [00:01:00.384,216] <inf> unicast_client: Dev: 0 Sink EP 1
    GW [00:01:00.384,338] <inf> unicast_client:     Frequencies kHz: 8, 11.025, 16, 22.05, 24, 32, 44.1, 48, 88.2, 96, 176, 192,
    GW [00:01:00.384,368] <inf> unicast_client:     Frame duration ms: 7.5, 10
    GW [00:01:00.384,429] <inf> unicast_client:     Channels supported: 1, 2, 3, 4, 5, 6, 7, 8
    GW [00:01:00.384,429] <inf> unicast_client:     Frame length bytes: 30 - 80
    GW [00:01:00.384,429] <inf> unicast_client:     Max frames per SDU: 2
    GW [00:01:00.384,429] <inf> unicast_client: __________________________
    GW [00:01:00.584,808] <inf> unicast_client: LEFT sink stream configured
    GW [00:01:00.584,838] <inf> le_audio: LC3 codec config for sink:
    GW [00:01:00.584,838] <inf> le_audio:   Frequency: 24000 Hz
    GW [00:01:00.584,869] <inf> le_audio:   Duration: 10000 us
    GW [00:01:00.584,869] <inf> le_audio:   Channel allocation: 0x1
    GW [00:01:00.584,869] <inf> le_audio:   Octets per frame: 60 (48000 bps)
    GW [00:01:00.584,869] <inf> le_audio:   Frames per SDU: 1
    GW [00:01:00.584,869] <dbg> unicast_client: stream_configured_cb: Configured Stream info: LEFT, 0x20011970, dir 1
    GW [00:01:00.584,899] <dbg> unicast_client: device_pres_delay_find: Index: 0, Pref min: 0, pref max: 0, pres_min: 25000, pres
    GW [00:01:00.584,899] <dbg> unicast_client: check_and_update_pd_in_group: Set LEFT, connection 0x20010d54, stream 0x20011970
    GW [00:01:00.585,144] <dbg> main: le_audio_msg_sub_thread: Received event = 1, current state = 1
    GW [00:01:00.585,144] <dbg> main: le_audio_msg_sub_thread: LE audio config received
    GW [00:01:00.585,144] <dbg> main: le_audio_msg_sub_thread:      Sampling rate: 24000 Hz
    GW [00:01:00.585,174] <dbg> main: le_audio_msg_sub_thread:      Bitrate (compressed): 48000 bps

    Even though the firmware is now able to connect to the earbuds, I still am unable to stream audio to the earbuds.  This is likely a side effect of disabling the build assertion.
    If I revert the firmware so CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT=2, then when I connect to these new earbuds I get a different failure.  Here's the log output that shows the error right after connecting:
    GW [00:01:31.775,756] <inf> main: Device connected
    GW [00:01:33.634,368] <dbg> bt_mgmt: security_changed_cb: Security changed: level 2
    GW [00:01:33.634,399] <inf> main: Security changed
    GW [00:01:33.877,319] <dbg> unicast_client: unicast_discovery_complete_cb: Remote device does not support CSIS.
    GW [00:01:33.877,319] <dbg> unicast_client: unicast_discovery_complete_cb: Unicast discovery complete cb
    GW [00:01:33.877,502] <dbg> main: le_audio_msg_sub_thread: Received event = 8, current state = 1
    GW [00:01:33.877,502] <wrn> main: Unexpected/unhandled le_audio event: 8
    GW [00:01:34.477,325] <inf> bt_vol_ctlr: VCS discover finished
    GW [00:01:38.277,221] <dbg> unicast_client: available_contexts_cb: conn: 00:02:3C:AC:F7:CB (public), snk ctx 3983 src ctx 587
    GW [00:01:39.777,191] <wrn> unicast_client: More than one sink endpoint found, idx 0 is used by default
    GW [00:01:40.227,142] <wrn> bt_bap_unicast_client: No space left to parse ASE
    GW [00:01:40.227,142] <err> unicast_client: Discovery failed: -12
    Do you have any ideas for other build configuration values that might help make the code work with this kind of earbud, or are there any other tests I should try to help discover more detail about these new earbuds?
    Best regards,
    Kristopher
Children
No Data
Related