1menu "Modbus configuration"
2
3    config FMB_COMM_MODE_TCP_EN
4        bool "Enable Modbus stack support for TCP communication mode"
5        default y
6        help
7                Enable Modbus TCP option for stack.
8
9    config FMB_TCP_PORT_DEFAULT
10        int "Modbus TCP port number"
11        range 0 65535
12        default 502
13        depends on FMB_COMM_MODE_TCP_EN
14        help
15                Modbus default port number used by Modbus TCP stack
16
17    config FMB_TCP_PORT_MAX_CONN
18        int "Maximum allowed connections for TCP stack"
19        range 1 6
20        default 5
21        depends on FMB_COMM_MODE_TCP_EN
22        help
23                Maximum allowed connections number for Modbus TCP stack.
24                This is used by Modbus master and slave port layer to establish connections.
25                This parameter may decrease performance of Modbus stack and can cause
26                increasing of processing time (increase only if absolutely necessary).
27
28    config FMB_TCP_CONNECTION_TOUT_SEC
29        int "Modbus TCP connection timeout"
30        range 1 3600
31        default 20
32        depends on FMB_COMM_MODE_TCP_EN
33        help
34                Modbus TCP connection timeout in seconds.
35                Once expired the current connection with the client will be closed
36                and Modbus slave will be waiting for new connection to accept.
37
38    config FMB_COMM_MODE_RTU_EN
39        bool "Enable Modbus stack support for RTU mode"
40        default y
41        help
42                Enable RTU Modbus communication mode option for Modbus serial stack.
43
44    config FMB_COMM_MODE_ASCII_EN
45        bool "Enable Modbus stack support for ASCII mode"
46        default y
47        help
48                Enable ASCII Modbus communication mode option for Modbus serial stack.
49
50    config FMB_MASTER_TIMEOUT_MS_RESPOND
51        int "Slave respond timeout (Milliseconds)"
52        default 150
53        range 50 3000
54        help
55                If master sends a frame which is not broadcast, it has to wait sometime for slave response.
56                if slave is not respond in this time, the master will process timeout error.
57
58    config FMB_MASTER_DELAY_MS_CONVERT
59        int "Slave conversion delay (Milliseconds)"
60        default 200
61        range 50 400
62        help
63                If master sends a broadcast frame, it has to wait conversion time to delay,
64                then master can send next frame.
65
66    config FMB_QUEUE_LENGTH
67        int "Modbus serial task queue length"
68        range 0 200
69        default 20
70        help
71                Modbus serial driver queue length. It is used by event queue task.
72                See the serial driver API for more information.
73
74    config FMB_PORT_TASK_STACK_SIZE
75        int "Modbus port task stack size"
76        range 2048 8192
77        default 4096
78        help
79                Modbus port task stack size for rx/tx event processing.
80                It may be adjusted when debugging is enabled (for example).
81
82    config FMB_SERIAL_BUF_SIZE
83        int "Modbus serial task RX/TX buffer size"
84        range 0 2048
85        default 256
86        help
87                Modbus serial task RX and TX buffer size for UART driver initialization.
88                This buffer is used for modbus frame transfer. The Modbus protocol maximum
89                frame size is 256 bytes. Bigger size can be used for non standard implementations.
90
91    config FMB_SERIAL_ASCII_BITS_PER_SYMB
92        int "Number of data bits per ASCII character"
93        default 8
94        range 7 8
95        depends on FMB_COMM_MODE_ASCII_EN
96        help
97                This option defines the number of data bits per ASCII character.
98
99    config FMB_SERIAL_ASCII_TIMEOUT_RESPOND_MS
100        int "Response timeout for ASCII communication mode (ms)"
101        default 1000
102        range 300 2000
103        depends on FMB_COMM_MODE_ASCII_EN
104        help
105                This option defines response timeout of slave in milliseconds for ASCII communication mode.
106                Thus the timeout will expire and allow the master program to handle the error.
107
108    config FMB_PORT_TASK_PRIO
109        int "Modbus port task priority"
110        range 3 10
111        default 10
112        help
113                Modbus port data processing task priority.
114                The priority of Modbus controller task is equal to (CONFIG_FMB_PORT_TASK_PRIO - 1).
115
116    config FMB_CONTROLLER_SLAVE_ID_SUPPORT
117        bool "Modbus controller slave ID support"
118        default y
119        help
120                Modbus slave ID support enable.
121                When enabled the Modbus <Report Slave ID> command is supported by stack.
122
123    config FMB_CONTROLLER_SLAVE_ID
124        hex "Modbus controller slave ID"
125        range 0 4294967295
126        default 0x00112233
127        depends on FMB_CONTROLLER_SLAVE_ID_SUPPORT
128        help
129                Modbus slave ID value to identify modbus device
130                in the network using <Report Slave ID> command.
131                Most significant byte of ID is used as short device ID and
132                other three bytes used as long ID.
133
134    config FMB_CONTROLLER_NOTIFY_TIMEOUT
135        int "Modbus controller notification timeout (ms)"
136        range 0 200
137        default 20
138        help
139                Modbus controller notification timeout in milliseconds.
140                This timeout is used to send notification about accessed parameters.
141
142    config FMB_CONTROLLER_NOTIFY_QUEUE_SIZE
143        int "Modbus controller notification queue size"
144        range 0 200
145        default 20
146        help
147                Modbus controller notification queue size.
148                The notification queue is used to get information about accessed parameters.
149
150    config FMB_CONTROLLER_STACK_SIZE
151        int "Modbus controller stack size"
152        range 0 8192
153        default 4096
154        help
155                Modbus controller task stack size. The Stack size may be adjusted when
156                debug mode is used which requires more stack size (for example).
157
158    config FMB_EVENT_QUEUE_TIMEOUT
159        int "Modbus stack event queue timeout (ms)"
160        range 0 500
161        default 20
162        help
163                Modbus stack event queue timeout in milliseconds. This may help to optimize
164                Modbus stack event processing time.
165
166    config FMB_TIMER_PORT_ENABLED
167        bool "Modbus slave stack use timer for 3.5T symbol time measurement"
168        default y
169        help
170                If this option is set the Modbus stack uses timer for T3.5 time measurement.
171                Else the internal UART TOUT timeout is used for 3.5T symbol time measurement.
172
173    config FMB_TIMER_GROUP
174        int "Modbus Timer group number"
175        range 0 1
176        default 0
177        help
178                Modbus Timer group number that is used for timeout measurement.
179
180    config FMB_TIMER_INDEX
181        int "Modbus Timer index in the group"
182        range 0 1
183        default 0
184        help
185                Modbus Timer Index in the group that is used for timeout measurement.
186
187    config FMB_TIMER_ISR_IN_IRAM
188        bool "Place timer interrupt handler into IRAM"
189        default n
190        select UART_ISR_IN_IRAM
191        help
192                This option places Modbus timer IRQ handler into IRAM.
193                This allows to avoid delays related to processing of non-IRAM-safe interrupts
194                during a flash write operation (NVS updating a value, or some other
195                flash API which has to perform an read/write operation and disable CPU cache).
196                This option has dependency with the UART_ISR_IN_IRAM option which places UART interrupt
197                handler into IRAM to prevent delays related to processing of UART events.
198
199endmenu
200