Page 1 of 1

UART TX buffer length

Posted: Fri Dec 11, 2020 8:19 pm
by smhodge
Is it possible to set the UART TX buffer length? Is it possible to set it to 0 for an RX-only UART serial port?

The following works for setting the RX buffer length:
from pyb import UART
uart = UART(6)
uart.init(115200, rxbuf=64) # also accepts "read_buf_len" instead of "rxbuf"

but adding "txbuf=64" causes an "extra keyword argument" error.

I came across a Github discussion in 2018 between damien george and peter hinch that both "rxbuf" and "txbuf" were going to be added.

Thanks

Re: UART TX buffer length

Posted: Sat Dec 12, 2020 10:36 am
by pythoncoder
Looking at the source I'm not sure if there is a txbuf. I've not got time to study it in detail but it looks as if it gets data bytes from the source array. This assumes that the source is unchanged until the blocking write is complete.

For what it's worth I'm not sure there's a need for a txbuf: uasyncio handles nonblocking UART I/O very effectively.