slow UART write

Ivo.Tisch
Posts: 14
Joined: Tue Nov 05, 2019 7:59 pm

slow UART write

Postby Ivo.Tisch » Tue Oct 19, 2021 2:46 am

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

Ivo.Tisch
Posts: 14
Joined: Tue Nov 05, 2019 7:59 pm

Re: slow UART write

Postby Ivo.Tisch » Tue Oct 19, 2021 7:59 pm

Apologies folks - ignore the above, I made a very basic mistake.

fyras1
Posts: 1
Joined: Wed May 18, 2022 12:02 am

Re: slow UART write

Postby fyras1 » Wed May 18, 2022 12:04 am

Hi

How did you solve it?

crackwitz
Posts: 10
Joined: Fri Oct 22, 2021 11:15 am

Re: slow UART write

Postby crackwitz » Thu Oct 26, 2023 2:04 pm

Yes, how did you?

Who is online

Users browsing this forum: No registered users and 113 guests