1| Supported Targets | ESP32 |
2| ----------------- | ----- |
3
4ESP-IDF UART HCI Controller
5===========================
6
7This is a btdm controller use UART as HCI IO. This require the UART device support RTS/CTS mandatory.
8
9It can do the configuration of UART number and UART baudrate by menuconfig.
10
11## How to use example
12
13### Hardware Required
14
15This example should be able to run on any commonly available ESP32 development board. To connect UART to PC, another board such as ESP_Test Board or FT232 USB UART board is usually needed.
16
17In this example, three UARTs are used:
18
19- UART0 is used as normal output or by IDF monitor
20
21- UART1 or UART2 is used to convey HCI messages
22
23RTS and CTS lines of UART1 or UART2 are required. Pins 5, 18, 23, 19 are used as TxD, RxD, CTS, RTS PINs of UART1 or UART2, respectively.
24
25In a frequently-used scenario, if ESP_Test Board is used, connect the TX0, RX0, RTS0, CTS0 and GND of ESP_Test Board to ESP32 UART1 or UART2 PINs, and Attach ESP_Test board to the host PC.
26
27### Configure the project
28
29```
30idf.py menuconfig
31```
32
33- UART number can be configured in `HCI UART(H4) Options > UART Number for HCI`
34
35- UART baudrate can be configured in `HCI UART(H4) Options > UART Baudrate for HCI`
36
37### Build and Flash
38
39Build the project and flash it to the board, then run monitor tool to view serial output:
40
41```
42idf.py -p PORT flash monitor
43```
44
45(Replace PORT with the name of the serial port to use.)
46
47(To exit the serial monitor, type ``Ctrl-]``.)
48
49See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
50
51## Example Output
52
53The example resets the HCI UART transport and enable Bluetooth Controller.
54
55```
56I (442) CONTROLLER_UART_HCI: HCI UART1 Pin select: TX 5, RX 18, CTS 23, RTS 19
57I (442) BTDM_INIT: BT controller compile version [078d492]
58I (452) system_api: Base MAC address is not set
59I (452) system_api: read default base MAC address from EFUSE
60I (462) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
61```
62
63After these output occurs, HCI messages can be commnunicated over UART1 or UART2. (UART1 in this example)
64
65## Troubleshooting