1.. zephyr:code-sample:: ble_direction_finding_connectionless_tx
2   :name: Direction Finding Periodic Advertising Beacon
3   :relevant-api: bt_gap bluetooth
4
5   Implement Bluetooth LE Direction Finding CTE Broadcaster functionality.
6
7Overview
8********
9
10A simple application demonstrating the Bluetooth LE Direction Finding CTE Broadcaster
11functionality by sending Constant Tone Extension with periodic advertising PDUs.
12
13Requirements
14************
15
16* Nordic nRF SoC based board with Direction Finding support (example boards:
17  :ref:`nrf52833dk_nrf52833`, :ref:`nrf5340dk_nrf5340`)
18* Antenna matrix for AoD (optional)
19
20Check your SoC's product specification for Direction Finding support if you are
21unsure.
22
23Building and Running
24********************
25
26By default the application supports Angle of Arrival (AoA) and Angle of
27Departure (AoD) mode.
28
29To use Angle of Arrival mode only, build this application as follows, changing
30``nrf52833dk/nrf52833`` as needed for your board:
31
32.. zephyr-app-commands::
33   :zephyr-app: samples/bluetooth/direction_finding_connectionless_tx
34   :host-os: unix
35   :board: nrf52833dk/nrf52833
36   :gen-args: -DEXTRA_CONF_FILE=overlay-aoa.conf
37   :goals: build flash
38   :compact:
39
40To run the application on nRF5340DK, a Bluetooth controller application must
41also run on the network core. The :zephyr_file:`samples/bluetooth/hci_ipc`
42sample application may be used. To build this sample with direction finding
43support enabled:
44
45* Copy
46  :zephyr_file:`samples/bluetooth/direction_finding_connectionless_tx/boards/nrf52833dk_nrf52833.overlay`
47  to a new file,
48  :file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay`.
49* Make sure the same GPIO pins are assigned to Direction Finding Extension in file
50  :zephyr_file:`samples/bluetooth/direction_finding_connectionless_tx/boards/nrf5340dk_nrf5340_cpuapp.overlay`.
51  as those in the created file :file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay`.
52* Copy
53  :zephyr_file:`samples/bluetooth/direction_finding_connectionless_tx/boards/nrf52833dk_nrf52833.conf`
54  to a new file,
55  :file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.conf`. Add
56  the line ``CONFIG_BT_EXT_ADV=y`` to enable extended size of
57  :kconfig:option:`CONFIG_BT_BUF_CMD_TX_SIZE` to support the LE Set Extended
58  Advertising Data command.
59
60Antenna matrix configuration
61****************************
62
63To use this sample with Angle of Departure enabled on Nordic SoCs, additional
64configuration must be provided via :ref:`devicetree <dt-guide>` to enable
65control of the antenna array, as well as via the ``ant_patterns`` array in the
66source code.
67
68An example devicetree overlay is in
69:zephyr_file:`samples/bluetooth/direction_finding_connectionless_tx/boards/nrf52833dk_nrf52833.overlay`.
70You can customize this overlay when building for the same board, or create your
71own board-specific overlay in the same directory for a different board. See
72:dtcompatible:`nordic,nrf-radio` for documentation on the properties used in
73this overlay. See :ref:`set-devicetree-overlays` for information on setting up
74and using overlays.
75
76Note that antenna matrix configuration for the nRF5340 SoC is part of the
77network core application. When :zephyr:code-sample:`bluetooth_hci_ipc` is used as
78network core application, the antenna matrix configuration should be stored in
79the file
80:file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay`
81instead.
82
83In addition to the devicetree configuration, to successfully use the Direction
84Finding locator when the AoA mode is enabled, also update the antenna patterns
85in the :cpp:var:`ant_patterns` array in
86:zephyr_file:`samples/bluetooth/direction_finding_connectionless_tx/src/main.c`.
87