Page 1 of 1

UART Flow Control

Posted: Thu May 30, 2019 2:43 am
by jollytopper
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()?

Re: UART Flow Control

Posted: Thu May 30, 2019 3:33 am
by ESP_Sprite
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.

Re: UART Flow Control

Posted: Thu May 30, 2019 6:23 am
by jollytopper
I have done some research and realize that I do not need it.

Re: UART Flow Control

Posted: Fri May 22, 2020 6:37 pm
by gunar.kroeger
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.

Re: UART Flow Control

Posted: Sat May 23, 2020 12:50 pm
by ESP_Sprite
You could also, y'know, ask your own question related to this instead of hoping to glance information from the failures of others?

Re: UART Flow Control

Posted: Sat May 23, 2020 4:51 pm
by gunar.kroeger
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

Re: UART Flow Control

Posted: Sun May 24, 2020 7:49 am
by ESP_Sprite
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.

Re: UART Flow Control

Posted: Fri May 29, 2020 4:19 am
by Hasan Shadi
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.

Re: UART Flow Control

Posted: Thu Sep 17, 2020 9:59 pm
by the-mush
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!