UART Flow Control

jollytopper
Posts: 30
Joined: Mon Sep 17, 2018 6:39 am

UART Flow Control

Postby jollytopper » Thu May 30, 2019 2:43 am

Hello All,

I have been using UART1 without hardware or software flow control. What are the benefits to using software flow control and if I decide to do so, when should I be calling uart_set_rts() and uart_set_dts()?

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

Re: UART Flow Control

Postby ESP_Sprite » Thu May 30, 2019 3:33 am

Are you sure you need flow control in the first place? It's usually only needed when a device is not fast enough to parse the incoming data as it comes in.

jollytopper
Posts: 30
Joined: Mon Sep 17, 2018 6:39 am

Re: UART Flow Control

Postby jollytopper » Thu May 30, 2019 6:23 am

I have done some research and realize that I do not need it.

User avatar
gunar.kroeger
Posts: 143
Joined: Fri Jul 27, 2018 6:48 pm

Re: UART Flow Control

Postby gunar.kroeger » Fri May 22, 2020 6:37 pm

Please when answering questions remember that other people try to find solutions here.
It is so annoying finding the questions in the forum but no real answer.

I don't understand what the sw flow control does based on documentation. I also tried searching for examples of uart with DMA and always find only evasive answers like "surely you don't need it"

I'm trying to get the maximum out of the uart link between two esp32 in our project, but I'm getting FIFO OVERFLOW. We only have tx and rx lines connected.
"Running was invented in 1612 by Thomas Running when he tried to walk twice at the same time."

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

Re: UART Flow Control

Postby ESP_Sprite » Sat May 23, 2020 12:50 pm

You could also, y'know, ask your own question related to this instead of hoping to glance information from the failures of others?

User avatar
gunar.kroeger
Posts: 143
Joined: Fri Jul 27, 2018 6:48 pm

Re: UART Flow Control

Postby gunar.kroeger » Sat May 23, 2020 4:51 pm

I don't mean to be toxic.
Unfortunately I have several unanswered topics in this forum already, and I know that this is because you are answering them when you can and that this is not your full time job

So I'm only suggesting that if you could please from now on consider giving more complete answeres to questions, point to the right documentation, and if the documentation about this topic is unclear, improve the documentation.

That would surely be a better use of your and our time.

Thanks
"Running was invented in 1612 by Thomas Running when he tried to walk twice at the same time."

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

Re: UART Flow Control

Postby ESP_Sprite » Sun May 24, 2020 7:49 am

Support like this is entirely on a as-needed basis, imo. I can write an entire book about hardware handshaking and then find out the other guy only needs a little bit of it (or none at all as they might have an X/Y problem), but I'd rather just help people solve the problem at hand. If you need to know something, just ask. That also helps me pinpoint exactly what is missing in the documentation instead of a general 'something something hardware handshaking' idea.

Hasan Shadi
Posts: 26
Joined: Tue Mar 31, 2020 7:26 pm

Re: UART Flow Control

Postby Hasan Shadi » Fri May 29, 2020 4:19 am

jollytopper wrote:
Thu May 30, 2019 2:43 am
Hello All,

I have been using UART1 without hardware or software flow control. What are the benefits to using software flow control and if I decide to do so, when should I be calling uart_set_rts() and uart_set_dts()?
First of all, flow control is only used if you want to control the data being passed between the two devices, the flow control pins are CTR and RTS, along with the TX and RX pins, now you have 4 pins for the UART protocol. One for the host, and the other for the device (or the slave should I say). They are used for many reasons, could be for example the device has no free memory, so it uses the flow control pins to tell the other device to hold its data and wait. But, most of the sensors or other electronic parts does support these flow control pins. However, if the buffer becomes full, all the data that you are receiving after the buffer became full will be lost, which is bad. If you are using ESP-IDF to program it, you could set a threshold (meaning if you receive a specific amount of bytes, it will use the flow control pins to tell the other device to stop sending data), this is very useful if you are using the UART protocol to transfer a huge amount of data. This is the function link inside hte ESP-IDF documentation, if you are the Arduino IDE, you could still use that function, just tell me and I will help you to use it: https://docs.espressif.com/projects/esp ... _t7uint8_t. Best regards, Hasan Shadi.

the-mush
Posts: 1
Joined: Thu Sep 17, 2020 9:48 pm

Re: UART Flow Control

Postby the-mush » Thu Sep 17, 2020 9:59 pm

Hasan Shadi wrote:
Fri May 29, 2020 4:19 am
jollytopper wrote:
Thu May 30, 2019 2:43 am
Hello All,

I have been using UART1 without hardware or software flow control. What are the benefits to using software flow control and if I decide to do so, when should I be calling uart_set_rts() and uart_set_dts()?
First of all, flow control is only used if you want to control the data being passed between the two devices, the flow control pins are CTR and RTS, along with the TX and RX pins, now you have 4 pins for the UART protocol. One for the host, and the other for the device (or the slave should I say). They are used for many reasons, could be for example the device has no free memory, so it uses the flow control pins to tell the other device to hold its data and wait. But, most of the sensors or other electronic parts does support these flow control pins. However, if the buffer becomes full, all the data that you are receiving after the buffer became full will be lost, which is bad. If you are using ESP-IDF to program it, you could set a threshold (meaning if you receive a specific amount of bytes, it will use the flow control pins to tell the other device to stop sending data), this is very useful if you are using the UART protocol to transfer a huge amount of data. This is the function link inside hte ESP-IDF documentation, if you are the Arduino IDE, you could still use that function, just tell me and I will help you to use it: https://docs.espressif.com/projects/esp ... _t7uint8_t. Best regards, Hasan Shadi.
Hello Hasan, I've tried using

Code: Select all

uart_set_hw_flow_ctrl()
with the Arduino IDE (that is, using the usual

Code: Select all

Serial.begin()
and such), but without success. Putting that command before the

Code: Select all

Serial.begin()
results in no apparent change; putting it after, and the Serial instance stops working. Do you know if this combination is possible? Or I would have to ditch the whole Arduino way of using the UART ports in order to use CTS functionality?

Thanks in advance for your help!

Who is online

Users browsing this forum: No registered users and 116 guests