How to wait UART untill timeout or data readed delimiter

JorgeSayMe
Posts: 8
Joined: Mon Feb 17, 2020 4:40 pm

How to wait UART untill timeout or data readed delimiter

Postby JorgeSayMe » Tue Mar 31, 2020 8:30 am

Good morning.

I am developing an ESP32 code where I use UART communications.

I want to know how can I wait until I have a delimiter on RX data or I wait X time, at the same time,

int uart_read_bytes(uart_port_t uart_num, char* buf, uint32_t length, TickType_t ticks_to_wait) always wait the number of ticks specified and I want to don´t wait more if I have the response.

Does anybody know how to do that?

mikemoy
Posts: 626
Joined: Fri Jan 12, 2018 9:10 pm

Re: How to wait UART untill timeout or data readed delimiter

Postby mikemoy » Tue Mar 31, 2020 2:19 pm

There is an example in the examples folder for doing just that.

JorgeSayMe
Posts: 8
Joined: Mon Feb 17, 2020 4:40 pm

Re: How to wait UART untill timeout or data readed delimiter

Postby JorgeSayMe » Wed Apr 01, 2020 6:33 am

mikemoy wrote:
Tue Mar 31, 2020 2:19 pm
There is an example in the examples folder for doing just that.
Can you give me the link to this example?

Thanks in advance

akarg96
Posts: 5
Joined: Wed Nov 27, 2019 2:49 am

Re: How to wait UART untill timeout or data readed delimiter

Postby akarg96 » Wed Apr 01, 2020 11:32 pm

I hope you find this example helpful.
https://github.com/espressif/esp-idf/tr ... _rxtxtasks

Who is online

Users browsing this forum: No registered users and 70 guests