tests: bsim: Bluetooth: Test 1ms connection interval support
Test 1ms connection interval support. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
abfe5f17a9
commit
af0aeb33fc
6 changed files with 90 additions and 3 deletions
|
@ -17,6 +17,7 @@ app=tests/bsim/bluetooth/ll/advx \
|
|||
conf_overlay=overlay-ticker_expire_info.conf compile
|
||||
|
||||
app=tests/bsim/bluetooth/ll/conn conf_file=prj_split.conf compile
|
||||
app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_1ms.conf compile
|
||||
app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_tx_defer.conf compile
|
||||
app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_privacy.conf compile
|
||||
app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_low_lat.conf compile
|
||||
|
|
11
tests/bsim/bluetooth/ll/conn/Kconfig
Normal file
11
tests/bsim/bluetooth/ll/conn/Kconfig
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Copyright (c) 2024 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config TEST_CONN_INTERVAL_1MS
|
||||
bool "Test 1 ms connection interval support"
|
||||
help
|
||||
Test 1 ms connection interval support.
|
||||
|
||||
menu "Zephyr Kernel"
|
||||
source "Kconfig.zephyr"
|
||||
endmenu
|
23
tests/bsim/bluetooth/ll/conn/prj_split_1ms.conf
Normal file
23
tests/bsim/bluetooth/ll/conn/prj_split_1ms.conf
Normal file
|
@ -0,0 +1,23 @@
|
|||
CONFIG_BT=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_BT_CENTRAL=y
|
||||
CONFIG_BT_PERIPHERAL=y
|
||||
CONFIG_BT_PRIVACY=y
|
||||
CONFIG_BT_SMP=y
|
||||
CONFIG_BT_SIGNING=y
|
||||
CONFIG_BT_BAS=y
|
||||
CONFIG_BT_HRS=y
|
||||
CONFIG_BT_ATT_PREPARE_COUNT=2
|
||||
CONFIG_BT_GATT_CLIENT=y
|
||||
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
||||
CONFIG_BT_DEVICE_NAME="bsim_test_split_1m"
|
||||
CONFIG_BT_L2CAP_TX_BUF_COUNT=6
|
||||
|
||||
CONFIG_BT_CTLR_PRIVACY=n
|
||||
|
||||
CONFIG_BT_CONN_PARAM_ANY=y
|
||||
|
||||
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
|
||||
CONFIG_BT_CTLR_CONN_INTERVAL_LOW_LATENCY=y
|
||||
|
||||
CONFIG_TEST_CONN_INTERVAL_1MS=y
|
|
@ -29,10 +29,19 @@ static struct bt_uuid_16 uuid = BT_UUID_INIT_16(0);
|
|||
static struct bt_gatt_discover_params discover_params;
|
||||
static struct bt_gatt_subscribe_params subscribe_params;
|
||||
|
||||
#if defined(CONFIG_TEST_CONN_INTERVAL_1MS)
|
||||
#define UPDATE_PARAM_INTERVAL_MIN 1
|
||||
#define UPDATE_PARAM_INTERVAL_MAX 1
|
||||
#define UPDATE_PARAM_LATENCY 0
|
||||
#define UPDATE_PARAM_TIMEOUT 10
|
||||
#define TEST_NOTIFY_COUNT 3000
|
||||
#else /* !CONFIG_TEST_CONN_INTERVAL_1MS */
|
||||
#define UPDATE_PARAM_INTERVAL_MIN 25
|
||||
#define UPDATE_PARAM_INTERVAL_MAX 45
|
||||
#define UPDATE_PARAM_LATENCY 1
|
||||
#define UPDATE_PARAM_TIMEOUT 250
|
||||
#define TEST_NOTIFY_COUNT 3
|
||||
#endif /* !CONFIG_TEST_CONN_INTERVAL_1MS */
|
||||
|
||||
static struct bt_le_conn_param update_params = {
|
||||
.interval_min = UPDATE_PARAM_INTERVAL_MIN,
|
||||
|
@ -124,16 +133,32 @@ static uint8_t notify_func(struct bt_conn *conn,
|
|||
struct bt_gatt_subscribe_params *params,
|
||||
const void *data, uint16_t length)
|
||||
{
|
||||
static uint32_t cycle_stamp;
|
||||
static int notify_count;
|
||||
uint32_t cycle_now;
|
||||
uint64_t delta;
|
||||
|
||||
if (!data) {
|
||||
printk("[UNSUBSCRIBED]\n");
|
||||
params->value_handle = 0U;
|
||||
return BT_GATT_ITER_STOP;
|
||||
}
|
||||
|
||||
printk("[NOTIFICATION] data %p length %u\n", data, length);
|
||||
cycle_now = k_cycle_get_32();
|
||||
delta = cycle_now - cycle_stamp;
|
||||
cycle_stamp = cycle_now;
|
||||
delta = k_cyc_to_ns_floor64(delta);
|
||||
|
||||
if (notify_count++ >= 1) { /* We consider it passed */
|
||||
if (!IS_ENABLED(CONFIG_TEST_CONN_INTERVAL_1MS) ||
|
||||
((delta > (NSEC_PER_MSEC / 2U)) &&
|
||||
(delta < (NSEC_PER_MSEC + (NSEC_PER_MSEC / 2U))))) {
|
||||
notify_count++;
|
||||
}
|
||||
|
||||
printk("[NOTIFICATION] %u. data %p length %u in %llu ns\n",
|
||||
notify_count, data, length, delta);
|
||||
|
||||
if (notify_count >= TEST_NOTIFY_COUNT) { /* We consider it passed */
|
||||
int err;
|
||||
|
||||
/* Disconnect before actually passing */
|
||||
|
|
|
@ -209,7 +209,8 @@ static void test_con2_main(void)
|
|||
* of starting delayed work so we do it here
|
||||
*/
|
||||
while (1) {
|
||||
if (IS_ENABLED(CONFIG_BT_CTLR_TX_DEFER)) {
|
||||
if (IS_ENABLED(CONFIG_TEST_CONN_INTERVAL_1MS) ||
|
||||
IS_ENABLED(CONFIG_BT_CTLR_TX_DEFER)) {
|
||||
k_sleep(K_MSEC(1));
|
||||
} else {
|
||||
k_sleep(K_SECONDS(1));
|
||||
|
|
26
tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_split_1ms.sh
Executable file
26
tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_split_1ms.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright 2024 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||
|
||||
# Basic connection test: a central connects to a peripheral and expects a
|
||||
# notification, using the split controller (ULL LLL) and 1ms connection
|
||||
# interval
|
||||
simulation_id="basic_conn_split_1ms"
|
||||
verbosity_level=2
|
||||
|
||||
cd ${BSIM_OUT_PATH}/bin
|
||||
|
||||
Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_conn_prj_split_1ms_conf \
|
||||
-v=${verbosity_level} -s=${simulation_id} -d=0 -RealEncryption=1 \
|
||||
-testid=peripheral -rs=23
|
||||
|
||||
Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_conn_prj_split_1ms_conf\
|
||||
-v=${verbosity_level} -s=${simulation_id} -d=1 -RealEncryption=1 \
|
||||
-testid=central -rs=6
|
||||
|
||||
Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \
|
||||
-D=2 -sim_length=20e6 $@
|
||||
|
||||
wait_for_background_jobs
|
Loading…
Add table
Add a link
Reference in a new issue