Bluetooth: ISO combined BIS and CIS
The Bluetooth® ISO combined BIS and CIS sample demonstrates the capability of a Controller to support both Broadcast Isochronous Stream (BIS) and Connected Isochronous Stream (CIS) simultaneously when using the LE Isochronous Channels (ISO) feature. It uses ISO-specific APIs to create a stream, and to receive and send data. The sample acts as a Central device that receives data over CIS and forwards the received data to a BIS.
Note
The sample uses the Time of Arrival method to send data over ISO without using timestamps through a single stream (see the Providing data section in the SoftDevice Controller documentation for more information). The Bluetooth: ISO time synchronization sample can be used to learn how to synchronize data using ISO channels.
Requirements
The sample supports the following development kits:
Hardware platforms |
PCA |
Board name |
Board target |
---|---|---|---|
PCA10156 |
|
||
PCA10095 |
|
||
PCA10056 |
|
||
PCA10100 |
|
When built for a board target with the */ns
variant, the sample is configured to compile and run as a non-secure application with Cortex-M Security Extensions enabled.
Therefore, it automatically includes Trusted Firmware-M that prepares the required peripherals and secure services to be available for the application.
To test the sample, you need two additional devices. You can use any of the development kits listed above and mix different development kits.
Note
If you use nRF5340 DK, the additional configuration of the network core will be taken from the child_image
directory.
For more details, see Image-specific variables.
The sample also requires a connection to a computer with a serial terminal that supports VT100/ANSI escape characters for each of the development kits.
Overview
The sample demonstrates a device combining the CIS Central and BIS Source roles. As a CIS Central, it only receives data from a CIS Peripheral. The received data is then broadcasted over a BIS. To provide the best performance and to minimize the number of conflicts between the CIS, BIS and ACL roles, the following measures are taken:
The same ISO interval is used for both CIS and BIS. The value is set to 10 ms by default.
ACL interval is set to an integer multiple of ISO interval to avoid collisions. The value is set to 20 ms by default.
Periodic advertising of the BIS is set to the same value as the ACL interval.
The number of retransmissions is set to 10, to ensure that packets are retransmitted in case of collisions.
The sample rejects incoming Connection Update requests from the peripheral to avoid changes to the ACL interval.
The following optional Kconfig options specific to the SoftDevice Controller are used:
CONFIG_BT_CTLR_SDC_CENTRAL_ACL_EVENT_SPACING_DEFAULT
is set to 10 ms to ensure that there is enough time available to place the periodic advertising packet between ACL packets.CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT
is set to a small value 2.5 ms because the only data the sample sends over the ACL connection is Control procedures.CONFIG_BT_CTLR_SDC_BIG_RESERVED_TIME_US
is set to half of the ISO interval to ensure the BIG parameters are selected in a way that leaves enough time for ACL and CIG.CONFIG_BT_CTLR_SDC_CIG_RESERVED_TIME_US
is set to half of the ISO interval to ensure the CIG parameters are selected in a way that leaves enough time for ACL and BIG.
Building and running
This sample can be found under samples/bluetooth/iso_combined_bis_and_cis
in the nRF Connect SDK folder structure.
When built as firmware image for a board target with the */ns
variant, the sample has Cortex-M Security Extensions (CMSE) enabled and separates the firmware between Non-Secure Processing Environment (NSPE) and Secure Processing Environment (SPE).
Because of this, it automatically includes the Trusted Firmware-M (TF-M).
To read more about CMSE, see Processing environments.
To build the sample, follow the instructions in Configuring and building an application for your preferred building environment. See also Programming an application for programming steps and Testing and optimization for general information about testing and debugging in the nRF Connect SDK.
Note
When building repository applications in the SDK repositories, building with sysbuild is enabled by default.
If you work with out-of-tree freestanding applications, you need to manually pass the --sysbuild
parameter to every build command or configure west to always use it.
Testing
In addition to the device running this sample, two additional devices are required:
CIS Peripheral device that sends data over CIS.
BIS Sink device that receives data over BIS.
You can use other samples, such as the Bluetooth: ISO time synchronization sample, as the CIS Peripheral and BIS Sink.
The CIS Peripheral device should have the same name as the name set in the CONFIG_BT_DEVICE_NAME
Kconfig option of this sample.
This name is used to connect to the correct device.
After programming the sample to the development kit and programming other samples to the CIS Peripheral device and BIS sink device, perform the following steps to test it:
Connect to the kit that runs this sample with a terminal emulator (for example, nRF Connect Serial Terminal). See Testing and optimization for the required settings and steps.
Reset the kits.
Wait until the sample connects to CIS Peripheral device and establishes a CIS Peripheral device and established CIS connection.
Observe the packets transmitted by the CIS Peripheral being retransmitted over BIS and received by the BIS Sink.
Sample output
The serial output should look similar to the following output:
[00:00:00.454,589] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.454,620] <inf> bt_hci_core: HW Variant: nRF53x (0x0003)
[00:00:00.454,650] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version ... Build ...
[00:00:00.456,329] <inf> bt_hci_core: Identity: FD:DD:D6:88:AF:D4 (random)
[00:00:00.456,359] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision ..., manufacturer 0x0059
[00:00:00.456,390] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver ...
[00:00:00.456,390] <inf> app_main:
Bluetooth ISO Combined BIS and CIS sample
The sample demonstrates data transfer over Bluetooth ISO
CIS and BIS using the following topology:
┌------┐ ┌-------┐ ┌--------┐
| |ISO | CIS | ISO | |
| CIS ├----►|Central├-----►|BIS Sink|
|Periph|CIS |+ BIS | BIS | |
| | |Source | | |
└------┘ └-------┘ └--------┘
(1) (2) (3)
The sample only operates as a device 2: Combined CIS Central + BIS Source
Please, use other samples as a CIS Peripheral (TX) and BIS Sink (RX) devices.
[00:00:00.456,420] <inf> app_main: Starting combined CIS Central + BIS Source
[00:00:00.459,777] <inf> app_bis_cis: CIS central started scanning for peripheral(s)
[00:00:00.593,078] <inf> app_bis_cis: Connected: FB:DC:75:C0:18:0A (random)
[00:00:00.593,597] <inf> app_bis_cis: Connecting ISO channel
[00:00:00.600,189] <inf> app_bis_cis: BIS transmitter started
[00:00:00.607,879] <inf> app_iso_tx: ISO TX Channel connected
[00:00:00.608,459] <inf> app_iso_tx: Sent SDU, counter: 0
[00:00:00.741,577] <inf> app_iso_rx: ISO RX Channel connected
[00:00:01.449,615] <inf> app_iso_tx: Sent SDU, counter: 100
[00:00:01.731,140] <inf> app_iso_rx: Received SDU: 100, empty SDU: 0, missed SDU: 0
[00:00:02.449,645] <inf> app_iso_tx: Sent SDU, counter: 200
[00:00:02.731,140] <inf> app_iso_rx: Received SDU: 200, empty SDU: 0, missed SDU: 0
[00:00:03.449,615] <inf> app_iso_tx: Sent SDU, counter: 300
[00:00:03.731,140] <inf> app_iso_rx: Received SDU: 300, empty SDU: 0, missed SDU: 0
[00:00:04.449,615] <inf> app_iso_tx: Sent SDU, counter: 400
[00:00:04.731,140] <inf> app_iso_rx: Received SDU: 400, empty SDU: 0, missed SDU: 0
[00:00:05.449,645] <inf> app_iso_tx: Sent SDU, counter: 500
Dependencies
This sample uses the following sdk-nrfxlib library:
In addition, it uses the following Zephyr libraries:
include/console.h
-
include/kernel.h
include/sys/printk.h
include/sys/ring_buffer.h
include/zephyr/types.h
API:
include/bluetooth/bluetooth.h
include/bluetooth/iso.h
include/bluetooth/conn.h
include/bluetooth/hci.h
include/bluetooth/scan.h
References
For more information about the scheduling of different types of packets, refer to the Scheduling.