From 78c809142a3399a6623f009702bf2589386b7eff Mon Sep 17 00:00:00 2001 From: Alex Lisitsyn Date: Mon, 29 Apr 2024 22:44:08 +0800 Subject: [PATCH] doc: describe on how to override modbus serial comm opts --- docs/en/master_api_overview.rst | 10 +++++-- docs/en/overview_messaging_and_mapping.rst | 33 ++++++++++++++++++++++ docs/en/slave_api_overview.rst | 8 ++++++ 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/docs/en/master_api_overview.rst b/docs/en/master_api_overview.rst index 73ac839..c10a5e6 100644 --- a/docs/en/master_api_overview.rst +++ b/docs/en/master_api_overview.rst @@ -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 `__ 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 `__ 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 ` for more information. -.. note:: RS485 communication requires call to UART specific APIs to setup communication mode and pins. Refer to the `UART communication section `__ in documentation. - .. _modbus_api_master_start_communication: Master Communication diff --git a/docs/en/overview_messaging_and_mapping.rst b/docs/en/overview_messaging_and_mapping.rst index 4a44cc1..faba13c 100644 --- a/docs/en/overview_messaging_and_mapping.rst +++ b/docs/en/overview_messaging_and_mapping.rst @@ -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 -------------------------------- diff --git a/docs/en/slave_api_overview.rst b/docs/en/slave_api_overview.rst index e20c4b1..37a388e 100644 --- a/docs/en/slave_api_overview.rst +++ b/docs/en/slave_api_overview.rst @@ -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 `__ 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 `__ in documentation. + .. _modbus_api_slave_communication: Slave Communication