Page 1 of 1

Improve DMA UART with RTS/CTS on STM32

Posted: Sun Jan 01, 2023 11:04 pm
by mringwal
Hi there

I'm working on a port of our BTstack Bluetooth Host stack for ChibiOS. BTstack's transport layer requests data from the UART in blocks and uses CTS/RTS to avoid loosing bytes. The trunk ChibiOS/HAL implementation in uart_enter_rx_idle_loop() unconditionally restarts the UART DMA leading to a loss of bytes.

I'd like to propose to change the behaviour of uart_enter_rx_idle_loop() for the case when RTS is enabled and there's no byte callback registered.

The attached patch changes this to restart DMA only if a) RTS is not active, or, b) a single byte callback is defined. With the patch, DMA is not restarted and no byte gets lost with RTS. Tested on an F4 Discovery board.

Best regards
Matthias

Re: Improve DMA UART with RTS/CTS on STM32

Posted: Mon Jan 02, 2023 7:45 am
by Giovanni
Hi,

Added to the review board: https://review.chibios.org/

Giovanni

Re: Improve DMA UART with RTS/CTS on STM32

Posted: Mon Jan 02, 2023 1:10 pm
by mringwal
Fixed patch to match description. Sorry.