1.. zephyr:code-sample:: bluetooth_isochronous_broadcaster_benchmark 2 :name: Isochronous Broadcaster Benchmark 3 :relevant-api: bt_iso bluetooth 4 5 Measure packet loss and sync loss of an ISO broadcaster against one or more receivers. 6 7The ISO Broadcast Benchmark sample measures and report packet loss and sync loss 8of an ISO broadcaster against one or more ISO broadcast receivers. 9 10Overview 11******** 12 13The sample transmits data from the *broadcaster* to the 14*receiver* (multiple receivers may be used with no effect on the test) 15and measures the quality of the sync. 16 17The application is used as both a broadcaster and a receiver, and the mode 18can easily be changed. 19 20Requirements 21************ 22 23* BlueZ running on the host, or 24* A board with Bluetooth Low Energy 5.2 support 25* A Bluetooth Controller and board that supports setting 26 CONFIG_BT_CTLR_ADV_ISO=y 27* A remote board running the same sample as the reversed role that supports 28 setting CONFIG_BT_CTLR_SYNC_ISO 29 30Building and running 31******************** 32 33This sample can be found under 34:zephyr_file:`samples/bluetooth/iso_broadcast_benchmark` in the Zephyr tree. 35 36See :zephyr:code-sample-category:`bluetooth` samples for details. 37 38 39Testing 40======= 41 42After programming the sample to both boards, test it by performing the following 43steps: 44 451. Connect to both boards with a terminal emulator (for example, PuTTY or 46 minicom). 47#. Reset both boards. 48#. In one of the terminal emulators, type "r" to start the application on the 49 connected board in the receiver role. 50#. In the other terminal emulator, type "b" to start the application in the 51 broadcaster role. 52#. Optionally modify the broadcasting settings. 53#. Observe that the receiver synchronizes to the broadcaster. 54#. Observe the receive statistics on the receiver(s). 55 56Sample output 57============== 58The receiver will output statistics for overall (since boot), current sync 59(since the BIG was synced) and latest 1000 received packets:: 60 61 *** Booting Zephyr OS build zephyr-v2.5.0-3768-g42f09317bfbe *** 62 [00:00:00.447,845] <inf> iso_broadcast_main: Starting Bluetooth Throughput 63 Choose device role - type r (receiver role) or b (broadcaster role), or q to quit: r 64 Receiver role 65 [00:00:05.784,698] <inf> iso_broadcast_receiver: Scan started 66 [00:00:05.784,698] <inf> iso_broadcast_receiver: Waiting for periodic advertiser 67 [00:00:05.793,304] <inf> iso_broadcast_receiver: Found broadcaster with address 28:3B:AD:F5:EE:0C (random) (RSSI -33) 68 [00:00:05.793,334] <inf> iso_broadcast_receiver: Periodic advertiser found 69 [00:00:05.793,701] <inf> iso_broadcast_receiver: Scan stopped 70 [00:00:05.793,701] <inf> iso_broadcast_receiver: Creating Periodic Advertising Sync 71 [00:00:05.796,081] <inf> iso_broadcast_receiver: Waiting for periodic sync 72 [00:00:06.453,460] <err> bt_scan: Unknown handle 0x0000 for periodic advertising report 73 [00:00:06.453,979] <inf> iso_broadcast_receiver: Periodic advertisement synced 74 [00:00:06.454,010] <inf> iso_broadcast_receiver: Periodic sync established 75 [00:00:06.454,040] <inf> iso_broadcast_receiver: Waiting for BIG info 76 [00:00:08.853,485] <inf> iso_broadcast_receiver: BIGinfo received: num_bis 2, nse 1, interval 7 ms, bn 1, pto 0, irc 1, max_pdu 251, sdu_interval 7500 us, max_sdu 251, phy LE 2M, without framing, not encrypted 77 [00:00:08.853,515] <inf> iso_broadcast_receiver: Syncing to BIG 78 [00:00:08.853,973] <inf> iso_broadcast_receiver: Waiting for BIG sync 79 [00:00:11.254,211] <inf> iso_broadcast_receiver: ISO Channel 0x2000124c connected 80 [00:00:11.254,333] <inf> iso_broadcast_receiver: BIG sync established 81 [00:00:11.254,486] <inf> iso_broadcast_receiver: ISO Channel 0x20001260 connected 82 [00:00:11.639,343] <inf> iso_broadcast_receiver: Overall : Received 99/100 (99.00%) - Total packets lost 1 83 [00:00:11.639,343] <inf> iso_broadcast_receiver: Current Sync: Received 99/100 (99.00%) - Total packets lost 1 84 [00:00:11.639,373] <inf> iso_broadcast_receiver: Latest 1000 : Received 99/100 (99.00%) - Total packets lost 1 85 [00:00:12.029,388] <inf> iso_broadcast_receiver: Overall : Received 199/200 (99.50%) - Total packets lost 1 86 [00:00:12.029,388] <inf> iso_broadcast_receiver: Current Sync: Received 199/200 (99.50%) - Total packets lost 1 87 [00:00:12.029,388] <inf> iso_broadcast_receiver: Latest 1000 : Received 199/200 (99.50%) - Total packets lost 1 88 89 90The broadcaster will ask if any changes to the current settings are wanted. 91If y/Y is chosen, then it will create a prompt to enter changes to the settings, 92otherwise continue with the current settings. The broadcaster will then start 93the BIG and output the current counter (since the BIG was created):: 94 95 *** Booting Zephyr OS build zephyr-v2.5.0-3768-g06d4327cc601 *** 96 [00:00:00.447,845] <inf> iso_broadcast_main: Starting Bluetooth Throughput 97 Choose device role - type r (receiver role) or b (broadcaster role), or q to quit: b 98 Broadcaster role 99 Change settings (y/N)? (Current settings: rtn=2, interval=7500, latency=10, phy=2, sdu=251, packing=0, framing=0, bis_count=2) 100 [00:00:08.802,185] <inf> iso_broadcast_broadcaster: Creating Extended Advertising set 101 [00:00:08.804,260] <inf> iso_broadcast_broadcaster: Setting Extended Advertising parameters 102 [00:00:08.804,504] <inf> iso_broadcast_broadcaster: Starting Periodic Advertising 103 [00:00:08.804,870] <inf> iso_broadcast_broadcaster: Starting Extended Advertising set 104 [00:00:08.807,159] <inf> iso_broadcast_broadcaster: Creating BIG 105 [00:00:08.807,617] <inf> iso_broadcast_broadcaster: Waiting for BIG complete 106 [00:00:08.813,049] <inf> iso_broadcast_broadcaster: ISO Channel 0x20001218 connected 107 [00:00:08.813,171] <inf> iso_broadcast_broadcaster: BIG created 108 [00:00:08.813,507] <inf> iso_broadcast_broadcaster: ISO Channel 0x2000122c connected 109 [00:00:09.196,472] <inf> iso_broadcast_broadcaster: Sending value 100 110 [00:00:09.587,036] <inf> iso_broadcast_broadcaster: Sending value 200 111 [00:00:09.977,722] <inf> iso_broadcast_broadcaster: Sending value 300 112 [00:00:10.368,347] <inf> iso_broadcast_broadcaster: Sending value 400 113 [00:00:10.758,972] <inf> iso_broadcast_broadcaster: Sending value 500 114 [00:00:11.149,597] <inf> iso_broadcast_broadcaster: Sending value 600 115 [00:00:11.540,222] <inf> iso_broadcast_broadcaster: Sending value 700 116