mirror of
https://github.com/espressif/esp-modbus.git
synced 2025-07-29 18:07:17 +02:00
doc: describe on how to override modbus serial comm opts
This commit is contained in:
@ -326,6 +326,14 @@ Example setup for serial port:
|
||||
|
||||
ESP_ERROR_CHECK(mbc_master_setup((void*)&comm_info));
|
||||
|
||||
The communication options supported by this library are described in the section :ref:`modbus_supported_communication_options`.
|
||||
|
||||
However, it is possible to override the serial communication options calling the function :cpp:func:`uart_param_config` right after :cpp:func:`mbc_slave_setup`.
|
||||
|
||||
.. note:: Refer to `UART driver documentation <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#set-communication-parameters>`__ for more information about UART peripheral configuration.
|
||||
|
||||
.. note:: RS485 communication requires call to UART specific APIs to setup communication mode and pins. Refer to the `UART communication section <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#uart-api-running-uart-communication>`__ in documentation.
|
||||
|
||||
Modbus master TCP port requires additional definition of IP address table where number of addresses should be equal to number of unique slave addresses in master Modbus Data Dictionary:
|
||||
|
||||
The order of IP address string corresponds to short slave address in the Data Dictionary.
|
||||
@ -355,8 +363,6 @@ The order of IP address string corresponds to short slave address in the Data Di
|
||||
The slave IP addresses in the table can be assigned automatically using mDNS service as described in the example.
|
||||
Refer to :ref:`example TCP master <example_mb_tcp_master>` for more information.
|
||||
|
||||
.. note:: RS485 communication requires call to UART specific APIs to setup communication mode and pins. Refer to the `UART communication section <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#uart-api-running-uart-communication>`__ in documentation.
|
||||
|
||||
.. _modbus_api_master_start_communication:
|
||||
|
||||
Master Communication
|
||||
|
@ -12,6 +12,39 @@ The Modbus serial communication protocol is de facto standard protocol widely us
|
||||
|
||||
.. note:: This documentation (and included code snippets) requires some familiarity with the Modbus protocol. Refer to the Modbus Organization's with protocol specifications for specifics :ref:`modbus_organization`.
|
||||
|
||||
.. _modbus_supported_communication_options:
|
||||
|
||||
Modbus Supported Communication Options
|
||||
--------------------------------------
|
||||
|
||||
The Modbus library supports the standard communication options as per Modbus specification stated below.
|
||||
|
||||
.. list-table:: Standard Modbus communication options
|
||||
:widths: 10 90
|
||||
:header-rows: 1
|
||||
|
||||
* - Modbus option
|
||||
- Description of the option
|
||||
* - RTU communication
|
||||
- * 1 start bit
|
||||
* 8 data bits, least significant bit sent first
|
||||
* 1 bit for even / odd parity-no bit for no parity
|
||||
* 1 stop bit if parity is used, 2 stop bits if no parity
|
||||
* Cyclical Redundancy Check (CRC)
|
||||
* - ASCII communication
|
||||
- * 1 start bit
|
||||
* 7-8 data bits, least significant bit sent first
|
||||
* 1 bit for even / odd parity-no bit for no parity
|
||||
* 1 stop bit if parity is used, 2 stop bits if no parity
|
||||
* Longitudinal Redundancy Check (LRC)
|
||||
* - TCP communication
|
||||
- * Communications between client (master) - server (slave) over TCP/IP networks
|
||||
* Connection uses the standard port 502
|
||||
* The frames do not require checksum calculation (provided by lower layers)
|
||||
|
||||
Some vendors may use subset of communication options. In this case the detailed information is clarified in the device manual and it is possible to override the standard communication options for support of such devices.
|
||||
Please refer to :ref:`modbus_api_slave_setup_communication_options`, :ref:`modbus_api_master_setup_communication_options` for more information.
|
||||
|
||||
Messaging Model And Data Mapping
|
||||
--------------------------------
|
||||
|
||||
|
@ -152,6 +152,14 @@ Example initialization of Modbus serial communication:
|
||||
|
||||
ESP_ERROR_CHECK(mbc_slave_setup((void*)&comm_info));
|
||||
|
||||
The communication options supported by this library are described in the section :ref:`modbus_supported_communication_options`.
|
||||
|
||||
However, it is possible to override the serial communication options calling the function :cpp:func:`uart_param_config` right after :cpp:func:`mbc_slave_setup`.
|
||||
|
||||
.. note:: Refer to `UART driver documentation <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#set-communication-parameters>`__ for more information about UART peripheral configuration.
|
||||
|
||||
.. note:: RS485 communication requires call to UART specific APIs to setup communication mode and pins. Refer to the `UART communication section <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#uart-api-running-uart-communication>`__ in documentation.
|
||||
|
||||
.. _modbus_api_slave_communication:
|
||||
|
||||
Slave Communication
|
||||
|
Reference in New Issue
Block a user