Skip to content

Commit

Permalink
tests: Bluetooth: ISO: BIS: Enable BIS test for nRF5340bsim
Browse files Browse the repository at this point in the history
Enable support for building and running the BIS ISO host test
on the nRF5340bsim board.

The purpose of this is to test the ISO fragmentation on both the
nRF52bsim and nRF5340bsim, as they use different drivers.

Signed-off-by: Emil Gydesen <[email protected]>
  • Loading branch information
Thalley committed Nov 29, 2024
1 parent d5ca92c commit 5bc8879
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 26 deletions.
1 change: 1 addition & 0 deletions tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpuapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ app=tests/bsim/bluetooth/ll/cis conf_overlay=overlay-acl_group.conf sysbuild=1 c
run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/samples/compile.sh
run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/audio/compile.sh
run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/audio_samples/compile.sh
run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/iso/bis/compile.sh

wait_for_background_jobs
22 changes: 22 additions & 0 deletions tests/bsim/bluetooth/host/iso/bis/Kconfig.sysbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) 2023-2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

source "share/sysbuild/Kconfig"

config NET_CORE_BOARD
string
default "nrf5340dk/nrf5340/cpunet" if "$(BOARD)" = "nrf5340dk"
default "nrf5340_audio_dk/nrf5340/cpunet" if "$(BOARD)" = "nrf5340_audio_dk"
default "nrf5340bsim/nrf5340/cpunet" if $(BOARD_TARGET_STRING) = "NRF5340BSIM_NRF5340_CPUAPP"

config NET_CORE_IMAGE_HCI_IPC
bool "HCI IPC image on network core"
default y
depends on NET_CORE_BOARD != ""


config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX
int
# Let's pass the test arguments to the application MCU test
# otherwise by default they would have gone to the net core.
default 0 if $(BOARD_TARGET_STRING) = "NRF5340BSIM_NRF5340_CPUAPP"
22 changes: 22 additions & 0 deletions tests/bsim/bluetooth/host/iso/bis/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Copyright 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

# Compile all the applications needed by the bsim tests in these subfolders

#set -x #uncomment this line for debugging
set -ue
: "${ZEPHYR_BASE:?ZEPHYR_BASE must be set to point to the zephyr root directory}"

source ${ZEPHYR_BASE}/tests/bsim/compile.source

if [ "${BOARD_TS}" == "nrf5340bsim_nrf5340_cpuapp" ]; then
app=tests/bsim/bluetooth/host/iso/bis exe_name=bs_${BOARD_TS}_${app}_prj_conf \
sysbuild=1 compile
else
app=tests/bsim/bluetooth/host/iso/bis conf_overlay=controller.conf \
exe_name=bs_${BOARD_TS}_${app}_prj_conf \
sysbuild=1 compile
fi

wait_for_background_jobs
13 changes: 13 additions & 0 deletions tests/bsim/bluetooth/host/iso/bis/controller.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Controller ISO configs
CONFIG_BT_CTLR_ADV_ISO=y
CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=4
CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=4
CONFIG_BT_CTLR_SYNC_ISO=y
CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=4
CONFIG_BT_CTLR_SYNC_ISO_STREAM_COUNT=4

CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=208
# The host may fragment a single SDU into 3, so this needs to be 3 x CONFIG_BT_ISO_TX_BUF_COUNT
CONFIG_BT_CTLR_ISO_TX_BUFFERS=12
CONFIG_BT_CTLR_ISOAL_SOURCES=4
CONFIG_BT_CTLR_ISOAL_SINKS=4
17 changes: 5 additions & 12 deletions tests/bsim/bluetooth/host/iso/bis/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,14 @@ CONFIG_BT_DEVICE_NAME="BIS test"

CONFIG_BT_ISO_BROADCASTER=y
CONFIG_BT_ISO_SYNC_RECEIVER=y
CONFIG_BT_ISO_TX_BUF_COUNT=4
CONFIG_BT_ISO_MAX_CHAN=4

CONFIG_BT_ISO_TX_BUF_COUNT=4
CONFIG_BT_ISO_TX_MTU=200

CONFIG_BT_ISO_RX_BUF_COUNT=4
# The broadcaster may send 3 x CONFIG_BT_ISO_TX_MTU in a single SDU
CONFIG_BT_ISO_RX_MTU=600

CONFIG_BT_ISO_LOG_LEVEL_DBG=y

# Controller ISO configs
CONFIG_BT_CTLR_ADV_ISO=y
CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=4
CONFIG_BT_CTLR_SYNC_ISO=y
CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=4
CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=208
# The host may fragment a single SDU into 3, so this needs to be 3 x CONFIG_BT_ISO_TX_BUF_COUNT
CONFIG_BT_CTLR_ISO_TX_BUFFERS=12
CONFIG_BT_CTLR_ISOAL_SOURCES=4
CONFIG_BT_CTLR_ISOAL_SINKS=4
# CONFIG_BT_DEBUG_ISO_DATA=y
2 changes: 1 addition & 1 deletion tests/bsim/bluetooth/host/iso/bis/src/bis_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "common.h"

LOG_MODULE_REGISTER(bis_receiver, LOG_LEVEL_INF);
LOG_MODULE_REGISTER(bis_receiver, LOG_LEVEL_DBG);

#define PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO 5U /* Set the timeout relative to interval */
/* The broadcaster will send SDUs from 0 to CONFIG_BT_ISO_RX_MTU in the SDU data length. We want to
Expand Down
32 changes: 32 additions & 0 deletions tests/bsim/bluetooth/host/iso/bis/sysbuild.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (c) 2023-2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC)
# For builds in the nrf5340, we build the netcore image with the controller

set(NET_APP hci_ipc)
set(NET_APP_SRC_DIR ${ZEPHYR_BASE}/samples/bluetooth/${NET_APP})

ExternalZephyrProject_Add(
APPLICATION ${NET_APP}
SOURCE_DIR ${NET_APP_SRC_DIR}
BOARD ${SB_CONFIG_NET_CORE_BOARD}
)

set(${NET_APP}_CONF_FILE
${NET_APP_SRC_DIR}/nrf5340_cpunet_iso-bt_ll_sw_split.conf
CACHE INTERNAL ""
)

set(${NET_APP}_EXTRA_CONF_FILE
${APP_DIR}/controller.conf
CACHE INTERNAL ""
)

native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP})
endif()

native_simulator_set_final_executable(${DEFAULT_IMAGE})


native_simulator_set_primary_mcu_index(${DEFAULT_IMAGE} ${NET_APP})
13 changes: 0 additions & 13 deletions tests/bsim/bluetooth/host/iso/bis/tests_scripts/_compile.sh

This file was deleted.

1 change: 1 addition & 0 deletions tests/bsim/bluetooth/tests.nrf5340bsim_nrf5340_cpuapp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso.sh
tests/bsim/bluetooth/samples/central_hr_peripheral_hr/
tests/bsim/bluetooth/audio_samples/
tests/bsim/bluetooth/audio/
tests/bsim/bluetooth/host/iso/bis/

0 comments on commit 5bc8879

Please sign in to comment.