Kconfig 8.9 KB

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