Page 1 of 1

UART/Serial.write with communication status return

Posted: Thu Nov 29, 2018 6:58 am
by trustmiao
while using ESP-NOW

Code: Select all

esp_err_tesp_now_send(const uint8_t *peer_addr, const uint8_t *data, size_t len)
it will return ESP_OK while the message is successfully delivered.

However, while using UART,

Code: Select all

int uart_write_bytes(uart_port_tuart_num, const char *src, size_t size)
Return
(-1) Parameter error
OTHERS (>=0) The number of bytes pushed to the TX FIFO

How can we confirm the data is successfully delivered, without manually send a call back signal?
We are worried, when the usb is disconnected, the data transfering might be interrupted.

Re: UART/Serial.write with communication status return

Posted: Mon Dec 03, 2018 1:03 pm
by FreddyVictor
With standard UART, data can be (validly) sent, but, if nothing is waiting at the other end to receive it, will simply disappear...

I believe the only reliable way to know if the data was sent is if you get the receiver to reply back confirming it has been received