Kconfig 21 KB

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