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