1| Supported Targets | ESP32-C3 | ESP32-S3 | 2| ----------------- | -------- | -------- | 3 4ESP-IDF UART HCI Controller 5================================= 6 7This example demonstrates how to configure the Bluetooth Low Energy Controller's HCI (Host Controller Interface) to communicate over UART. 8 9Using this example, BLE radio capabilities of ESP32-C3/ESP32-S3 chip, can be: 10 111. tested via standard HCI messages in Direct Test Mode 12 132. used with external Bluetooth host stack installed on PC, or other MCU. 14 15This example uses UHCI, GDMA together with UART to implement the HCI UART transport. 16 17This example uses LL/register access directly, because the UHCI driver hasn't been implemented yet. 18 19## How to use example 20 21### Hardware Required 22 23This example should be able to run on any commonly available ESP32-C3/ESP32-S3 development board. To connect UART to PC, another board such as ESP_Test Board or FT232 USB UART board is usually needed. 24 25In this example, two UARTs are used: 26 27- UART0 is used as normal output or by IDF monitor 28 29- UART1 is used to convey HCI messages 30 31 32RTS and CTS lines of UART1 are required. GPIO4, GPIO5, GPIO6, GPIO7 are used as TxD, RxD, RTS, CTS PINs of UART1, respectively. 33 34In a frequently-used scenario, if ESP_Test Board is used, connect the TX0, RX0, RTS0, CTS0 and GND of ESP_Test Board to ESP32-C3/ESP32-S3 UART1 PINs, and Attach ESP_Test board to the host PC. 35 36### Configure the project 37 38``` 39idf.py menuconfig 40``` 41 42* Baudrate of UART1 can be configured in `Example Configuration > UART Baudrate for HCI` 43 44### Build and Flash 45 46Build the project and flash it to the board, then run monitor tool to view serial output: 47 48``` 49idf.py -p PORT flash monitor 50``` 51 52(Replace PORT with the name of the serial port to use.) 53 54(To exit the serial monitor, type ``Ctrl-]``.) 55 56See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects. 57 58## Example Output 59 60The example sets up the HCI UART transport and enable Bluetooth Controller, after started. UART1 PIN and baudrate settings is printed at serial output: 61 62``` 63I (306) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 64I (306) gpio: GPIO[6]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 65I (316) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 66I (326) gpio: GPIO[7]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 67I (336) BTDM_INIT: BT controller compile version [33175c8] 68I (346) phy_init: phy_version 907,3369105-dirty,Dec 3 2021,14:55:12 69I (406) system_api: Base MAC address is not set 70I (406) system_api: read default base MAC address from EFUSE 71I (406) BTDM_INIT: Bluetooth MAC: 7c:df:a1:61:e5:36 72 73I (406) UHCI: HCI messages can be communicated over UART1: 74--PINs: TxD 4, RxD 5, RTS 6, CTS 7 75--Baudrate: 115200 76``` 77 78After these output occurs, HCI messages can be commnunicated over UART1. 79 80## Troubleshooting 81 82## Example Breakdown 83 84