Kconfig 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. menu "Bluetooth"
  2. config BT_ENABLED
  3. bool "Bluetooth"
  4. depends on IDF_TARGET_ESP32
  5. help
  6. Select this option to enable Bluetooth and show the submenu with Bluetooth configuration choices.
  7. menu "Bluetooth controller"
  8. visible if BT_ENABLED
  9. choice BTDM_CTRL_MODE
  10. prompt "Bluetooth controller mode (BR/EDR/BLE/DUALMODE)"
  11. depends on BT_ENABLED
  12. help
  13. Specify the bluetooth controller mode (BR/EDR, BLE or dual mode).
  14. config BTDM_CTRL_MODE_BLE_ONLY
  15. bool "BLE Only"
  16. config BTDM_CTRL_MODE_BR_EDR_ONLY
  17. bool "BR/EDR Only"
  18. config BTDM_CTRL_MODE_BTDM
  19. bool "Bluetooth Dual Mode"
  20. endchoice
  21. config BTDM_CTRL_BLE_MAX_CONN
  22. int "BLE Max Connections"
  23. depends on BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM
  24. default 3
  25. range 1 9
  26. help
  27. BLE maximum connections of bluetooth controller.
  28. Each connection uses 1KB static DRAM whenever the BT controller is enabled.
  29. config BTDM_CTRL_BR_EDR_MAX_ACL_CONN
  30. int "BR/EDR ACL Max Connections"
  31. depends on BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
  32. default 2
  33. range 1 7
  34. help
  35. BR/EDR ACL maximum connections of bluetooth controller.
  36. Each connection uses 1.2KB static DRAM whenever the BT controller is enabled.
  37. config BTDM_CTRL_BR_EDR_MAX_SYNC_CONN
  38. int "BR/EDR Sync(SCO/eSCO) Max Connections"
  39. depends on BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
  40. default 0
  41. range 0 3
  42. help
  43. BR/EDR Synchronize maximum connections of bluetooth controller.
  44. Each connection uses 2KB static DRAM whenever the BT controller is enabled.
  45. choice BTDM_CTRL_BR_EDR_SCO_DATA_PATH
  46. prompt "BR/EDR Sync(SCO/eSCO) default data path"
  47. depends on BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
  48. default BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM
  49. help
  50. SCO data path, i.e. HCI or PCM.
  51. SCO data can be sent/received through HCI synchronous packets, or the data
  52. can be routed to on-chip PCM module on ESP32. PCM input/output signals can
  53. be "matrixed" to GPIOs. The default data path can also be set using API
  54. "esp_bredr_sco_datapath_set"
  55. config BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI
  56. bool "HCI"
  57. config BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM
  58. bool "PCM"
  59. endchoice
  60. config BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF
  61. int
  62. default 0 if BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI
  63. default 1 if BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM
  64. default 0
  65. menuconfig BTDM_CTRL_PCM_ROLE_EDGE_CONFIG
  66. bool "PCM Signal Config (Role and Polar)"
  67. depends on BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM
  68. default y
  69. choice BTDM_CTRL_PCM_ROLE
  70. prompt "PCM Role"
  71. depends on BTDM_CTRL_PCM_ROLE_EDGE_CONFIG
  72. help
  73. PCM role can be configured as PCM master or PCM slave
  74. config BTDM_CTRL_PCM_ROLE_MASTER
  75. bool "PCM Master"
  76. config BTDM_CTRL_PCM_ROLE_SLAVE
  77. bool "PCM Slave"
  78. endchoice
  79. choice BTDM_CTRL_PCM_POLAR
  80. prompt "PCM Polar"
  81. depends on BTDM_CTRL_PCM_ROLE_EDGE_CONFIG
  82. help
  83. PCM polarity can be configured as Falling Edge or Rising Edge
  84. config BTDM_CTRL_PCM_POLAR_FALLING_EDGE
  85. bool "Falling Edge"
  86. config BTDM_CTRL_PCM_POLAR_RISING_EDGE
  87. bool "Rising Edge"
  88. endchoice
  89. config BTDM_CTRL_PCM_ROLE_EFF
  90. int
  91. default 0 if BTDM_CTRL_PCM_ROLE_MASTER
  92. default 1 if BTDM_CTRL_PCM_ROLE_SLAVE
  93. default 0
  94. config BTDM_CTRL_PCM_POLAR_EFF
  95. int
  96. default 0 if BTDM_CTRL_PCM_POLAR_FALLING_EDGE
  97. default 1 if BTDM_CTRL_PCM_POLAR_RISING_EDGE
  98. default 0
  99. config BTDM_CTRL_AUTO_LATENCY
  100. bool "Auto latency"
  101. depends on BTDM_CTRL_MODE_BTDM
  102. default n
  103. help
  104. BLE auto latency, used to enhance classic BT performance
  105. while classic BT and BLE are enabled at the same time.
  106. config BTDM_CTRL_AUTO_LATENCY_EFF
  107. bool
  108. default BTDM_CTRL_AUTO_LATENCY if BTDM_CTRL_MODE_BTDM
  109. default n
  110. config BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT
  111. bool "Legacy Authentication Vendor Specific Event Enable"
  112. depends on BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
  113. default y
  114. help
  115. To protect from BIAS attack during Legacy authentication,
  116. Legacy authentication Vendor specific event should be enabled
  117. config BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF
  118. bool
  119. default BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT if BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
  120. default 0
  121. config BTDM_CTRL_BLE_MAX_CONN_EFF
  122. int
  123. default BTDM_CTRL_BLE_MAX_CONN if BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM
  124. default 0
  125. config BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF
  126. int
  127. default BTDM_CTRL_BR_EDR_MAX_ACL_CONN if BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
  128. default 0
  129. config BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF
  130. int
  131. default BTDM_CTRL_BR_EDR_MAX_SYNC_CONN if BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
  132. default 0
  133. choice BTDM_CTRL_PINNED_TO_CORE_CHOICE
  134. prompt "The cpu core which bluetooth controller run"
  135. depends on BT_ENABLED && !FREERTOS_UNICORE
  136. help
  137. Specify the cpu core to run bluetooth controller.
  138. Can not specify no-affinity.
  139. config BTDM_CTRL_PINNED_TO_CORE_0
  140. bool "Core 0 (PRO CPU)"
  141. config BTDM_CTRL_PINNED_TO_CORE_1
  142. bool "Core 1 (APP CPU)"
  143. depends on !FREERTOS_UNICORE
  144. endchoice
  145. config BTDM_CTRL_PINNED_TO_CORE
  146. int
  147. default 0 if BTDM_CTRL_PINNED_TO_CORE_0
  148. default 1 if BTDM_CTRL_PINNED_TO_CORE_1
  149. default 0
  150. choice BTDM_CTRL_HCI_MODE_CHOICE
  151. prompt "HCI mode"
  152. depends on BT_ENABLED
  153. help
  154. Speicify HCI mode as VHCI or UART(H4)
  155. config BTDM_CTRL_HCI_MODE_VHCI
  156. bool "VHCI"
  157. help
  158. Normal option. Mostly, choose this VHCI when bluetooth host run on ESP32, too.
  159. config BTDM_CTRL_HCI_MODE_UART_H4
  160. bool "UART(H4)"
  161. help
  162. If use external bluetooth host which run on other hardware and use UART as the HCI interface,
  163. choose this option.
  164. endchoice
  165. menu "HCI UART(H4) Options"
  166. visible if BTDM_CTRL_HCI_MODE_UART_H4
  167. config BT_HCI_UART_NO
  168. int "UART Number for HCI"
  169. depends on BTDM_CTRL_HCI_MODE_UART_H4
  170. range 1 2
  171. default 1
  172. help
  173. Uart number for HCI. The available uart is UART1 and UART2.
  174. config BT_HCI_UART_BAUDRATE
  175. int "UART Baudrate for HCI"
  176. depends on BTDM_CTRL_HCI_MODE_UART_H4
  177. range 115200 921600
  178. default 921600
  179. help
  180. UART Baudrate for HCI. Please use standard baudrate.
  181. endmenu
  182. menu "MODEM SLEEP Options"
  183. visible if BT_ENABLED
  184. config BTDM_MODEM_SLEEP
  185. bool "Bluetooth modem sleep"
  186. depends on BT_ENABLED
  187. default y
  188. help
  189. Enable/disable bluetooth controller low power mode.
  190. choice BTDM_MODEM_SLEEP_MODE
  191. prompt "Bluetooth Modem sleep mode"
  192. depends on BTDM_MODEM_SLEEP
  193. help
  194. To select which strategy to use for modem sleep
  195. config BTDM_MODEM_SLEEP_MODE_ORIG
  196. bool "ORIG Mode(sleep with low power clock)"
  197. help
  198. ORIG mode is a bluetooth sleep mode that can be used for dual mode controller. In this mode,
  199. bluetooth controller sleeps between BR/EDR frames and BLE events. A low power clock is used to
  200. maintain bluetooth reference clock.
  201. config BTDM_MODEM_SLEEP_MODE_EVED
  202. bool "EVED Mode(For internal test only)"
  203. help
  204. EVED mode is for BLE only and is only for internal test. Do not use it for production. this
  205. mode is not compatible with DFS nor light sleep
  206. endchoice
  207. choice BTDM_LOW_POWER_CLOCK
  208. prompt "Bluetooth low power clock"
  209. depends on BTDM_MODEM_SLEEP_MODE_ORIG
  210. help
  211. Select the low power clock source for bluetooth controller. Bluetooth low power clock is
  212. the clock source to maintain time in sleep mode.
  213. - "Main crystal" option provides good accuracy and can support Dynamic Frequency Scaling
  214. to be used with Bluetooth modem sleep. Light sleep is not supported.
  215. - "External 32kHz crystal" option allows user to use a 32.768kHz crystal as Bluetooth low
  216. power clock. This option is allowed as long as External 32kHz crystal is configured as
  217. the system RTC clock source. This option provides good accuracy and supports Bluetooth
  218. modem sleep to be used alongside Dynamic Frequency Scaling or light sleep.
  219. config BTDM_LPCLK_SEL_MAIN_XTAL
  220. bool "Main crystal"
  221. help
  222. Main crystal can be used as low power clock for bluetooth modem sleep. If this option is
  223. selected, bluetooth modem sleep can work under Dynamic Frequency Scaling(DFS) enabled, but
  224. cannot work when light sleep is enabled. Main crystal has a good performance in accuracy as
  225. the bluetooth low power clock source.
  226. config BTDM_LPCLK_SEL_EXT_32K_XTAL
  227. bool "External 32kHz crystal"
  228. depends on ESP32_RTC_CLK_SRC_EXT_CRYS
  229. help
  230. External 32kHz crystal has a nominal frequency of 32.768kHz and provides good frequency
  231. stability. If used as Bluetooth low power clock, External 32kHz can support Bluetooth
  232. modem sleep to be used with both DFS and light sleep.
  233. endchoice
  234. endmenu
  235. choice BTDM_BLE_SLEEP_CLOCK_ACCURACY
  236. prompt "BLE Sleep Clock Accuracy"
  237. depends on BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM
  238. default BTDM_BLE_DEFAULT_SCA_250PPM
  239. help
  240. BLE Sleep Clock Accuracy(SCA) for the local device is used to estimate window widening in BLE
  241. connection events. With a lower level of clock accuracy(e.g. 500ppm over 250ppm), the slave
  242. needs a larger RX window to synchronize with master in each anchor point, thus resulting in an
  243. increase of power consumption but a higher level of robustness in keeping connected. According
  244. to the requirements of Bluetooth Core specification 4.2, the worst-case accuracy of Classic
  245. Bluetooth low power oscialltor(LPO) is +/-250ppm in STANDBY and in low power modes such as
  246. sniff. For BLE the worst-case SCA is +/-500ppm.
  247. - "151ppm to 250ppm" option is the default value for Bluetooth Dual mode
  248. - "251ppm to 500ppm" option can be used in BLE only mode when using external 32kHz crystal as
  249. low power clock. This option is provided in case that BLE sleep clock has a lower level of
  250. accuracy, or other error sources contribute to the inaccurate timing during sleep.
  251. config BTDM_BLE_DEFAULT_SCA_500PPM
  252. bool "251ppm to 500ppm"
  253. depends on BTDM_LPCLK_SEL_EXT_32K_XTAL && BTDM_CTRL_MODE_BLE_ONLY
  254. config BTDM_BLE_DEFAULT_SCA_250PPM
  255. bool "151ppm to 250ppm"
  256. endchoice
  257. config BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF
  258. int
  259. default 0 if BTDM_BLE_DEFAULT_SCA_500PPM
  260. default 1 if BTDM_BLE_DEFAULT_SCA_250PPM
  261. default 1
  262. config BTDM_BLE_SCAN_DUPL
  263. bool "BLE Scan Duplicate Options"
  264. depends on (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
  265. default y
  266. help
  267. This select enables parameters setting of BLE scan duplicate.
  268. choice BTDM_SCAN_DUPL_TYPE
  269. prompt "Scan Duplicate Type"
  270. default BTDM_SCAN_DUPL_TYPE_DEVICE
  271. depends on BTDM_BLE_SCAN_DUPL
  272. help
  273. Scan duplicate have three ways. one is "Scan Duplicate By Device Address", This way is to use
  274. advertiser address filtering. The adv packet of the same address is only allowed to be reported once.
  275. Another way is "Scan Duplicate By Device Address And Advertising Data". This way is to use advertising
  276. data and device address filtering. All different adv packets with the same address are allowed to be
  277. reported. The last way is "Scan Duplicate By Advertising Data". This way is to use advertising data
  278. filtering. All same advertising data only allow to be reported once even though they are from
  279. different devices.
  280. config BTDM_SCAN_DUPL_TYPE_DEVICE
  281. bool "Scan Duplicate By Device Address"
  282. help
  283. This way is to use advertiser address filtering. The adv packet of the same address is only
  284. allowed to be reported once
  285. config BTDM_SCAN_DUPL_TYPE_DATA
  286. bool "Scan Duplicate By Advertising Data"
  287. help
  288. This way is to use advertising data filtering. All same advertising data only allow to be reported
  289. once even though they are from different devices.
  290. config BTDM_SCAN_DUPL_TYPE_DATA_DEVICE
  291. bool "Scan Duplicate By Device Address And Advertising Data"
  292. help
  293. This way is to use advertising data and device address filtering. All different adv packets with
  294. the same address are allowed to be reported.
  295. endchoice
  296. config BTDM_SCAN_DUPL_TYPE
  297. int
  298. depends on BTDM_BLE_SCAN_DUPL
  299. default 0 if BTDM_SCAN_DUPL_TYPE_DEVICE
  300. default 1 if BTDM_SCAN_DUPL_TYPE_DATA
  301. default 2 if BTDM_SCAN_DUPL_TYPE_DATA_DEVICE
  302. default 0
  303. config BTDM_SCAN_DUPL_CACHE_SIZE
  304. int "Maximum number of devices in scan duplicate filter"
  305. depends on BTDM_BLE_SCAN_DUPL
  306. range 10 1000
  307. default 200
  308. help
  309. Maximum number of devices which can be recorded in scan duplicate filter.
  310. When the maximum amount of device in the filter is reached, the cache will be refreshed.
  311. config BTDM_BLE_MESH_SCAN_DUPL_EN
  312. bool "Special duplicate scan mechanism for BLE Mesh scan"
  313. depends on BTDM_BLE_SCAN_DUPL
  314. default n
  315. help
  316. This enables the BLE scan duplicate for special BLE Mesh scan.
  317. config BTDM_MESH_DUPL_SCAN_CACHE_SIZE
  318. int "Maximum number of Mesh adv packets in scan duplicate filter"
  319. depends on BTDM_BLE_MESH_SCAN_DUPL_EN
  320. range 10 1000
  321. default 200
  322. help
  323. Maximum number of adv packets which can be recorded in duplicate scan cache for BLE Mesh.
  324. When the maximum amount of device in the filter is reached, the cache will be refreshed.
  325. config BTDM_CTRL_FULL_SCAN_SUPPORTED
  326. bool "BLE full scan feature supported"
  327. depends on BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM
  328. default y
  329. help
  330. The full scan function is mainly used to provide BLE scan performance.
  331. This is required for scenes with high scan performance requirements, such as BLE Mesh scenes.
  332. config BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
  333. bool "BLE adv report flow control supported"
  334. depends on (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
  335. default y
  336. help
  337. The function is mainly used to enable flow control for advertising reports. When it is enabled,
  338. advertising reports will be discarded by the controller if the number of unprocessed advertising
  339. reports exceeds the size of BLE adv report flow control.
  340. config BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM
  341. int "BLE adv report flow control number"
  342. depends on BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
  343. range 50 1000
  344. default 100
  345. help
  346. The number of unprocessed advertising report that Bluedroid can save.If you set
  347. `BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM` to a small value, this may cause adv packets lost.
  348. If you set `BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM` to a large value, Bluedroid may cache a
  349. lot of adv packets and this may cause system memory run out. For example, if you set
  350. it to 50, the maximum memory consumed by host is 35 * 50 bytes. Please set
  351. `BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM` according to your system free memory and handle adv
  352. packets as fast as possible, otherwise it will cause adv packets lost.
  353. config BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD
  354. int "BLE adv lost event threshold value"
  355. depends on BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
  356. range 1 1000
  357. default 20
  358. help
  359. When adv report flow control is enabled, The ADV lost event will be generated when the number
  360. of ADV packets lost in the controller reaches this threshold. It is better to set a larger value.
  361. If you set `BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD` to a small value or printf every adv lost event, it
  362. may cause adv packets lost more.
  363. endmenu
  364. choice BT_HOST
  365. prompt "Bluetooth Host"
  366. depends on BT_ENABLED && BTDM_CTRL_HCI_MODE_VHCI
  367. default BT_BLUEDROID_ENABLED
  368. help
  369. This helps to choose Bluetooth host stack
  370. config BT_BLUEDROID_ENABLED
  371. bool "Bluedroid - Dual-mode"
  372. help
  373. This option is recommended for classic Bluetooth or for dual-mode
  374. usecases
  375. config BT_NIMBLE_ENABLED
  376. bool "NimBLE - BLE only"
  377. help
  378. This option is recommended for BLE only usecases to save on memory
  379. config BT_CONTROLLER_ONLY
  380. bool "Controller Only"
  381. help
  382. This option is recommended when you want to communicate directly with the
  383. controller (without any host) or when you are using any other host stack
  384. not supported by Espressif (not mentioned here).
  385. endchoice
  386. menu "Bluedroid Options"
  387. visible if BT_BLUEDROID_ENABLED
  388. source "$IDF_PATH/components/bt/host/bluedroid/Kconfig.in"
  389. endmenu
  390. menu "NimBLE Options"
  391. visible if BT_NIMBLE_ENABLED
  392. source "$IDF_PATH/components/bt/host/nimble/Kconfig.in"
  393. endmenu
  394. endmenu
  395. menuconfig BLE_MESH
  396. bool "ESP BLE Mesh Support"
  397. help
  398. This option enables ESP BLE Mesh support. The specific features that are
  399. available may depend on other features that have been enabled in the
  400. stack, such as Bluetooth Support, Bluedroid Support & GATT support.
  401. source "$IDF_PATH/components/bt/esp_ble_mesh/Kconfig.in"