UART TX buffer length

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
Posts: 82
Joined: Tue Jan 22, 2019 2:16 am
Location: Kirkland, WA, USA

UART TX buffer length

Post by smhodge » Fri Dec 11, 2020 8:19 pm

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.


User avatar
Posts: 4792
Joined: Fri Jul 18, 2014 8:01 am
Location: UK

Re: UART TX buffer length

Post by pythoncoder » Sat Dec 12, 2020 10:36 am

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.
Peter Hinch

Post Reply