← index #4389PR #9448
Related · high · value 0.079
QUERY · ISSUE

esp8266: Necessity for UART flush

openby cemoxopened 2019-01-01updated 2019-07-06
port-esp8266

This is rather recommendation than issue. The code below sends a string message from UART1 and is supposed to pull the output pin LOW :

mypin.on()
uart1.write("a long sentence")
mypin.off()

when I checked the signal (part tx and output) with logic analyzer, I saw that pin is pulled low long before the uart transmission has been completed. A function like uart.flash() which checks the relevant uart status bits for completion of the transmission would be very handy.

CANDIDATE · PULL REQUEST

renesas-ra: Add the UART methods uart.txdone() and uart.flush().

mergedby robert-hhopened 2022-09-28updated 2022-12-18
port-renesas-ra

The API is consistent to the other ports. flush() returns after the last byte has been sent, and txdone() also reports True after the last byte has been sent.

This required to add two very simple functions down the stack to uart.c and ra.sci.c.

  • One for telling, whether the transmission is busy.
  • One for reporting the size of the TX buffer. There is no txbuf option for setting the bufger size, so the actually used buffer size had to be retrieved.

Tested with a EK-RA6M2 board by me and with all boards from the port's boards directory by @TakeoTakahashi2020.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied