From cd6674f7c23e03575e9da58f934f53f771c1d6e9 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 12 Mar 2024 12:33:38 +0100 Subject: [PATCH] samples: Bluetooth: Broadcast audio sink USB headset on nRF52 Series Broadcast audio sink USB headset on nRF52 Series with USB support. Signed-off-by: Vinayak Kariappa Chettimada --- samples/bluetooth/broadcast_audio_sink/Kconfig | 3 ++- .../boards/nrf52833dk_nrf52833.conf | 3 +++ .../boards/nrf52833dk_nrf52833.overlay | 15 +++++++++++++++ .../boards/nrf52840dongle_nrf52840.conf | 3 +++ .../boards/nrf52840dongle_nrf52840.overlay | 15 +++++++++++++++ .../boards/nrf5340_audio_dk_nrf5340_cpuapp.conf | 6 +----- .../boards/nrf5340dk_nrf5340_cpuapp.conf | 3 --- .../bluetooth/broadcast_audio_sink/sample.yaml | 2 ++ samples/bluetooth/broadcast_audio_sink/src/main.c | 2 +- .../boards/nrf52833dk_nrf52833.conf | 4 +--- .../boards/nrf52840dongle_nrf52840.conf | 4 +--- .../broadcast_audio_source/boards/nrf52_bsim.conf | 1 - .../boards/nrf5340_audio_dk_nrf5340_cpuapp.conf | 4 +--- .../boards/nrf5340bsim_nrf5340_cpuapp.conf | 1 - .../boards/nrf5340dk_nrf5340_cpuapp.conf | 1 - 15 files changed, 45 insertions(+), 22 deletions(-) create mode 100644 samples/bluetooth/broadcast_audio_sink/boards/nrf52833dk_nrf52833.conf create mode 100644 samples/bluetooth/broadcast_audio_sink/boards/nrf52833dk_nrf52833.overlay create mode 100644 samples/bluetooth/broadcast_audio_sink/boards/nrf52840dongle_nrf52840.conf create mode 100644 samples/bluetooth/broadcast_audio_sink/boards/nrf52840dongle_nrf52840.overlay delete mode 100644 samples/bluetooth/broadcast_audio_sink/boards/nrf5340dk_nrf5340_cpuapp.conf delete mode 100644 samples/bluetooth/broadcast_audio_source/boards/nrf52_bsim.conf delete mode 100644 samples/bluetooth/broadcast_audio_source/boards/nrf5340bsim_nrf5340_cpuapp.conf delete mode 100644 samples/bluetooth/broadcast_audio_source/boards/nrf5340dk_nrf5340_cpuapp.conf diff --git a/samples/bluetooth/broadcast_audio_sink/Kconfig b/samples/bluetooth/broadcast_audio_sink/Kconfig index 7faffd0716..e8e10d84a7 100644 --- a/samples/bluetooth/broadcast_audio_sink/Kconfig +++ b/samples/bluetooth/broadcast_audio_sink/Kconfig @@ -47,7 +47,8 @@ config ENABLE_LC3 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_sink/boards/nrf52833dk_nrf52833.conf b/samples/bluetooth/broadcast_audio_sink/boards/nrf52833dk_nrf52833.conf new file mode 100644 index 0000000000..69b3cc5147 --- /dev/null +++ b/samples/bluetooth/broadcast_audio_sink/boards/nrf52833dk_nrf52833.conf @@ -0,0 +1,3 @@ +# Use USB Audio as audio sink +CONFIG_USE_USB_AUDIO_OUTPUT=y +CONFIG_USB_DEVICE_PRODUCT="USB Broadcast Sink" diff --git a/samples/bluetooth/broadcast_audio_sink/boards/nrf52833dk_nrf52833.overlay b/samples/bluetooth/broadcast_audio_sink/boards/nrf52833dk_nrf52833.overlay new file mode 100644 index 0000000000..b8e72f1b61 --- /dev/null +++ b/samples/bluetooth/broadcast_audio_sink/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_sink/boards/nrf52840dongle_nrf52840.conf b/samples/bluetooth/broadcast_audio_sink/boards/nrf52840dongle_nrf52840.conf new file mode 100644 index 0000000000..69b3cc5147 --- /dev/null +++ b/samples/bluetooth/broadcast_audio_sink/boards/nrf52840dongle_nrf52840.conf @@ -0,0 +1,3 @@ +# Use USB Audio as audio sink +CONFIG_USE_USB_AUDIO_OUTPUT=y +CONFIG_USB_DEVICE_PRODUCT="USB Broadcast Sink" diff --git a/samples/bluetooth/broadcast_audio_sink/boards/nrf52840dongle_nrf52840.overlay b/samples/bluetooth/broadcast_audio_sink/boards/nrf52840dongle_nrf52840.overlay new file mode 100644 index 0000000000..b8e72f1b61 --- /dev/null +++ b/samples/bluetooth/broadcast_audio_sink/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_sink/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf b/samples/bluetooth/broadcast_audio_sink/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf index f8f7db343e..69b3cc5147 100644 --- a/samples/bluetooth/broadcast_audio_sink/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf +++ b/samples/bluetooth/broadcast_audio_sink/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf @@ -1,7 +1,3 @@ -# The LC3 codec uses a large amount of stack. This app runs the codec in the work-queue, hence -# inctease stack size for that thread. -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 -CONFIG_ENABLE_LC3=y -CONFIG_TARGET_BROADCAST_CHANNEL=1 +# Use USB Audio as audio sink CONFIG_USE_USB_AUDIO_OUTPUT=y CONFIG_USB_DEVICE_PRODUCT="USB Broadcast Sink" diff --git a/samples/bluetooth/broadcast_audio_sink/boards/nrf5340dk_nrf5340_cpuapp.conf b/samples/bluetooth/broadcast_audio_sink/boards/nrf5340dk_nrf5340_cpuapp.conf deleted file mode 100644 index 8ab7a163fb..0000000000 --- a/samples/bluetooth/broadcast_audio_sink/boards/nrf5340dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1,3 +0,0 @@ -# The LC3 codec uses a large amount of stack. This app runs the codec in the work-queue, hence -# inctease stack size for that thread. -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 diff --git a/samples/bluetooth/broadcast_audio_sink/sample.yaml b/samples/bluetooth/broadcast_audio_sink/sample.yaml index 1df6e582ba..51b1d04b0e 100644 --- a/samples/bluetooth/broadcast_audio_sink/sample.yaml +++ b/samples/bluetooth/broadcast_audio_sink/sample.yaml @@ -20,8 +20,10 @@ tests: - 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_sink/src/main.c b/samples/bluetooth/broadcast_audio_sink/src/main.c index 562b4cc3be..c5e89bd999 100644 --- a/samples/bluetooth/broadcast_audio_sink/src/main.c +++ b/samples/bluetooth/broadcast_audio_sink/src/main.c @@ -1259,7 +1259,7 @@ static int init(void) usb_audio_register(hs_dev, &usb_ops); err = usb_enable(NULL); - if (err != 0) { + if (err && err != -EALREADY) { printk("Failed to enable USB\n"); return err; } diff --git a/samples/bluetooth/broadcast_audio_source/boards/nrf52833dk_nrf52833.conf b/samples/bluetooth/broadcast_audio_source/boards/nrf52833dk_nrf52833.conf index ff68bab635..8b65fa9a9d 100644 --- a/samples/bluetooth/broadcast_audio_source/boards/nrf52833dk_nrf52833.conf +++ b/samples/bluetooth/broadcast_audio_source/boards/nrf52833dk_nrf52833.conf @@ -1,5 +1,3 @@ -CONFIG_MAIN_STACK_SIZE=4096 - -# Use USB Audio as input +# Use USB Audio as audio source CONFIG_USE_USB_AUDIO_INPUT=y CONFIG_USB_DEVICE_PRODUCT="Zephyr Broadcast Source" diff --git a/samples/bluetooth/broadcast_audio_source/boards/nrf52840dongle_nrf52840.conf b/samples/bluetooth/broadcast_audio_source/boards/nrf52840dongle_nrf52840.conf index ff68bab635..8b65fa9a9d 100644 --- a/samples/bluetooth/broadcast_audio_source/boards/nrf52840dongle_nrf52840.conf +++ b/samples/bluetooth/broadcast_audio_source/boards/nrf52840dongle_nrf52840.conf @@ -1,5 +1,3 @@ -CONFIG_MAIN_STACK_SIZE=4096 - -# Use USB Audio as input +# Use USB Audio as audio source CONFIG_USE_USB_AUDIO_INPUT=y CONFIG_USB_DEVICE_PRODUCT="Zephyr Broadcast Source" diff --git a/samples/bluetooth/broadcast_audio_source/boards/nrf52_bsim.conf b/samples/bluetooth/broadcast_audio_source/boards/nrf52_bsim.conf deleted file mode 100644 index 5df721fba2..0000000000 --- a/samples/bluetooth/broadcast_audio_source/boards/nrf52_bsim.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_MAIN_STACK_SIZE=4096 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 ff68bab635..8b65fa9a9d 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 @@ -1,5 +1,3 @@ -CONFIG_MAIN_STACK_SIZE=4096 - -# Use USB Audio as input +# Use USB Audio as audio source CONFIG_USE_USB_AUDIO_INPUT=y CONFIG_USB_DEVICE_PRODUCT="Zephyr Broadcast Source" diff --git a/samples/bluetooth/broadcast_audio_source/boards/nrf5340bsim_nrf5340_cpuapp.conf b/samples/bluetooth/broadcast_audio_source/boards/nrf5340bsim_nrf5340_cpuapp.conf deleted file mode 100644 index 5df721fba2..0000000000 --- a/samples/bluetooth/broadcast_audio_source/boards/nrf5340bsim_nrf5340_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_MAIN_STACK_SIZE=4096 diff --git a/samples/bluetooth/broadcast_audio_source/boards/nrf5340dk_nrf5340_cpuapp.conf b/samples/bluetooth/broadcast_audio_source/boards/nrf5340dk_nrf5340_cpuapp.conf deleted file mode 100644 index 5df721fba2..0000000000 --- a/samples/bluetooth/broadcast_audio_source/boards/nrf5340dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_MAIN_STACK_SIZE=4096