NRF5340 audio stream bidirectional problem

Hello Nordic Team,

I am working on a LE Audio project on NCS v2.9.0. My development board is nrf5340-dk. I am using unicast client example and I am trying to use it with my earbuds. I am using Samsung Galaxy Buds 2 Pro. Strangely, it is not able to remember pair information. So, I made some changes inside project to forget boding information after disconnect or reset condition. Without these additions, it is impossible to test it.

My problem is this, without CONFIG_STREAM_BIDIRECTIONAL enabled, it is working expected. I am able to get usb audio data to my earbuds. This is the logs about discovering process.



However, if I enabled CONFIG_STREAM_BIDIRECTIONAL flag, I am not able to send or receive any audio data with my earbuds. Strangely, the code stays like this below and I feel there is a problem while discovering earbuds.



Is this possible to use bidirectional audio over usb? Or, I am trying something impossible.

Thanks.

Parents
  • Hi,

    Regarding bonding problem, you could try to set CONFIG_BT_BONDABLE=n.
    With regard to using CONFIG_STREAM_BIDIRECTIONAL=y, we need to investigate this issue further. I will get back to you during next week.

    Best regards,
    Dejan

  • Hi,

    There is a workaround for your reported issue when using CONFIG_STREAM_BIDIRECTIONAL=y 

    diff --git a/applications/nrf5340_audio/prj.conf b/applications/nrf5340_audio/prj.conf
    index b1dc911a59..6294fa3c42 100644
    --- a/applications/nrf5340_audio/prj.conf
    +++ b/applications/nrf5340_audio/prj.conf
    @@ -69,3 +69,6 @@ CONFIG_SD_LOG_LEVEL_OFF=y
     
     # Suppress LOG_INF messages from hci_core
     CONFIG_BT_HCI_CORE_LOG_LEVEL_WRN=y
    +CONFIG_BT_DEVICE_NAME="Galaxy Buds2 Pro"
    +CONFIG_BT_BONDABLE=n
    +CONFIG_STREAM_BIDIRECTIONAL=y
    diff --git a/applications/nrf5340_audio/src/bluetooth/Kconfig b/applications/nrf5340_audio/src/bluetooth/Kconfig
    index 2bb2d8d206..1bb692aa1a 100644
    --- a/applications/nrf5340_audio/src/bluetooth/Kconfig
    +++ b/applications/nrf5340_audio/src/bluetooth/Kconfig
    @@ -38,7 +38,7 @@ choice BT_AUDIO_PREF_SAMPLE_RATE
     	default BT_AUDIO_PREF_SAMPLE_RATE_16KHZ if BT_BAP_BROADCAST_16_2_1
     	default BT_AUDIO_PREF_SAMPLE_RATE_16KHZ if BT_BAP_BROADCAST_16_2_2
     	default BT_AUDIO_PREF_SAMPLE_RATE_16KHZ if BT_BAP_UNICAST_16_2_1
    -	default BT_AUDIO_PREF_SAMPLE_RATE_24KHZ if STREAM_BIDIRECTIONAL
    +	default BT_AUDIO_PREF_SAMPLE_RATE_16KHZ if STREAM_BIDIRECTIONAL
     	default BT_AUDIO_PREF_SAMPLE_RATE_24KHZ if BT_BAP_BROADCAST_24_2_1
     	default BT_AUDIO_PREF_SAMPLE_RATE_24KHZ if BT_BAP_BROADCAST_24_2_2
     	default BT_AUDIO_PREF_SAMPLE_RATE_24KHZ if BT_BAP_UNICAST_24_2_1
    diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c
    index 26aabe4b25..384a305e85 100644
    --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c
    +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c
    @@ -98,7 +98,7 @@ static struct bt_bap_lc3_preset lc3_preset_sink_48_4_1 = BT_BAP_LC3_UNICAST_PRES
     static struct bt_bap_lc3_preset lc3_preset_sink_24_2_1 = BT_BAP_LC3_UNICAST_PRESET_24_2_1(
     	BT_AUDIO_LOCATION_ANY, (BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED));
     static struct bt_bap_lc3_preset lc3_preset_sink_16_2_1 = BT_BAP_LC3_UNICAST_PRESET_16_2_1(
    -	BT_AUDIO_LOCATION_ANY, (BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED));
    +	BT_AUDIO_LOCATION_ANY, (BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED|BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL));
     
     static struct bt_bap_lc3_preset lc3_preset_source = BT_BAP_LC3_UNICAST_PRESET_NRF5340_AUDIO_SOURCE;
     static struct bt_bap_lc3_preset lc3_preset_source_48_4_1 =
    @@ -106,7 +106,7 @@ static struct bt_bap_lc3_preset lc3_preset_source_48_4_1 =
     static struct bt_bap_lc3_preset lc3_preset_source_24_2_1 =
     	BT_BAP_LC3_UNICAST_PRESET_24_2_1(BT_AUDIO_LOCATION_ANY, BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED);
     static struct bt_bap_lc3_preset lc3_preset_source_16_2_1 =
    -	BT_BAP_LC3_UNICAST_PRESET_16_2_1(BT_AUDIO_LOCATION_ANY, BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED);
    +	BT_BAP_LC3_UNICAST_PRESET_16_2_1(BT_AUDIO_LOCATION_ANY, (BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED|BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL));
     
     static bool playing_state = true;
     
    @@ -635,15 +635,15 @@ static bool source_parse_cb(struct bt_data *data, void *user_data)
     			break;
     		}
     
    -		/* If no match with the preferred, revert to trying highest first */
    -		if (lc3_freq_bit & BT_AUDIO_CODEC_CAP_FREQ_48KHZ) {
    -			lc3_preset_source = lc3_preset_source_48_4_1;
    +		/* If no match with the preferred, revert to trying lowest first */
    +		if (lc3_freq_bit & BT_AUDIO_CODEC_CAP_FREQ_16KHZ) {
    +			lc3_preset_source = lc3_preset_source_16_2_1;
     			*(bool *)user_data = true;
     		} else if (lc3_freq_bit & BT_AUDIO_CODEC_CAP_FREQ_24KHZ) {
     			lc3_preset_source = lc3_preset_source_24_2_1;
     			*(bool *)user_data = true;
    -		} else if (lc3_freq_bit & BT_AUDIO_CODEC_CAP_FREQ_16KHZ) {
    -			lc3_preset_source = lc3_preset_source_16_2_1;
    +		} else if (lc3_freq_bit & BT_AUDIO_CODEC_CAP_FREQ_48KHZ) {
    +			lc3_preset_source = lc3_preset_source_48_4_1;
     			*(bool *)user_data = true;
     		}
     
    


    Best regards,
    Dejan

Reply
  • Hi,

    There is a workaround for your reported issue when using CONFIG_STREAM_BIDIRECTIONAL=y 

    diff --git a/applications/nrf5340_audio/prj.conf b/applications/nrf5340_audio/prj.conf
    index b1dc911a59..6294fa3c42 100644
    --- a/applications/nrf5340_audio/prj.conf
    +++ b/applications/nrf5340_audio/prj.conf
    @@ -69,3 +69,6 @@ CONFIG_SD_LOG_LEVEL_OFF=y
     
     # Suppress LOG_INF messages from hci_core
     CONFIG_BT_HCI_CORE_LOG_LEVEL_WRN=y
    +CONFIG_BT_DEVICE_NAME="Galaxy Buds2 Pro"
    +CONFIG_BT_BONDABLE=n
    +CONFIG_STREAM_BIDIRECTIONAL=y
    diff --git a/applications/nrf5340_audio/src/bluetooth/Kconfig b/applications/nrf5340_audio/src/bluetooth/Kconfig
    index 2bb2d8d206..1bb692aa1a 100644
    --- a/applications/nrf5340_audio/src/bluetooth/Kconfig
    +++ b/applications/nrf5340_audio/src/bluetooth/Kconfig
    @@ -38,7 +38,7 @@ choice BT_AUDIO_PREF_SAMPLE_RATE
     	default BT_AUDIO_PREF_SAMPLE_RATE_16KHZ if BT_BAP_BROADCAST_16_2_1
     	default BT_AUDIO_PREF_SAMPLE_RATE_16KHZ if BT_BAP_BROADCAST_16_2_2
     	default BT_AUDIO_PREF_SAMPLE_RATE_16KHZ if BT_BAP_UNICAST_16_2_1
    -	default BT_AUDIO_PREF_SAMPLE_RATE_24KHZ if STREAM_BIDIRECTIONAL
    +	default BT_AUDIO_PREF_SAMPLE_RATE_16KHZ if STREAM_BIDIRECTIONAL
     	default BT_AUDIO_PREF_SAMPLE_RATE_24KHZ if BT_BAP_BROADCAST_24_2_1
     	default BT_AUDIO_PREF_SAMPLE_RATE_24KHZ if BT_BAP_BROADCAST_24_2_2
     	default BT_AUDIO_PREF_SAMPLE_RATE_24KHZ if BT_BAP_UNICAST_24_2_1
    diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c
    index 26aabe4b25..384a305e85 100644
    --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c
    +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c
    @@ -98,7 +98,7 @@ static struct bt_bap_lc3_preset lc3_preset_sink_48_4_1 = BT_BAP_LC3_UNICAST_PRES
     static struct bt_bap_lc3_preset lc3_preset_sink_24_2_1 = BT_BAP_LC3_UNICAST_PRESET_24_2_1(
     	BT_AUDIO_LOCATION_ANY, (BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED));
     static struct bt_bap_lc3_preset lc3_preset_sink_16_2_1 = BT_BAP_LC3_UNICAST_PRESET_16_2_1(
    -	BT_AUDIO_LOCATION_ANY, (BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED));
    +	BT_AUDIO_LOCATION_ANY, (BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED|BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL));
     
     static struct bt_bap_lc3_preset lc3_preset_source = BT_BAP_LC3_UNICAST_PRESET_NRF5340_AUDIO_SOURCE;
     static struct bt_bap_lc3_preset lc3_preset_source_48_4_1 =
    @@ -106,7 +106,7 @@ static struct bt_bap_lc3_preset lc3_preset_source_48_4_1 =
     static struct bt_bap_lc3_preset lc3_preset_source_24_2_1 =
     	BT_BAP_LC3_UNICAST_PRESET_24_2_1(BT_AUDIO_LOCATION_ANY, BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED);
     static struct bt_bap_lc3_preset lc3_preset_source_16_2_1 =
    -	BT_BAP_LC3_UNICAST_PRESET_16_2_1(BT_AUDIO_LOCATION_ANY, BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED);
    +	BT_BAP_LC3_UNICAST_PRESET_16_2_1(BT_AUDIO_LOCATION_ANY, (BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED|BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL));
     
     static bool playing_state = true;
     
    @@ -635,15 +635,15 @@ static bool source_parse_cb(struct bt_data *data, void *user_data)
     			break;
     		}
     
    -		/* If no match with the preferred, revert to trying highest first */
    -		if (lc3_freq_bit & BT_AUDIO_CODEC_CAP_FREQ_48KHZ) {
    -			lc3_preset_source = lc3_preset_source_48_4_1;
    +		/* If no match with the preferred, revert to trying lowest first */
    +		if (lc3_freq_bit & BT_AUDIO_CODEC_CAP_FREQ_16KHZ) {
    +			lc3_preset_source = lc3_preset_source_16_2_1;
     			*(bool *)user_data = true;
     		} else if (lc3_freq_bit & BT_AUDIO_CODEC_CAP_FREQ_24KHZ) {
     			lc3_preset_source = lc3_preset_source_24_2_1;
     			*(bool *)user_data = true;
    -		} else if (lc3_freq_bit & BT_AUDIO_CODEC_CAP_FREQ_16KHZ) {
    -			lc3_preset_source = lc3_preset_source_16_2_1;
    +		} else if (lc3_freq_bit & BT_AUDIO_CODEC_CAP_FREQ_48KHZ) {
    +			lc3_preset_source = lc3_preset_source_48_4_1;
     			*(bool *)user_data = true;
     		}
     
    


    Best regards,
    Dejan

Children
Related