From a23bd5438aaf0ce8124e0651cb0e55b2df5e46e8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 13 Sep 2021 18:45:25 +1000 Subject: [PATCH] HAL_ChibiOS: fixed RTSCTS flow control issue this fixes an issue reported on MatekH743, but also applies to other boards. When not using DMA if there have been bytes written before the auto flow control detection was enabled then these must be cleared from _total_written so the flow control detection can work correctly --- libraries/AP_HAL_ChibiOS/UARTDriver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/AP_HAL_ChibiOS/UARTDriver.cpp b/libraries/AP_HAL_ChibiOS/UARTDriver.cpp index 130dcf9d36..234b75a1b1 100644 --- a/libraries/AP_HAL_ChibiOS/UARTDriver.cpp +++ b/libraries/AP_HAL_ChibiOS/UARTDriver.cpp @@ -1093,6 +1093,7 @@ void UARTDriver::write_pending_bytes(void) if (_flow_control == FLOW_CONTROL_AUTO) { if (_first_write_started_us == 0) { _first_write_started_us = AP_HAL::micros(); + _total_written = 0; } #ifndef HAL_UART_NODMA if (tx_dma_enabled) {