samples: Bluetooth: Broadcast audio source USB headset on nRF52 Series
Broadcast audio source USB headset on nRF52 Series with USB
support.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
diff --git a/samples/bluetooth/broadcast_audio_source/Kconfig b/samples/bluetooth/broadcast_audio_source/Kconfig
index d88378d..683eeaf 100644
--- a/samples/bluetooth/broadcast_audio_source/Kconfig
+++ b/samples/bluetooth/broadcast_audio_source/Kconfig
@@ -24,7 +24,8 @@
bool "Enable the LC3 codec"
# By default let's enable it in the platforms we know are capable of supporting it
default y
- depends on (ARCH_POSIX || SOC_NRF5340_CPUAPP)
+ depends on CPU_HAS_FPU && \
+ (ARCH_POSIX || SOC_COMPATIBLE_NRF52X || SOC_COMPATIBLE_NRF5340_CPUAPP)
select LIBLC3
select FPU
diff --git a/samples/bluetooth/broadcast_audio_source/boards/nrf52833dk_nrf52833.conf b/samples/bluetooth/broadcast_audio_source/boards/nrf52833dk_nrf52833.conf
new file mode 100644
index 0000000..ff68bab
--- /dev/null
+++ b/samples/bluetooth/broadcast_audio_source/boards/nrf52833dk_nrf52833.conf
@@ -0,0 +1,5 @@
+CONFIG_MAIN_STACK_SIZE=4096
+
+# Use USB Audio as input
+CONFIG_USE_USB_AUDIO_INPUT=y
+CONFIG_USB_DEVICE_PRODUCT="Zephyr Broadcast Source"
diff --git a/samples/bluetooth/broadcast_audio_source/boards/nrf52833dk_nrf52833.overlay b/samples/bluetooth/broadcast_audio_source/boards/nrf52833dk_nrf52833.overlay
new file mode 100644
index 0000000..b8e72f1
--- /dev/null
+++ b/samples/bluetooth/broadcast_audio_source/boards/nrf52833dk_nrf52833.overlay
@@ -0,0 +1,15 @@
+zephyr_udc0: &usbd {
+ compatible = "nordic,nrf-usbd";
+ status = "okay";
+
+ hs_0: hs_0 {
+ compatible = "usb-audio-hs";
+ mic-feature-mute;
+ mic-channel-l;
+ mic-channel-r;
+
+ hp-feature-mute;
+ hp-channel-l;
+ hp-channel-r;
+ };
+};
diff --git a/samples/bluetooth/broadcast_audio_source/boards/nrf52840dongle_nrf52840.conf b/samples/bluetooth/broadcast_audio_source/boards/nrf52840dongle_nrf52840.conf
new file mode 100644
index 0000000..ff68bab
--- /dev/null
+++ b/samples/bluetooth/broadcast_audio_source/boards/nrf52840dongle_nrf52840.conf
@@ -0,0 +1,5 @@
+CONFIG_MAIN_STACK_SIZE=4096
+
+# Use USB Audio as input
+CONFIG_USE_USB_AUDIO_INPUT=y
+CONFIG_USB_DEVICE_PRODUCT="Zephyr Broadcast Source"
diff --git a/samples/bluetooth/broadcast_audio_source/boards/nrf52840dongle_nrf52840.overlay b/samples/bluetooth/broadcast_audio_source/boards/nrf52840dongle_nrf52840.overlay
new file mode 100644
index 0000000..b8e72f1
--- /dev/null
+++ b/samples/bluetooth/broadcast_audio_source/boards/nrf52840dongle_nrf52840.overlay
@@ -0,0 +1,15 @@
+zephyr_udc0: &usbd {
+ compatible = "nordic,nrf-usbd";
+ status = "okay";
+
+ hs_0: hs_0 {
+ compatible = "usb-audio-hs";
+ mic-feature-mute;
+ mic-channel-l;
+ mic-channel-r;
+
+ hp-feature-mute;
+ hp-channel-l;
+ hp-channel-r;
+ };
+};
diff --git a/samples/bluetooth/broadcast_audio_source/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf b/samples/bluetooth/broadcast_audio_source/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf
index ff8004f..ff68bab 100644
--- a/samples/bluetooth/broadcast_audio_source/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf
+++ b/samples/bluetooth/broadcast_audio_source/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf
@@ -3,6 +3,3 @@
# Use USB Audio as input
CONFIG_USE_USB_AUDIO_INPUT=y
CONFIG_USB_DEVICE_PRODUCT="Zephyr Broadcast Source"
-
-# Two streams in one subgroup (stereo)
-CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT=1
diff --git a/samples/bluetooth/broadcast_audio_source/prj.conf b/samples/bluetooth/broadcast_audio_source/prj.conf
index d74cbbe..133a376 100644
--- a/samples/bluetooth/broadcast_audio_source/prj.conf
+++ b/samples/bluetooth/broadcast_audio_source/prj.conf
@@ -7,8 +7,8 @@
CONFIG_BT_ISO_MAX_CHAN=2
CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT=2
-CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT=2
-CONFIG_BT_ISO_TX_BUF_COUNT=4
+# Two streams in one subgroup (stereo)
+CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT=1
CONFIG_BT_ISO_TX_MTU=60
diff --git a/samples/bluetooth/broadcast_audio_source/sample.yaml b/samples/bluetooth/broadcast_audio_source/sample.yaml
index 1c27238..3c55480 100644
--- a/samples/bluetooth/broadcast_audio_source/sample.yaml
+++ b/samples/bluetooth/broadcast_audio_source/sample.yaml
@@ -20,8 +20,10 @@
- nrf52_bsim
- nrf52833dk_nrf52820
- nrf52833dk_nrf52833
+ - nrf52840dongle_nrf52840
integration_platforms:
- nrf52_bsim
- nrf52833dk_nrf52833
+ - nrf52840dongle_nrf52840
extra_args: OVERLAY_CONFIG=overlay-bt_ll_sw_split.conf
tags: bluetooth
diff --git a/samples/bluetooth/broadcast_audio_source/src/main.c b/samples/bluetooth/broadcast_audio_source/src/main.c
index 8a129e3..dcc3eba 100644
--- a/samples/bluetooth/broadcast_audio_source/src/main.c
+++ b/samples/bluetooth/broadcast_audio_source/src/main.c
@@ -465,10 +465,11 @@
usb_audio_register(hs_dev, &ops);
err = usb_enable(NULL);
- if (err) {
- printk("Failed to enable USB");
+ if (err && err != -EALREADY) {
+ printk("Failed to enable USB (%d)", err);
return 0;
}
+
#endif /* defined(CONFIG_USB_DEVICE_AUDIO) */
k_thread_start(encoder);
#endif /* defined(CONFIG_LIBLC3) */