Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

UART RX buffer problem

RooneyRooney PAJU
edited December 4 in Mongoose OS

I'm using the ESP8266.

static void uart_dispatcher(int uart_no, void arg) {
assert(uart_no == UART_NO);
size_t rx_av = mgos_uart_read_avail(uart_no);
if (rx_av > 0) {
struct mbuf rxb;
mbuf_init(&rxb, 0);
mgos_uart_read_mbuf(uart_no, &rxb, rx_av);
if (rxb.len > 0) {
printf("%.
s", (int) rxb.len, rxb.buf);
}
mbuf_free(&rxb);
}
(void) arg;
}

For example, if i send 15 bytes, i receive a 10-byte extra 5 bytes. and 5 bytes come in first and 10 bytes later.
Incoming data is ravigated into a random size..
Is there a way to set the length of your data?
Problems do not occur with TX, but only on RX.

Comments

Sign In or Register to comment.