Page 1 of 1

UART echo delay problem

Posted: Mon May 23, 2022 9:24 am
by hamid.a203
Hello,

I'm trying to use uart_echo example as the base for my code. I want to read 4 bytes (with 4800 baud rate), then transmit them back, but the problem is I get about 20ms delay between Rx & Tx.

The code is so simple, but I can't understand what is the problem. Can anyone help me? I'm so confused.

P.S.: I tryed the uart_event example also, but the problem remains the same.

Re: UART echo delay problem

Posted: Tue May 24, 2022 1:57 am
by ESP_Sprite
Your issue is likely that the uart hardware tries to minimize interrupts, that is, it will wait until there is no more data incoming for a while before software actually receives the data. You could set that timeout to 0 using uart_set_rx_timeout() and see if that solves the issue.

Re: UART echo delay problem

Posted: Sat May 28, 2022 6:27 am
by hamid.a203
ESP_Sprite wrote:
Tue May 24, 2022 1:57 am
Your issue is likely that the uart hardware tries to minimize interrupts, that is, it will wait until there is no more data incoming for a while before software actually receives the data. You could set that timeout to 0 using uart_set_rx_timeout() and see if that solves the issue.

Thank you for your support. I've tested your suggestion, but it didn't work. Plus, I'm not sure how that would work.