From 2819f9a4c371255cdeca0a2b742763461bbc995a Mon Sep 17 00:00:00 2001 From: zhaoweiliang Date: Tue, 3 Jan 2023 20:12:08 +0800 Subject: [PATCH 1/2] Fixed hci uart flow ctrl error on ESP32-C2 and ESP32-H4 --- components/bt/porting/transport/uart/hci_uart.c | 1 + 1 file changed, 1 insertion(+) diff --git a/components/bt/porting/transport/uart/hci_uart.c b/components/bt/porting/transport/uart/hci_uart.c index 16d5076ee1e..9e6ac67677e 100644 --- a/components/bt/porting/transport/uart/hci_uart.c +++ b/components/bt/porting/transport/uart/hci_uart.c @@ -122,6 +122,7 @@ int hci_uart_config(int port_num, int32_t baud_rate, uint8_t data_bits, uint8_t .stop_bits = stop_bits, .flow_ctrl = HCI_UART_FLOWCTRL, .source_clk = UART_SCLK_DEFAULT, + .rx_flow_ctrl_thresh = UART_FIFO_LEN - 1, }; hci_uart.port = port_num; hci_uart.cfg = uart_cfg; From 98c487233c6a3a8e7ffa5eeead1ccd2afd076b01 Mon Sep 17 00:00:00 2001 From: zhaoweiliang Date: Tue, 3 Jan 2023 20:26:05 +0800 Subject: [PATCH 2/2] Fixed task watchdog trigger issue when closed hci uart --- components/bt/porting/transport/uart/hci_uart.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/bt/porting/transport/uart/hci_uart.c b/components/bt/porting/transport/uart/hci_uart.c index 9e6ac67677e..6b2da47a5e5 100644 --- a/components/bt/porting/transport/uart/hci_uart.c +++ b/components/bt/porting/transport/uart/hci_uart.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -176,9 +176,12 @@ int hci_uart_init_cbs(int port_num, hci_uart_tx_char tx_func, int hci_uart_close(int port_num) { + uart_event_t uart_event; + uart_event.type = UART_BREAK; hci_uart.uart_opened = false; // Stop uart rx task if (hci_uart.rx_task_handler != NULL) { + xQueueSend(hci_uart.evt_queue, (void *)&uart_event, 1000); ESP_LOGW(TAG, "Waiting for uart task finish..."); } while (hci_uart.rx_task_handler != NULL);