-->
Page 1 of 2

how many bytes are still in the Tx buffer?

PostPosted: Thu Aug 18, 2016 1:07 pm
by Thomas S.
How can I get the number of bytes, that are still in the Serial Tx buffer, or in the Serial1 Tx buffer? And is there a possibility to know, if all bytes are already sent out, including the one "on the line", including any stop bits?

And last not least: Where can I find such docu, so I don't have to ask so much? ;-)

(FYI: I need this infos to drive a full duplex to half duplex converter, to connect AX-12 dynamixel digital servos.)

Re: how many bytes are still in the Tx buffer?

PostPosted: Thu Aug 18, 2016 1:19 pm
by Thomas S.
Maybe I should also mention, that in the "2C-SDK-Espressif IoT SDK Programming Guide_v1.0.0.pdf" these is a section about UART, but nothing to find about my questions.

Also I have read about configurable UART interrupt threshholds, but I would like to do it without interrupts.

Re: how many bytes are still in the Tx buffer?

PostPosted: Thu Aug 18, 2016 1:55 pm
by Thomas S.
By chance I came across the ESP book from Neil Kolban. There is a UART section, naming the instruction

UART_CheckOutputFinished(0,1000);

But it gives a "not declared" compile error. Also adding "#include <uart.h>" did not help. Then I searched for any uart-files and only found uart.c and uart.h under .arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266 (from esp8266 installation under arduino 1.6.10)

but none of them mention any CheckOutputFinished or so.

What now?

Re: how many bytes are still in the Tx buffer?

PostPosted: Thu Aug 18, 2016 2:19 pm
by martinayotte
Maybe the function you are searching for is uart_wait_tx_empty() ...