UART echo delay problem

hamid.a203
Posts: 3
Joined: Sat Apr 09, 2022 10:35 am

UART echo delay problem

Postby hamid.a203 » Mon May 23, 2022 9:24 am

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.

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: UART echo delay problem

Postby ESP_Sprite » 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.

hamid.a203
Posts: 3
Joined: Sat Apr 09, 2022 10:35 am

Re: UART echo delay problem

Postby hamid.a203 » Sat May 28, 2022 6:27 am

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.

Who is online

Users browsing this forum: ESP_Dazz, MicroController and 111 guests