Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UART hardware flow control #1126

Open
awasaw opened this issue Feb 8, 2021 · 6 comments
Open

UART hardware flow control #1126

awasaw opened this issue Feb 8, 2021 · 6 comments

Comments

@awasaw
Copy link

awasaw commented Feb 8, 2021

Describe the problem you have/What new integration you would like
Some devices require flow control when communicating via UART. In this case, it will be useful to add the ability to configure flow control in the UART component. ESP8266 has a hardware implementation of flow control(RTS, CTS, DTR, DSR), which is enabled through the UARTCONF register.
This improvement will make it possible to use MAX485 for communication under the RS485 protocol.

Please describe your use case for this integration and alternatives you've tried:
I am integrating the electricity meter through the TTL2RS485 converter based on the MAX485 chip, and I need to control the direction of information transfer. At first I wanted to implement a software switch, but delving deeper into the topic, I realized that it was enough to use the hardware capabilities of the board.

Additional context
ESP8266_NONOS_SDK/.../uart.h

typedef enum {
    USART_HardwareFlowControl_None    = 0x0,
    USART_HardwareFlowControl_RTS     = 0x1,
    USART_HardwareFlowControl_CTS     = 0x2,
    USART_HardwareFlowControl_CTS_RTS = 0x3
} UART_HwFlowCtrl;

future-request: RS485 serial support / tx enable pin control that can be resolved by this.

@awasaw
Copy link
Author

awasaw commented Feb 8, 2021

Ok for the request, but you can use MAX13487 instead (automatic flow control) or an adapter similar to (all with automatic flow control feature) :

In the case of the MAX485, it is possible to change the converter, but the next project will be a control system for the Chinese diesel air-heater "Hcalory" (clone Eberspächer), which uses UART on one wire(not 1-Wire). And I have a choice to use together NPN and PNP transistors to switch rx/tx as it was done in the original board, automatically switching them with RTS signal, or write a software implementation of UART over one wire.
In any case, the ability to configure hardware flow control will be useful in the future.

@michelebergo
Copy link

Describe the problem you have/What new integration you would like
Some devices require flow control when communicating via UART. In this case, it will be useful to add the ability to configure flow control in the UART component. ESP8266 has a hardware implementation of flow control(RTS, CTS, DTR, DSR), which is enabled through the UARTCONF register.
This improvement will make it possible to use MAX485 for communication under the RS485 protocol.

Please describe your use case for this integration and alternatives you've tried:
I am integrating the electricity meter through the TTL2RS485 converter based on the MAX485 chip, and I need to control the direction of information transfer. At first I wanted to implement a software switch, but delving deeper into the topic, I realized that it was enough to use the hardware capabilities of the board.

Additional context
ESP8266_NONOS_SDK/.../uart.h

typedef enum {
    USART_HardwareFlowControl_None    = 0x0,
    USART_HardwareFlowControl_RTS     = 0x1,
    USART_HardwareFlowControl_CTS     = 0x2,
    USART_HardwareFlowControl_CTS_RTS = 0x3
} UART_HwFlowCtrl;

future-request: RS485 serial support / tx enable pin control that can be resolved by this.

Hi awasaw, can you helping me on implementing the hardware flow control as you did please?

@shawly
Copy link

shawly commented Jan 11, 2022

I looked around and found that the ESP-IDF framework supports it so I extended the uart component to enable hardware flow control for ESP32 boards. It's not yet fully complete since I still need to improve validation a little (that's why I didn't create a PR) but it's fully usable, I tested it successfully.

https://github.com/shawly/esphome-components

Technically the framework would also support DSR and DTS but I didn't implement it since I can't test it.

@ssieb
Copy link
Member

ssieb commented Oct 24, 2022

I don't see why a possible external component is a reason to close a valid feature request.

@ssieb ssieb reopened this Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants