Commit Graph

820 Commits

Author SHA1 Message Date
Aleksandr Khromykh
69c5c6f40e Bluetooth: Mesh: make corresponding group ID unique
Commit fixes bug when corresponding group ID was never
incremented for independent corresponding relationships.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-03-31 22:01:11 +02:00
Vinayak Kariappa Chettimada
306b6ecdfc tests: bsim: Bluetooth: Enable MIC failure CIS tests
Enable back previously failed CIS tests due to MIC failures.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-03-29 06:32:21 +01:00
Håvard Reierstad
acccd46306 Bluetooth: Mesh: Test pb cancelling in bsim
Adds a provision test to check that provisioning bearers are cancelled
when a provisioning link is opened. Modifies the functionality for
receiving unprovisioned beacons to fail the test if a unprovisioned
beacon is received from the current provisionee after a threshold.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2025-03-26 16:19:31 +01:00
Håvard Reierstad
062fdc30bd Bluetooth: Mesh: Fix typo in prov bsim
Changes Brearer --> Bearer.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2025-03-26 16:19:31 +01:00
Emil Gydesen
a15cc2d37c tests: Bluetooth: BAP: Make RX checks less strict
Modify stream_rx.c so that the calls to FAIL are guarded
by the newly added valid_rx_cnt.

This helps prevent timing issues, especially with
broadcast, where the first SDU(s) may be delayed from
the application, and thus may be missed/contain errors.
Now it will only treat missing or error SDUs as a FAIL
if we have received a valid SDU. All fails, will still be
logged. We now also log both valid and total count.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-25 08:43:44 +01:00
Alberto Escolar Piedras
5295e10c26 tests/bsim/run_parallel: Fail if an explicitly listed test is missing
Instead of just printing a warning, fail (return != 0 to the shell)
if a test is missing, or a pattern does not match any test.

Also, warn (and return != 0) if no tests are found when SEARCH_PATH
is provided.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-20 17:15:27 +01:00
Alberto Escolar Piedras
865c881ed0 tests/bsim: UART: Do not attempt to run empty set of multidevice tests
We never got to add any multidevice tests to the UART driver tests.
So let's not try to run that empty set in CI.

(we have some multidevice UART tests for BT).

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-20 17:15:27 +01:00
Alberto Escolar Piedras
78e772660c tests/bsim/bluetooth: Fix BIS test for 54L15 an 5340
tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso.sh
was split in two in 872b19321f
but for the 54L15 and 5340 it was forgotten in the list of
tests to run.
Let's fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-20 17:15:27 +01:00
Emil Gydesen
d19abff476 Bluetooth: CSIP: Add support for dynamically setting set size
The set size can now be dynamically set and notified.
The rank is added as a argument in the case that changing
the set size, also affects the device's rank, as ranks
in a coordinated set needs to be continuous.

The set coordinator implementation has been updated
to support receiving the new set size, and providing
this information to the upper layers.

This commit adds a babblesim test for the new API,
as well as a shell command.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-20 14:23:40 +01:00
Emil Gydesen
065dca7e92 Bluetooth: ISO: Make setting ISO data explicit
The stack will no longer implicitly set the data path
for ISO channel, and the responsibility for doing that is
now for the upper layers/applications.

This provides additional flexibility for the higher layers
as they can better control the values and timing of the data
path, as well as support removing and even reconfiguring the
data path at will.
This also removes some complexity from the stack.

This commit also fixed a inconsistency in the disconnected
handler. CIS for centrals as well as BIS were still valid
bt_iso_chan channels in the disconnected callback,
but CIS for peripherals were completely cleaned up at this
point. This issue is fixed by moving the disconnected callback
handling to before the code to cleanup the channel for
peripherals.

Since there is a difference in how you remove data paths
depending on the GAP role (central/peripheral), the
iso_info struct type has been expanded to be more
concise of which type of CIS it is.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-19 10:56:57 +01:00
Emil Gydesen
fb68b4be7e Revert "Bluetooth: Audio: Use generic count_bits to count bits"
This reverts commit ee335399c1.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-18 16:39:47 +01:00
Emil Gydesen
ee335399c1 Bluetooth: Audio: Use generic count_bits to count bits
Instead of re-implementing or assuming that POPCOUNT is available
we now use the generic function from Zephyr.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-17 21:03:56 -04:00
Vinayak Kariappa Chettimada
64ea1b8696 tests: bsim: Bluetooth: broadcast_audio_source interleaved/sequential
Test broadcast audio source sample in interleaved and
sequential packing.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-03-17 16:24:33 +01:00
Vinayak Kariappa Chettimada
872b19321f tests: bsim: Bluetooth: Test for single BIS with interleaved packing
Test for single BIS with interleaved packing or sequential
packing requested.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-03-17 16:24:33 +01:00
Emil Gydesen
25f3de75a2 tests: Bluetooth: CAP: Fix issues for CAP BSIM tests
Some CAP BSIM could not be built after some commits were merged.
One CAP test was missing a call to backchannel_sync_send_all
A change in the controller and/or timing seems to have triggered
an old issue on a bunch of tests. Theses tests have been disabled
while the issue is pending investigation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-13 18:05:12 +01:00
Emil Gydesen
501b95ff9b Bluetooth: CSIP: Rename BT_CSIP_SET_MEMBER_NOTIFIABLE
Renamed BT_CSIP_SET_MEMBER_NOTIFIABLE to
BT_CSIP_SET_MEMBER_SIRK_NOTIFIABLE to be more specific.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-13 16:56:14 +00:00
Emil Gydesen
b8a9f1f3ed tests: Bluetooth: CAP: Refactor CAP broadcast tests to multiple tests
The cap_broadcast test has been split into 3 tests:
1) Regular test
2) Regular test with metadata update
3) Test for invalid parameters

This will make it easier to use the regular cap_broadcast test
for other test cases, as it does less now.
It also makes each test run faster seperately and reduce their
scopes.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-13 10:28:19 +01:00
Emil Gydesen
1148b9ac3e tests: Bluetooth: CAP and GMAP: Add TX/RX for AC tests
Add TX and RX verification for the audio configuration tests.
This requires modifying some of the underlying structures
used in those tests, as well as initializating and triggering
TX, and with verification of RX as well.

These tests were implemented to ensure that the streams are not
just established, but can send ISO data without issues.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-13 10:28:10 +01:00
Emil Gydesen
1f26899229 Bluetooth: TBS: Ensure sending notifications
The existing implemented only attempted to send all notifications,
but if host was out of ATT TX buffers the notifications would fail
and the client may miss out on important information, and would be
a spec violation.

This commit refactors notificatios in TBS so that they are always
sent.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-13 10:27:59 +01:00
Emil Gydesen
9d4cc4b49b Bluetooth: BAP: Add a set of suggested intervals to use with BAP
Add a selection of interval values that are suitable for BAP,
which will allow better coexistence between ISO and ACL,
for both broadcast and unicast. Some of these are defined
by the BAP spec, and some are defined by Zephyr, since they
do have a suggested value from BAP.

Samples and tests have been updated to use these new values.
Peripheral samples have also been updated with
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS so that the connection
parameters from the centrals aren't updated to something else
shortly after.

The shell has also been updated to use the LE Audio (BAP) values
if audio is enabled, and the audio.conf file has disabled automatic
updating of the connection parameters as the peripheral, as we rarely
(if ever) want to do that.

Due to the connection interval change, CI hit an issue
with test_bass_broadcast_code in test_main_client_sync, where
the reading of the long receive state did not finish before we
attempted to do another procedure, so the function was updated to have
a retry.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-11 08:58:51 +01:00
Troels Nilsson
8373f19bc2 Bluetooth: Controller: Add tests covering ticker without remainder support
Update Kconfig to not select BT_TICKER_REMAINDER_SUPPORT for nrf54L

Add BSim tests to cover using a ticker without BT_TICKER_REMAINDER_SUPPORT
and expire info enabled

Signed-off-by: Troels Nilsson <trnn@demant.com>
2025-03-07 20:02:49 +01:00
Emil Gydesen
44c5c1da3d Bluetooth: Host: Add API for reading LE controller features
The function supports reading multiple controller-based values.
It is effectively a copy of struct bt_dev_le but in a more
application-oriented definition.

It was chosen to keep the features as an array rather than a
64-bit value, as the comparison macros work on arrays and that
there already exists new bits > 64 in the core spec which is not
yet supported by Zephyr.

It is being smoke tested in a generic GATT client test,
as the individual values may depend on several Kconfig options.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-07 19:58:23 +01:00
Pavel Vasilyev
14b35e2df3 tests: bsim: Fix command execution with quoted string
When running a bsim test where an option's argument is a quoted string,
using $@ to execute the arguments of the Execute function causes
incorrect quote handling.

To correctly pass all arguments, add extra quotes around $@. This
ensures that quoted strings remain intact when passed to the executable.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-03-07 19:52:55 +01:00
Pavel Vasilyev
112e27f035 tests: bsim: bluetooth: run host gatt notiy_stress test on nrf5340bsim
This commit runs host/gatt/notify_stress test on nrf5340bsim cpuapp
target.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-02-25 20:39:58 +01:00
Pavel Vasilyev
f804b28bf2 tests: bsim: bluetooth: build host tests for nrf5340bsim cpuapp
This enables host tests build for nrf5340bsim cpuapp target.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-02-25 20:39:58 +01:00
Pavel Vasilyev
a43b893a15 tests: bsim: bluetooth: host: add hci driver stress test
This commit adds a stress test to verify that the HCI driver does not
drop any data. Specifically, it tests whether the HCI IPC driver can
reliably pass data between the Host and Controller.

Due to the current HCI IPC driver implementation, this test is
guaranteed to fail if Controller-to-Host HCI ACL data flow control is
disabled.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-02-25 20:39:58 +01:00
Vinayak Kariappa Chettimada
662acab1ae Bluetooth: Controller: Fix ISO Tx PDU buffer counts for fragmentation
Fix ISO Tx PDU buffer count required when SDU fragmentation
is used.

Rename BT_CTLR_CONN_ISO_SDU_LEN_MAX to
BT_CTLR_ISO_TX_SDU_LEN_MAX so the value is common to both
Broadcast and Connected ISO transmissions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-02-24 20:18:37 +00:00
Vinayak Kariappa Chettimada
d382fca6ff Bluetooth: Controller: Fix HCI command buffer allocation failure
Fix HCI command buffer allocation failure, that can cause
loss of Host Number of Completed Packets command.

Fail by rejecting the HCI Host Buffer Size command if the
required number of HCI command buffers are not allocated in
the Controller implementation.

When Controller to Host data flow control is supported in
the Controller only build, ensure that BT_BUF_CMD_TX_COUNT
is greater than or equal to (BT_BUF_RX_COUNT + Ncmd),
where Ncmd is supported maximum Num_HCI_Command_Packets in
the Controller implementation.

Relates to commit 81614307e9 ("Bluetooth: Add workaround
for no command buffer available")'.

Relates to commit 297f4f481f ("Bluetooth: Split HCI
command & event buffers to two pools").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-02-21 11:30:38 +00:00
Benjamin Cabé
1d423e7ed5 tests: bsim: fix spelling of "advertisement"
s/advertisment/advertisement/

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-02-19 18:51:13 +01:00
Benjamin Cabé
e01aa1a8db tests: bsim: fix spelling of "available"
s/avaialble/available/

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-02-19 18:51:13 +01:00
Benjamin Cabé
abb2333187 tests: bsim: fix spelling of "corresponding"
s/correspending/corresponding/

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-02-19 18:51:13 +01:00
Emil Gydesen
bfbdf52853 tests: Bluetooth: Audio: Open backchannel to self
In order to use the device IDs send sending to a specific device,
e.g. backchannel_sync_send(3), then we need to open all backchannels
including the one to ourself, otherwise the ID and count will be
off by one.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-18 09:57:34 +01:00
Alberto Escolar Piedras
dc87bb0f68 tests/bsim UART: Let's connect the nrf54L UART00 in loopback too
A test is going to use this UART also, so we'll need it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-02-17 14:03:27 +01:00
Aleksandr Khromykh
059e86f426 tests: Bluetooth: Mesh: restore tinycrypt mesh bsim
Commit restores ble mesh bsim tests with tinycrypt.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-02-17 10:22:23 +01:00
Aleksandr Khromykh
6a9802e818 tests: Bluetooth: Mesh: remove key id distribution
Commit removes centralized PSA key ID distribution
in mesh bsim tests since secure storage is
instantiated on every simulated device.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-02-17 08:09:28 +01:00
Emil Gydesen
907261b619 Bluetooth: BAP: Remove GATT_CACHING req for unicast server
The unicast server does not need GATT caching and it was likely
incorrectly added earlier as a dependency.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-14 19:15:57 +00:00
Emil Gydesen
b9c1ef910a tests: Bluetooth: BAP: Add deregister of services for unicast server
Adds a deinit step that tests the unicast server callbacks,
unicast server and pacs unregister.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-14 17:05:32 +01:00
Emil Gydesen
f54991b7dd samples: Bluetooth: Broadcast sink: Refactor audio RX path
Refactor everything related to RX in the sample.
The existing code will moved to new files with more specific
functionality, so that each file will become cleaner and use
fewer #ifdefs.

The USB part will be refactored a bit to follow the design used
by the LE audio shell, to make it easier to maintain both in
a similar way.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-14 17:03:51 +01:00
Tomi Fontanilles
0c368e85b1 secure_storage: add a global registry header file for PSA key IDs
We need to make sure that within Zephyr different users of the PSA APIs
don't interfere with each other because of using the same numerical IDs
for persistent assets.

This takes care of the PSA key IDs when using persistent keys through
the PSA Crypto API.
See the comments in `<zephyr/psa/key_ids.h>` for more information.

This removes the recently-introduced Kconfig options that allowed changing
the base IDs subsystems were using for their persistent keys.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2025-02-13 20:22:09 +01:00
Marek Pieta
da1ae8dca5 tests: bsim: bluetooth: Test with CONFIG_BT_LONG_WQ disabled
Change adds bsim tests with CONFIG_BT_LONG_WQ=n to ensure correct
behavior. Change uses host/gatt/ccc_store test.

Change also switches to using more unique simulation ID in the test
scripts.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2025-02-12 20:26:28 +01:00
Marek Pieta
78479b092f tests: bsim: bluetooth: Test with CONFIG_BT_LONG_WQ disabled
Change adds bsim tests with CONFIG_BT_LONG_WQ=n to ensure correct
behavior. Change uses host/security/ccc_update test.

Change also switches to using more unique simulation ID in the test
scripts.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2025-02-12 20:26:28 +01:00
Emil Gydesen
571f26cf1a Bluetooth: Rename BLE to Bluetooth (LE) where applicable
The BLE acronym is not an official description of Bluetooth
LE, and the Bluetooth SIG only ever refers to it as Bluetooth
Low Energy or Bluetooth LE, so Zephyr should as well.

This commit does not change any board or vendor specific
documentation, and the term BLE may still be used in those.
It will be up to the vendors to update it if they want,
since many of them are using the term BLE in their
products.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-12 12:24:18 +01:00
Emil Gydesen
49d9b4cb69 Bluetooth: PACS: Remove BAP infix for pacs_register_param
Since the PACS service is not part of the bt_bap API it should
not use the bt_bap prefix, and instead just be bt_pacs like the
rest of the PACS API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-12 09:41:49 +01:00
Håvard Reierstad
7737483c06 Bluetooth: Host: More bsim refactoring
Commit does the following changes:
* Use functionality from the `babbelkit` library for common functions
  related to flags, test progression (failing, passing etc.) and
  synchronization between two devices. Locally defined equivalents are
  removed.
* Removes the files containing only functionality that is provided
  by the `babblekit` library.
* Remove the `test_pre_init_f` and `test_tick_f` functions (commonly
  implemented as `test_init` and `test_tick`) from the modified tests.
  These functions are not needed as they were only used to fail the test
  if a device didn't complete the test within a certain time frame. This
  is already handled by the `sim_length` argument used in the test
  scripts.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2025-02-12 09:40:07 +01:00
Håvard Reierstad
c2c4f2e0d1 Bluetooth: tests: Add macros to babblekit
Adds two macros to the babblekit library:
* DEFINE_FLAG_STATIC
* TEST_ASSERT_NO_MSG

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2025-02-12 09:40:07 +01:00
Lingao Meng
f5bd2170d1 tests: bsim: Add testcase for bluetooth mesh extended advertiser
Add some configuration for test adv_ext.c

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2025-02-11 15:38:35 +01:00
Jordan Yates
cd772b374f tests: bsim: bluetooth: central: conn timeout under load
Validate that the connection timeout code path works as expected when
the command buffer pool is under stress.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-02-10 03:41:16 +01:00
Vinayak Kariappa Chettimada
21cb301447 samples: Bluetooth: GATT write commands with connection PHY Update
Update the Central and Peripheral GATT write command sample
to measure throughput across all supported connection PHYs.

Cover the sample in BabbleSIM CI testing to validate the 2M
PHY throughput after all supported PHYs have been changed
once.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-02-05 08:16:30 +01:00
Emil Gydesen
026a2c54ae tests: Bluetooth: Audio: Spring cleanup for audio test files
Add missing and remove unused includes. Fix spelling mistakes.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-04 12:03:04 +01:00
Théo Battrel
161222050c Tests: Bluetooth: Add 'device_name' GATT test
The goal of this test is to ensure that setting the device name by
writing to the GAP 'Device Name' characteristic work as expected.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2025-01-30 11:15:03 +01:00