Improve DMA UART with RTS/CTS on STM32

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
mringwal
Posts: 6
Joined: Sun Jan 01, 2023 10:52 pm
Has thanked: 1 time
Been thanked: 1 time

Improve DMA UART with RTS/CTS on STM32

Postby mringwal » Sun Jan 01, 2023 11:04 pm

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
Attachments
stm32-uart-rts.patch.zip
(779 Bytes) Downloaded 103 times

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Improve DMA UART with RTS/CTS on STM32

Postby Giovanni » Mon Jan 02, 2023 7:45 am

Hi,

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

Giovanni

mringwal
Posts: 6
Joined: Sun Jan 01, 2023 10:52 pm
Has thanked: 1 time
Been thanked: 1 time

Re: Improve DMA UART with RTS/CTS on STM32

Postby mringwal » Mon Jan 02, 2023 1:10 pm

Fixed patch to match description. Sorry.
Attachments
stm32-uart-rts.patch.zip
(783 Bytes) Downloaded 105 times


Return to “Small Change Requests”

Who is online

Users browsing this forum: No registered users and 7 guests