1# Zephyr Bluetooth Controller configuration options
2
3# Copyright (c) 2020 Nordic Semiconductor ASA
4# SPDX-License-Identifier: Apache-2.0
5
6# BT_CTLR_DF_SUPPORT is a wrapper for all DF features. It is referenced by Host
7# to enable its DF related Kconfigs when build together with the Controller.
8# It is required to enable it when Controller supports any DF related feature
9# but particular features are selected individually.
10config BT_CTLR_DF_SUPPORT
11	bool
12
13if BT_CTLR_DF_SUPPORT
14
15config BT_CTLR_DF_CTE_TX_SUPPORT
16	bool
17
18config BT_CTLR_DF_CTE_RX_SUPPORT
19	bool
20
21config BT_CTLR_DF_CTE_RX_SAMPLE_1US_SUPPORT
22	bool
23
24config BT_CTLR_DF_ANT_SWITCH_2US_SUPPORT
25	bool
26
27config BT_CTLR_DF_ANT_SWITCH_1US_SUPPORT
28	bool
29
30config BT_CTLR_CTEINLINE_SUPPORT
31	bool
32
33endif # BT_CTLR_DF_SUPPORT
34
35menuconfig BT_CTLR_DF
36	bool "LE Direction Finding"
37	depends on BT_CTLR_DF_CTE_TX_SUPPORT || BT_CTLR_DF_CTE_RX_SUPPORT
38	help
39	  Enable support for Bluetooth 5.1 Direction Finding
40
41if BT_CTLR_DF
42
43# Basic controller functionalities required for implementation of
44# Bluetooth v5.1 Direction Finding
45
46config BT_CTLR_DF_CTE_TX
47	bool "Transmission of Constant Tone Extension"
48	depends on BT_CTLR_DF_CTE_TX_SUPPORT
49	default y
50	help
51	  Enable support for transmission of Constant Tone Extension in
52	  controller.
53
54config BT_CTLR_DF_CTE_RX_SAMPLE_1US
55	bool "Reception of CTE with 1us sampling slots"
56	depends on BT_CTLR_DF_CTE_RX_SAMPLE_1US_SUPPORT
57	default y
58	help
59	  Enable reception of Constant Tone Extension. Process IQ sampling
60	  during CTE reception with 1us sampling slots.
61	  This sampling mode is optional for Direction Finding according to
62	  Bluetooth v5.1.
63
64config BT_CTLR_DF_ANT_SWITCH_1US
65	bool "Support for 1us antenna switch slots"
66	depends on BT_CTLR_DF_ANT_SWITCH_1US_SUPPORT
67	default y
68	help
69	  Enable support for 1us antenna switching slots. This antenna switching
70	  mode is optional for Direction Finding according to Bluetooth v5.1.
71
72# Features related with Direction Finding
73# BT Core spec 5.1, Vol 6, Part B, sec. 4.6 Feature Support
74
75config BT_CTLR_DF_ANT_SWITCH_TX
76	bool "Antenna switching during CTE transmission (AoD) feature"
77	depends on BT_CTLR_DF_CTE_TX && BT_CTLR_DF_ANT_SWITCH_2US_SUPPORT
78	default y
79	help
80	  Enable support for antenna switching during CTE transmission.
81	  Also known as Angle of Departure mode.
82
83config BT_CTLR_DF_ANT_SWITCH_RX
84	bool "Antenna switching during CTE reception (AoA) feature"
85	depends on BT_CTLR_DF_CTE_RX && BT_CTLR_DF_ANT_SWITCH_2US_SUPPORT
86	default y
87	help
88	  Enable support for antenna switching during CTE reception.
89	  Also known as Angle of Arrival mode.
90
91config BT_CTLR_DF_CTE_RX
92	bool "Reception of Constant Tone Extension feature"
93	depends on BT_CTLR_DF_CTE_RX_SUPPORT
94	select BT_CTLR_CONN_RSSI if BT_CONN
95	default y
96	help
97	  Enable support for reception of Constant Tone Extension in controller.
98
99config BT_CTLR_DF_CONN_CTE_REQ
100	bool "Connection CTE Request feature"
101	depends on BT_CTLR_DF_CONN_CTE_RX
102	help
103	  Enable support for Bluetooth v5.1 Connection CTE Request feature
104	  in controller.
105
106config BT_CTLR_DF_CONN_CTE_RSP
107	bool "Connection CTE Response feature"
108	depends on BT_CTLR_DF_CONN_CTE_TX
109	help
110	  Enable support for Bluetooth v5.1 Connection CTE Response feature
111	  in controller.
112
113config BT_CTLR_DF_ADV_CTE_TX
114	bool "Connectionless CTE Transmitter feature"
115	depends on BT_CTLR_DF_CTE_TX && BT_CTLR_ADV_PERIODIC
116	select BT_CTLR_ADV_EXT_PDU_EXTRA_DATA_MEMORY if BT_LL_SW_SPLIT
117	default y
118	help
119	  Enable support for Bluetooth v5.1 Connectionless CTE Transmitter
120	  feature in controller.
121
122config BT_CTLR_DF_SCAN_CTE_RX
123	bool "Connectionless CTE Receiver"
124	depends on BT_CTLR_DF_CTE_RX && BT_CTLR_SYNC_PERIODIC
125	default y
126	help
127	  Enable support for Bluetooth v5.1 connectionless CTE reception
128	  in controller.
129
130config BT_CTLR_DF_CONN_CTE_TX
131	bool "Connection based CTE Transmitter"
132	depends on BT_CTLR_DF_CTE_TX && BT_CONN
133	default y
134	help
135	  Enable transmission of Constant Tone Extension in
136	  direction finding connected mode.
137
138config BT_CTLR_DF_CONN_CTE_RX
139	bool "Connection based CTE Receiver"
140	depends on BT_CTLR_DF_CTE_RX && BT_CONN
141	default y
142	help
143	  Enable reception and sampling of Constant Tone Extension in direction
144	  finding connected mode.
145
146if BT_LL_SW_SPLIT
147
148config BT_CTLR_DF_SAMPLE_CTE_FOR_PDU_WITH_BAD_CRC
149	bool "Sampling of CTE for PDUs with bad CRC"
150	depends on BT_CTLR_DF_SCAN_CTE_RX
151	default y
152	help
153	  Enable support for sampling of CTE for PDUs that have bad CRC.
154
155# Customization setting to manage memory usage footprint
156
157config BT_CTLR_DF_MAX_ANT_SW_PATTERN_LEN
158	int "Maximum length of antenna switch pattern"
159	range 2 38 if SOC_COMPATIBLE_NRF
160	range 2 75 if !SOC_COMPATIBLE_NRF
161	default 12
162	help
163	  Defines maximum length of antenna switch pattern that controller
164	  is able to store. For nRF5x-based controllers, the hardware imposes
165	  the value is within range 2 to 38, where last value is maximum.
166	  For general use cases Bluetooth Core 5.1 spec. required the value
167	  to be within range 2 up to 75.
168
169config BT_CTLR_DF_INIT_ANT_SEL_GPIOS
170	bool "Initialization of GPIOs responsible for antenna switching"
171	depends on BT_CTLR_DF_ANT_SWITCH_TX || BT_CTLR_DF_ANT_SWITCH_RX
172	default y
173	help
174	  Enable implicit initialization of GPIOs responsible for antenna
175	  switching during Radio initialization.
176	  If this feature is not enabled, the Radio initialization procedure will
177	  not initialize GPIOs pins selected to drive antenna switching.
178	  In such case application is responsible for appropriate GPIOs
179	  initialization.
180
181config BT_CTLR_DF_PER_ADV_CTE_NUM_MAX
182	int "Maximum number of transmitted PDUs with Constant Tone Extension in connectionless mode"
183	depends on BT_CTLR_DF_ADV_CTE_TX && BT_CTLR_ADV_PDU_LINK
184	range 1 16
185	default 1
186	help
187	  Maximum supported number of PDUs, that have Constant Tone Extension, transmitted in single
188	  periodic advertising chain. The range is taken from BT Core spec 5.1, Vol 4 Part E
189	  section 7.8.82 HCI_LE_Set_Connectionless_IQ_Sampling_Enable Max_Sampled_CTEs parameter.
190
191config BT_CTLR_DF_PER_SCAN_CTE_NUM_MAX
192	int "Maximum number of received PDUs with Constant Tone Extension in connectionless mode"
193	depends on BT_CTLR_DF_SCAN_CTE_RX
194	range 1 16
195	default 16
196	help
197	  Maximum supported number of PDUs, that have Constant Tone Extension, received in single
198	  periodic advertising chain. The range is taken from BT Core spec 5.1, Vol 4 Part E
199	  section 7.8.82 HCI_LE_Set_Connectionless_IQ_Sampling_Enable Max_Sampled_CTEs parameter.
200
201config BT_CTLR_DF_SWITCH_OFFSET
202	int "Antenna switch offset relative to end of CRC"
203	depends on SOC_COMPATIBLE_NRF
204	range -2048 2047
205	default 0
206	help
207	  Offset of start of antenna switching after end of the CRC. It is a signed value in number
208	  of 16M cycles. Decreasing the offset value beyond the trigger of the AoA/AoD procedure
209	  will have no effect.
210
211config BT_CTLR_DF_SAMPLE_OFFSET_PHY_1M_SAMPLING_1US
212	int "CTE sampling offset relative for PHY 1M and 1US samples spacing"
213	depends on SOC_COMPATIBLE_NRF
214	range -2048 2047
215	default 1
216	help
217	  Offset of sampling start from beginning of sampling slot. The value is a signed number
218	  of 16M cycles relative. It is used when PHY is set to PHY 1M and sampling slot duration
219	  is 1 us. Decreasing the offset beyond the trigger of the AoA/AoD procedure will have
220	  no effect.
221
222config BT_CTLR_DF_SAMPLE_OFFSET_PHY_2M_SAMPLING_1US
223	int "CTE sampling offset relative for PHY 1M and 1US samples spacing"
224	depends on SOC_COMPATIBLE_NRF
225	range -2048 2047
226	default 15
227	help
228	  Offset of sampling start from beginning of sampling slot. The value is a signed number
229	  of 16M cycles relative. It is used when PHY is set to PHY 1M and sampling slot duration
230	  is 1 us. Decreasing the offset beyond the trigger of the AoA/AoD procedure will have
231	  no effect.
232
233
234config BT_CTLR_DF_SAMPLE_OFFSET_PHY_1M_SAMPLING_2US
235	int "CTE sampling offset relative for PHY 1M and 2US samples spacing"
236	depends on SOC_COMPATIBLE_NRF
237	range -2048 2047
238	default 6
239	help
240	  Offset of sampling start from beginning of sampling slot. The value is a signed number
241	  of 16M cycles relative. It is used when PHY is set to PHY 1M and sampling slot duration
242	  is 2 us. Decreasing the offset beyond the trigger of the AoA/AoD procedure will have
243	  no effect.
244
245config BT_CTLR_DF_SAMPLE_OFFSET_PHY_2M_SAMPLING_2US
246	int "CTE sampling offset relative for PHY 1M and 2US samples spacing"
247	depends on SOC_COMPATIBLE_NRF
248	range -2048 2047
249	default 20
250	help
251	  Offset of sampling start from beginning of sampling slot. The value is a signed number
252	  of 16M cycles relative. It is used when PHY is set to PHY 1M and sampling slot duration
253	  is 2 us. Decreasing the offset beyond the trigger of the AoA/AoD procedure will have
254	  no effect.
255
256config BT_CTLR_DF_DEBUG_ENABLE
257	bool "Bluetooth Direction Finding debug support enable"
258	help
259	  This option enables debug support for the Direction Finding
260	  implementation in controller.
261
262config BT_CTLR_DF_PHYEND_OFFSET_COMPENSATION_ENABLE
263	bool
264	depends on BT_CTLR_DF_CTE_RX && BT_CONN && (SOC_NRF52811 || SOC_NRF52820 || SOC_NRF52833 || SOC_NRF5340_CPUNET)
265	default y
266	help
267	  SOCs nRF52811, nRF52820, nRF52833, nRF5340 generate PHYEND event delayed when
268	  CTEINLINECTRLEN is enabled and received PDU does not have CTEInfo field. The option
269	  enables workaround for the delay to maintain inter frame spacing (IFS) for connection
270	  events.
271
272choice
273	prompt "IQ samples 12 bit to 8 bit conversion approach"
274	default BT_CTLR_DF_IQ_SAMPLES_CONVERT_2_BITS_SHIFT if !SOC_NRF5340_CPUNET
275	default BT_CTLR_DF_IQ_SAMPLES_CONVERT_USE_8_LSB if SOC_NRF5340_CPUNET
276
277config BT_CTLR_DF_IQ_SAMPLES_CONVERT_4_BITS_SHIFT
278	bool "Conversion of IQ samples to 8 bits wide by 4 bits shift"
279	depends on BT_CTLR_DF_SCAN_CTE_RX || BT_CTLR_DF_CONN_CTE_RX
280	help
281	  IQ samples provided by the Radio Direction Finding Extension are 12 bit wide. The
282	  Bluetooth 5.3 Core Specification defines IQ samples to be 8 bits wide: Vol 4, Part E
283	  sections 7.7.65.21 and 7.7.65.22. This config enables conversion of 12 bit IQ samples to
284	  8 bits by ordinary right shift operation by 4 bits. That means there is loss in accuracy
285	  since only the 8 MSB are used.
286
287config BT_CTLR_DF_IQ_SAMPLES_CONVERT_2_BITS_SHIFT
288	bool "Conversion of IQ samples to 8 bits wide by 2 bits shift"
289	depends on BT_CTLR_DF_SCAN_CTE_RX || BT_CTLR_DF_CONN_CTE_RX
290	help
291	  IQ samples provided by the Radio Direction Finding Extension are 12 bit wide. The
292	  Bluetooth 5.3 Core Specification defines IQ samples to be 8 bits wide: Vol 4, Part E
293	  sections 7.7.65.21 and 7.7.65.22. This config enables conversion of 12 bit IQ samples to
294	  8 bits by ordinary right shift operation by 2 bits and a cast to int8_t. That means there
295	  is a loss in accuracy. This conversion may be used only if you are sure samples will not
296	  saturate.
297
298config BT_CTLR_DF_IQ_SAMPLES_CONVERT_USE_8_LSB
299	bool "Conversion of IQ samples to 8 bits wide by use of 8 LSB"
300	depends on SOC_NRF5340_CPUNET && (BT_CTLR_DF_SCAN_CTE_RX || BT_CTLR_DF_CONN_CTE_RX)
301	help
302	  IQ samples provided by the Radio Direction Finding Extension are 12 bit wide. The
303	  Bluetooth 5.3 Core Specification defines IQ samples to be 8 bits wide: Vol 4, Part E
304	  sections 7.7.65.21 and 7.7.65.22. This config enables conversion of 12 bit IQ samples to
305	  8 bits by use of 8 least significant bits. This conversion may be used only if you are
306	  sure actual samples are not greater than 8 bits. This prevents additional accuracy loss
307	  due to shifting operation.
308
309endchoice
310
311# Vendor specifici extensions configuration
312
313config BT_CTLR_DF_VS_CL_IQ_REPORT_16_BITS_IQ_SAMPLES
314	bool "Use 16 bits signed integer IQ samples in connectionless IQ reports"
315	depends on BT_CTLR_DF_SCAN_CTE_RX && BT_HCI_VS_EXT
316	select BT_HCI_VS_EVT
317	help
318	  Direction Finging connectionless IQ reports provide a set of IQ samples collected during
319	  sampling of CTE. Bluetooth 5.3 Core Specification defines IQ samples to be 8 bits signed
320	  integer, see Vol 4, Part E section 7.7.65.21. This option enables a vendor specific
321	  extenstion to HCI layer, so that connectionless IQ reports store samples in 16 bit signed
322	  integer format.
323
324config BT_CTLR_DF_VS_CONN_IQ_REPORT_16_BITS_IQ_SAMPLES
325	bool "Use 16 bits signed integer IQ samples in connection IQ reports"
326	depends on BT_CTLR_DF_CONN_CTE_RX && BT_HCI_VS_EXT
327	select BT_HCI_VS_EVT
328	help
329	  Direction Finging connection IQ reports provide a set of IQ samples collected during
330	  sampling of CTE. Bluetooth 5.3 Core Specification defines IQ samples to be 8 bits signed
331	  integer, see Vol 4, Part E section 7.7.65.22. This option enables a vendor specific
332	  extenstion to HCI layer, so that connection IQ reports store samples in 16 bit signed
333	  integer format.
334
335endif # BT_LL_SW_SPLIT
336
337endif # BT_CTLR_DF
338