This commit is contained in:
brambo123 2024-05-07 10:49:15 +00:00 committed by GitHub
commit e4e3a9cb2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 0 deletions

View File

@ -62,6 +62,29 @@ Configuration variables:
- **disable_crc** (*Optional*, boolean): Ignores a bad CRC if set to ``true``. Defaults to ``false``
Hardware TX buffer and flow control
-----------------------------------
On ESP32 it is possible to use hardware TX buffer to improve performance.
When enabled, use the hardware controlled ``flow_control_pin`` of the UART component instead of the software controlled version of the modbus component.
.. code-block:: yaml
# Example configuration entry for ESP32 with flow control
uart:
flow_control_pin: GPIO10
tx_buffer_size: 128
...
modbus:
# Don't use `flow_control_pin` here
.. note::
Without hardware TX buffer, the timer for ``send_wait_time`` starts after a request has been completely transmitted.
With TX buffer enabled it starts at the beginning of the request.
As a result, it may be necessary to adjust this setting, especially at low baud rates.
See Also
--------

View File

@ -53,6 +53,8 @@ Configuration variables:
- **baud_rate** (**Required**, int): The baud rate of the UART bus.
- **tx_pin** (*Optional*, :ref:`config-pin`): The pin to send data to from the ESP's perspective. Use the full pin schema and set ``inverted: true`` to invert logic levels.
- **rx_pin** (*Optional*, :ref:`config-pin`): The pin to receive data on from the ESP's perspective. Use the full pin schema and set ``inverted: true`` to invert logic levels.
- **flow_control_pin** (*Optional*, :ref:`config-pin`): The pin used to for RS485 flow control. When using this setting, half-duplex mode is enabled.
- **tx_buffer_size** (*Optional*, int): The size of the buffer used for transmitting UART messages. Enabling this will change code behaviour, only use this if your integration indicates it is safe to do so. Defaults to ``0``.
- **rx_buffer_size** (*Optional*, int): The size of the buffer used for receiving UART messages. Increase if you use an integration that needs to read big payloads from UART. Defaults to ``256``.
- **data_bits** (*Optional*, int): The number of data bits used on the UART bus. Options: 5 to 8. Defaults to 8.
- **parity** (*Optional*): The parity used on the UART bus. Options: ``NONE``, ``EVEN``, ``ODD``. Defaults to ``NONE``.
@ -80,6 +82,10 @@ The ESP8266 has two UARTs; the second of which is TX-only. Only a limited set of
use either ``tx_pin: GPIO1`` and ``rx_pin: GPIO3``, or ``tx_pin: GPIO15`` and ``rx_pin: GPIO13``. ``UART1`` must
use ``tx_pin: GPIO2``. Any other combination of pins will result in use of a software UART.
.. note::
The use of ``tx_buffer_size`` and ``flow_control_pin`` requires hardware support. Currently only ESP32 is supported.
.. note::
The Software UART is only available on the ESP8266. It is not available on ESP32 and variants.