diff --git a/examples/bluetooth/hci/README.md b/examples/bluetooth/hci/README.md index 466c516186..71ef9bbdfa 100644 --- a/examples/bluetooth/hci/README.md +++ b/examples/bluetooth/hci/README.md @@ -12,11 +12,11 @@ Demonstrates interaction with controller through HCI over UART on ESP32. See the [README.md](./controller_hci_uart_esp32/README.md) file in the example [controller_hci_uart](./controller_hci_uart_esp32). -## controller_hci_uart_esp32c3 +## controller_hci_uart_esp32c3_and_esp32s3 -Demonstrates interaction with controller through HCI over UART on ESP32-C3. +Demonstrates interaction with controller through HCI over UART on ESP32-C3/ESP32-S3. -See the [README.md](./controller_hci_uart_esp32c3/README.md) file in the example [controller_hci_uart](./controller_hci_uart_esp32c3). +See the [README.md](./controller_hci_uart_esp32c3_and_esp32s3/README.md) file in the example [controller_hci_uart_esp32c3_and_esp32s3](./controller_hci_uart_esp32c3_and_esp32s3). ## controller_vhci_ble_adv diff --git a/examples/bluetooth/hci/controller_hci_uart_esp32c3/main/CMakeLists.txt b/examples/bluetooth/hci/controller_hci_uart_esp32c3/main/CMakeLists.txt deleted file mode 100644 index 47b859fbf9..0000000000 --- a/examples/bluetooth/hci/controller_hci_uart_esp32c3/main/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -idf_component_register(SRCS "uhci_uart_demo.c" - INCLUDE_DIRS "") diff --git a/examples/bluetooth/hci/controller_hci_uart_esp32c3/CMakeLists.txt b/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/CMakeLists.txt similarity index 100% rename from examples/bluetooth/hci/controller_hci_uart_esp32c3/CMakeLists.txt rename to examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/CMakeLists.txt diff --git a/examples/bluetooth/hci/controller_hci_uart_esp32c3/README.md b/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/README.md similarity index 75% rename from examples/bluetooth/hci/controller_hci_uart_esp32c3/README.md rename to examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/README.md index edaf529c76..bcc3f72fe8 100644 --- a/examples/bluetooth/hci/controller_hci_uart_esp32c3/README.md +++ b/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-C3 | -| ----------------- | -------- | +| Supported Targets | ESP32-C3 | ESP32-S3 | +| ----------------- | -------- | -------- | ESP-IDF UART HCI Controller ================================= @@ -60,20 +60,19 @@ See the Getting Started Guide for full steps to configure and use ESP-IDF to bui The example sets up the HCI UART transport and enable Bluetooth Controller, after started. UART1 PIN and baudrate settings is printed at serial output: ``` -I (296) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 -I (296) gpio: GPIO[6]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 -I (306) gpio: GPIO[4]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 -I (316) gpio: GPIO[6]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 -I (326) BTDM_INIT: BT controller compile version [6ab3130] -I (336) coexist: coexist rom version 8459080 -I (336) phy_init: phy_version 500,985899c,Apr 19 2021,16:05:08 -I (466) system_api: Base MAC address is not set -I (466) system_api: read default base MAC address from EFUSE -I (476) BTDM_INIT: Bluetooth MAC: 7c:df:a1:40:3f:16 +I (306) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 +I (306) gpio: GPIO[6]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 +I (316) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 +I (326) gpio: GPIO[7]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 +I (336) BTDM_INIT: BT controller compile version [33175c8] +I (346) phy_init: phy_version 907,3369105-dirty,Dec 3 2021,14:55:12 +I (406) system_api: Base MAC address is not set +I (406) system_api: read default base MAC address from EFUSE +I (406) BTDM_INIT: Bluetooth MAC: 7c:df:a1:61:e5:36 -I (476) UHCI: HCI messages can be communicated over UART1: +I (406) UHCI: HCI messages can be communicated over UART1: --PINs: TxD 4, RxD 5, RTS 6, CTS 7 ---Baudrate: 921600 +--Baudrate: 115200 ``` After these output occurs, HCI messages can be commnunicated over UART1. diff --git a/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/CMakeLists.txt b/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/CMakeLists.txt new file mode 100644 index 0000000000..8a3ab69279 --- /dev/null +++ b/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/CMakeLists.txt @@ -0,0 +1,2 @@ +idf_component_register(SRCS "main.c" + INCLUDE_DIRS "") diff --git a/examples/bluetooth/hci/controller_hci_uart_esp32c3/main/Kconfig.projbuild b/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/Kconfig.projbuild similarity index 100% rename from examples/bluetooth/hci/controller_hci_uart_esp32c3/main/Kconfig.projbuild rename to examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/Kconfig.projbuild diff --git a/examples/bluetooth/hci/controller_hci_uart_esp32c3/main/uhci_uart_demo.c b/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/main.c similarity index 96% rename from examples/bluetooth/hci/controller_hci_uart_esp32c3/main/uhci_uart_demo.c rename to examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/main.c index b824f0a04a..1454b50ed0 100644 --- a/examples/bluetooth/hci/controller_hci_uart_esp32c3/main/uhci_uart_demo.c +++ b/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/main.c @@ -11,6 +11,7 @@ #include "soc/lldesc.h" #include "esp_private/gdma.h" #include "hal/uhci_ll.h" +#include "nvs_flash.h" #include "esp_bt.h" #include "esp_log.h" @@ -253,6 +254,14 @@ void app_main(void) { esp_err_t ret; + /* Initialize NVS — it is used to store PHY calibration data */ + ret = nvs_flash_init(); + if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { + ESP_ERROR_CHECK(nvs_flash_erase()); + ret = nvs_flash_init(); + } + ESP_ERROR_CHECK( ret ); + uhci_uart_install(); esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); diff --git a/examples/bluetooth/hci/controller_hci_uart_esp32c3/sdkconfig.defaults b/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/sdkconfig.defaults similarity index 100% rename from examples/bluetooth/hci/controller_hci_uart_esp32c3/sdkconfig.defaults rename to examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/sdkconfig.defaults