Page 1 of 1

slow UART write

Posted: Tue Oct 19, 2021 2:46 am
by Ivo.Tisch
I would like some help with a uart problem please. I have an esp32 that needs to talk with two other esp32's with low latency. I have chosen to use UART_NUM_1 & UART_NUM_2 for this purpose. I am running them at 16 Mbaud, which they seem to cope with OK. I am using uart_write_bytes() with a tx ringbuffer of 1024*2 bytes. However I am only transferring up to 16 bytes of data per write. My problem is that uart_write_bytes() takes much longer than expected to execute ~ 12ms.

The uart_write_bytes() is used within a high priority task (configMAX_PRIORITIES-1). I have timestamped various points in the Espressif driver. The uart_write_bytes(), including its internal function uart_tx_all(), only takes around 121us to execute, but the final return, containing the bytes written, takes 99% of the time, over 11ms.

To get the timestamps I am using esp_timer_get_time(), and writing the data to a queue. The queue is handled by a low priority task and outputs the result to the console.

I am using a rtos Tick rate of 1000Hz and the CPU frequency is 240MHz.

I am using release/V4.2 commit 48c9f47247

Any advice or insights would be appreciated.

Thanks

Re: slow UART write

Posted: Tue Oct 19, 2021 7:59 pm
by Ivo.Tisch
Apologies folks - ignore the above, I made a very basic mistake.

Re: slow UART write

Posted: Wed May 18, 2022 12:04 am
by fyras1
Hi

How did you solve it?

Re: slow UART write

Posted: Thu Oct 26, 2023 2:04 pm
by crackwitz
Yes, how did you?