UART/Serial.write with communication status return

trustmiao
Posts: 42
Joined: Mon Aug 06, 2018 5:16 am

UART/Serial.write with communication status return

Postby trustmiao » Thu Nov 29, 2018 6:58 am

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.

FreddyVictor
Posts: 8
Joined: Sat Dec 01, 2018 11:34 am

Re: UART/Serial.write with communication status return

Postby FreddyVictor » Mon Dec 03, 2018 1:03 pm

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

Who is online

Users browsing this forum: No registered users and 64 guests