User Manual Modbus Ethernet Gateways (G01 - G03 & G14 - G16) Configuration by the Web Page Modbus Ethernet Gateways (G01 - G03 & G14 - G16) This page presents capabilities of the Ethernet Converters configuration. First of all, make sure that converter is connected to power supply and to the LAN using a patch cord. If the device has no static IP set up, it will be necessary to obtain its IP address in the local network. User interface is mostly similar for all gateways but some subpages might be different for several models depending on amount of interfaces. In order to avoid issues, click on a “Help” button in the top right corner on every page. Login To access the web page open the browser, type device’s IP address of the converter (default is 192.168.100.100 ). Then log in using user’s personal credentials. If it is a first configuration or the converter had a factory reset, use default login details (login: admin , password: admin123 ). The configuration is available only if devices are connected to the same Local Area Network as the computer used for it. Status page After a successful login, there should be an insight to a list of available connections. If there is more than one connection, it is possible to sort them by ID, timestamp or status. Changing username or password After clicking “Edit User” under the user icon, it is possible to change the username or the password. If login details were forgotten, it would be necessary to do a factory reset via a USB/UART converter and a serial console. Ports configuration Item Description Internal Modbus Address Internal Modbus Address is qualified by the Gateway/Router as a request for internal resources. The Internal Modbus Address has a higher priority than the Gateway Slave Address. Idle Time [s] Determine a time thread waits for the TCP connection. If time expired, the connection and thread are closed. Used only in Gateway Mode. UART Mode Gateway Define the port's role in the system. In the Gateway Mode the port is used to communicate with Modbus Slave. Router Define the port's role in the system. In the Router Mode the port is used to communicate with Modbus Master. Note the Routing Configuration section below if the Router Mode is chosen. Disabled Disable the port. UART Protocol Determine a protocol used for a communication. Gateway Slaves Addresses of Modbus Slave Devices connected to Gateway UART ports. Multiple addresses can be written in one field, e.g. 9;11;14-17;80 . This field is available only in the Gateway Mode. Use * to select all not assigned addresses. Slaves Response Timeout [ms] Specify how long the device will wait for response from Modbus Slave. Baud Rate Determine the port's transmission speed over the data channel. Data Bits Determine the number of data bits in the port's message frame. Parity Enable/disable the parity check in the port's message frame. Stop Bits Determine the number of stop bits in the port's message frame. Termination Enable/disable termination on RS line. Routing Slaves Addresses of Modbus Slaves connected to Modbus Router. Multiple addresses can be written in one field, e.g. 9;11;14-17;80. Use * to select all not assigned addresses. Slaves Response Timeout [ms] Specify how long the device will wait for response from Modbus Slave. IP/Hostname Determine IP address or Hostname of Modbus Slave. TCP Port Determine TCP port of Modbus Slave. Make sure to save all the changes with “Save and Apply” button located on the bottom of the page. In the UDP mode, port number 15051 is reserved for UDP broadcast service. Network settings In this section, network settings can be changed according to target LAN parameters. Item Description Hostname Label that is assigned to the device. Configuration Method Enable/disable the DHCP server. If the DHCP server is disabled, the IP address of the device has to be set manually. IP Address IP address of the device. Netmask Netmask associated with the IP address. Gateway Gateway address currently used by the device. DNS Address Domain Name System used by the device. MAC Settings Allow setting the default MAC address or typing it manually. MAC Address Allow changing the physical address of the device. HTTP Port Determine the port of the control panel. Telnet Port Allow connection with the device via Telnet. Modbus TCP Listening Port Used as an entry point for new Modbus TCP connections. It is possible to obtain dynamic IP address. Just switch configuration method from static IP to DHCP (automatic). This process may cause some issues with identifying converters in LAN unless there is an access to the device which is responsible for allocating IP addresses. Keep in mind that in case of changed IP address user needs to type new IP in the address bar and log in again. Make sure to save all the changes with “Save and Apply” button located on the bottom of the page. Device page On the device page there are tools used to a firmware update, a factory reset and a device reboot. There are also some information about the device. Item Description Firmware Update Update firmware. Factory Reset Restore default ports settings and default network configuration. Reboot Reboot the device. About Basic information about the device. Firmware update The device firmware update must not be interrupted. Update the device only if experiencing issues, being instructed to do so by our support or requiring the latest features/bugfixes. Failure during the update may 'brick' the device and make it unusable. Use the modbus-gateway-mcu-esp32.fir file for a firmware update. Factory reset To restore default settings, press the red button. After that, user will be asked to type “RESET”. Then it will take a few seconds to reload the web page and restart the device.  After reset use default login details (login: admin , password:  admin123; default IP: 192.168.100.100 ). Configuration by the Telnet Console‎ ‎ Modbus Ethernet Gateways (G01 - G03 & G14 - G16) The device can be also configured via the Telnet Console. Firstly, make sure that converter is connected to the power supply and to the LAN using a patch cord. Knowledge of the device’s IP address (default is 192.168.100.100 ) and Telnet port number (default is 23 ) is necessary to establish a connection. Use command below in a terminal window to connect to the device: telnet If the connection is successful there will be login prompt visible. Login using user's personal credentials or the default login details (login: admin , password: admin123 ). If login is successful, it will be possible to start typing configuration commands. The configuration is available only if devices are connected to the same Local Area Network as the computer used for it. List of all commands Command Description help Print the help. conn Print active TCP connections. net_stat Print lwIP statistics. eth_mac Print or change MAC address. ipconfig Print or change the network configuration. http_port Print or change default http port. telnet_port Print or change default telnet port. modbus_tcp_port Print or change modbus port. ping Check internet connection with the desired host. restart Restart the system. user Print or change user configuration. sys_heap_usage Print current heap usage. modbus Print or changes modbus settings. modbus_ports Print or changes modbus ports settings. modbus_routing Print or change modbus routing settings. exit Exit console. Modbus ports configuration commands modbus modbus help Print command help. modbus int_addr VALUE Set internal Modbus address. Example: modbus int_addr 5 modbus idlet VALUE Show or set the idle TIME (in seconds) of the TCP connection after which the TCP connection is terminated by the converter and the TCP socket is released. Example: modbus idlet 720 If a subcommand that normally sets a value is not given an argument, it will print the current value. Example: modbus idlet Set idle time is 5000 modbus_ports modbus_ports help Print command help, does not require com_number. modbus_ports PORT_NUMBER add_slaves [SLAVE_ADDR ;/- SLAVE_ADDR, *] Set all addresses of slaves connected to com_port. A star in value means fill rest free slaves. It means all slaves that are not set to other ports will be set to this one. Example: modbus_ports 1 addslaves 124 Example: modbus_ports 1 addslaves 12-124 Example: modbus_ports 1 addslaves 12;14;18 Example: modbus_ports 1 addslaves 12;14-17;150-200 Example: modbus_ports 1 addslaves 12;14-17;150-200, * modbus_ports PORT_NUMBER show_slaves Show addresses of slaves connected to com_port. Example: modbus_ports 1 showslaves modbus_ports PORT_NUMBER mode [ascii/rtu] Set Modbus port mode to ASCII or RTU. Example: modbus_ports 2 mode ascii modbus_ports PORT_NUMBER baud [RATE] Set the baud rate to RATE. For a list of acceptable baud rates, please refer to the manual. Example: modbus_ports 1 baud 9600 modbus_ports PORT_NUMBER bits [CPS] Set bit count to C, parity to P, and stop bits to S. Valid values are: C: 7, 8 or 9 P: N, E or O (N- none, E- even, O- odd) S: 1 or 2 Example: modbus_ports 1 bits 8N1 Example: modbus_ports 2 bits 7O1 modbus_ports PORT_NUMBER state [GATEWAY/ROUTER/DISABLE] Enable or disable uart functionality.  Example: modbus_ports 1 state GATEWAY Example: modbus_ports 2 state DISABLE modbus_ports PORT_NUMBER termination [on/off] Enable or disable termination on RS485 port.  Example: modbus_ports 1 termination on modbus_ports PORT_NUMBER slave_response_timeout TIMEOUT Set response timeout (serial slave) in ms. When this timeout expires, delayed frames are dropped. Example: modbus_ports 1 slave_response_timeout 2000 If a subcommand that normally sets a value is not given an argument, it will print the current value. Example: modbus_ports 2 baud Set baud rate is 115200 PORT_NUMBER is a number of ports in modbus gateway and it is counted from 0. modbus_routing modbus_routing help Print routing's help. modbus_routing show Display all active routing table in system. [LP]: [SLAVES NUMBERS] [IP/HOSTNAME] [PORT] [TIMEOUT] modbus_routing add SLAVE_ADDR HOSTNAME PORT TIMEOUT SLAVE_ADDR with HOSTNAME PORT is used by uarts working in Modbus router mode. TIMEOUT (in ms) is used to close the connection if a slave is not responding. The maximum records is 8. One record for one address/ip. Example: modbus_routing add 18 192.168.0.10 502 2000 Example: modbus_routing add 18;25 192.168.0.10 502 2000 Example: modbus_routing add 18-25 192.168.0.10 502 2000 Example: modbus_routing add 18-25;* 192.168.0.10 502 2000 Example: modbus_routing add 18-25 modbus.local 502 2000 modbus_routing remove [HOSTNAME_NUMBER/all] Remove Modbus Routing Table record. HOSTNAME_NUMBER is line number from /show/ command. Example: modbus_routing remove 2 Example: modbus_routing remove all Network settings The following commands might be helpful to change network settings according to target LAN parameters,  ipconfig ipconfig addr ADDRESS Set IP address to ADDRESS. Example: ipconfig addr 192.168.0.10 ipconfig mask NETMASK Set subnet mask to NETMASK (in dot-decimal format). Example: ipconfig mask 255.255.255.0 ipconfig mask BIT_COUNT Set subnet mask to BIT_COUNT bits. Example: ipconfig mask 24 ipconfig gateway GATEWAY_IP Set network gateway to GATEWAY_IP. Example: ipconfig gateway 192.168.0.1 ipconfig dhcp [enable/disable] Enable or disable DHCP client. Example: ipconfig dhcp enable ipconfig dns1 ADDRESS Set primary DNS to ADDRESS, disable getting DNS from DHCP if enabled. Example: ipconfig dns1 192.168.100.1 ipconfig dns2 ADDRESS Set secondary DNS to ADDRESS, disable getting DNS from DHCP if enabled. Example: ipconfig dns2 1.1.1.1 eth_mac eth_mac help Print the help message. eth_mac default Set device’s MAC address to factory-default one. eth_mac set MAC_ADDR Set device’s MAC address to MAC_ADDR. Accepts both dash and colon-separated formats. Example: eth_mac set 01-02-03-04-05-06 Example: eth_mac set 01:02:03:04:05:06 http_port http_port help Print the help message. http_port PORT_NUMBER Set http port to PORT_NUMBER. A PORT_NUMBER value must be in range: 1-65535. Example: http_port 80 http_port status Print current http port. Example: http_port status A current http port is 80 telnet_port telnet_port help Print the help message. telnet_port PORT_NUMBER Set Telnet port to PORT_NUMBER. A PORT_NUMBER value must be in range: 1-65535. Example: telnet_port 23 telnet_port status Print current Telnet port. Example: telnet_port status A current telnet port is 23 modbus_tcp_port modbus_tcp_port help Print the help message. modbus_tcp_port PORT_NUMBER Set http port to PORT_NUMBER. A PORT_NUMBER value must be in range: 1-65535. Example: modbus_tcp_port 502 modbus_tcp_port status Print current Modbus port. Example: modbus_tcp_port status A current modbus port is 502 Changing username or password To change username or password, use user command. Available commands: user help Print the help message. user mod_name USER_NAME NEW_NAME Change the user name to NEW_NAME. It fails if the name is used by another user. Example: user mod_name admin NEW_NAME user passwd USER_NAME Change USER_NAME's password. Example: user passwd admin ****** <- here is entered password, but '*' appears instead Note: Everyone can change the password for themselves. Additional notes After some time of inactivity, session will be disconnected automatically. In order to avoid issues like connecting to host, type “help” to get more information. To get more details about every particular command, append “help” after each commands (example: "ipconfig help"). Factory reset is not available from the Telnet Console level. Configuration by the Serial Console‎ Modbus Ethernet Gateways (G01 - G03 & G14 - G16) Another way to configure the device is via a serial console. In case of the G01 - G03 Modbus gateways an additional USB/UART converter is needed. Procedure to enter serial console mode on G01 - G03 Turn off the power of the device. Connect Ethernet converter to the dedicated USB/UART converter via the microUSB port. Connect the USB/UART converter to the PC. Open the serial console (default baud rate is 115200 bps). Press and hold the S1 button. Turn on the power. Wait until the ST indicator ( orange  LED) lights up (it should light up after red light - service mode). Release the S1 button. Login using user’s personal credentials or default login details. If the process is successful, configuration command can be typed into the terminal. Procedure to enter serial console mode on G14 - G16 Install STM32 Virtual COM Port Driver. Turn off the power of the device. Connect Ethernet converter directly to the PC (the dedicated USB/UART converter is not obligatory). Open the serial console (default baud rate is 115200 bps). Press and hold the S1 button. Turn on the power. Wait until the ST indicator ( yellow  LED) lights up. Release the S1 button. Login using user’s personal credentials or default login details. If the process is successful, configuration command can be typed into the terminal. List of all commands Command Description help Print the help. conn Print active TCP connections. net_stat Print lwIP statistics. eth_mac Print or change MAC address. ipconfig Print or change the network configuration. http_port Print or change default http port. telnet_port Print or change default telnet port. modbus_tcp_port Print or change modbus port. ping Check internet connection with the desired host. restart Restart the system. user Print or change user configuration. sys_heap_usage Print current heap usage. modbus Print or changes modbus settings. modbus_ports Print or changes modbus ports settings. modbus_routing Print or change modbus routing settings. exit Exit console. Modbus ports configuration commands modbus modbus help Print command help. modbus int_addr VALUE Set internal Modbus address. Example: modbus int_addr 5 modbus idlet VALUE Show or set the idle TIME (in seconds) of the TCP connection after which the TCP connection is terminated by the converter and the TCP socket is released. Example: modbus idlet 720 If a subcommand that normally sets a value is not given an argument, it will print the current value. Example: modbus idlet Set idle time is 5000 modbus_ports modbus_ports help Print command help, does not require com_number. modbus_ports PORT_NUMBER add_slaves [SLAVE_ADDR ;/- SLAVE_ADDR, *] Set all addresses of slaves connected to com_port. A star in value means fill rest free slaves. It means all slaves that are not set to other ports will be set to this one. Example: modbus_ports 1 addslaves 124 Example: modbus_ports 1 addslaves 12-124 Example: modbus_ports 1 addslaves 12;14;18 Example: modbus_ports 1 addslaves 12;14-17;150-200 Example: modbus_ports 1 addslaves 12;14-17;150-200, * modbus_ports PORT_NUMBER show_slaves Show addresses of slaves connected to com_port. Example: modbus_ports 1 showslaves modbus_ports PORT_NUMBER mode [ascii/rtu] Set Modbus port mode to ASCII or RTU. Example: modbus_ports 2 mode ascii modbus_ports PORT_NUMBER baud [RATE] Set the baud rate to RATE. For a list of acceptable baud rates, please refer to the manual. Example: modbus_ports 1 baud 9600 modbus_ports PORT_NUMBER bits [CPS] Set bit count to C, parity to P, and stop bits to S. Valid values are: C: 7, 8 or 9 P: N, E or O (N- none, E- even, O- odd) S: 1 or 2 Example: modbus_ports 1 bits 8N1 Example: modbus_ports 2 bits 7O1 modbus_ports PORT_NUMBER state [GATEWAY/ROUTER/DISABLE] Enable or disable uart functionality.  Example: modbus_ports 1 state GATEWAY Example: modbus_ports 2 state DISABLE modbus_ports PORT_NUMBER termination [on/off] Enable or disable termination on RS485 port.  Example: modbus_ports 1 termination on modbus_ports PORT_NUMBER slave_response_timeout TIMEOUT Set response timeout (serial slave) in ms. When this timeout expires, delayed frames are dropped. Example: modbus_ports 1 slave_response_timeout 2000 If a subcommand that normally sets a value is not given an argument, it will print the current value. Example: modbus_ports 2 baud Set baud rate is 115200 PORT_NUMBER is a number of ports in modbus gateway and it is counted from 0. modbus_routing modbus_routing help Print routing's help. modbus_routing show Display all active routing table in system. [LP]: [SLAVES NUMBERS] [IP/HOSTNAME] [PORT] [TIMEOUT] modbus_routing add SLAVE_ADDR HOSTNAME PORT TIMEOUT SLAVE_ADDR with HOSTNAME PORT is used by uarts working in Modbus router mode. TIMEOUT (in ms) is used to close the connection if a slave is not responding. The maximum records is 8. One record for one address/ip. Example: modbus_routing add 18 192.168.0.10 502 2000 Example: modbus_routing add 18;25 192.168.0.10 502 2000 Example: modbus_routing add 18-25 192.168.0.10 502 2000 Example: modbus_routing add 18-25;* 192.168.0.10 502 2000 Example: modbus_routing add 18-25 modbus.local 502 2000 modbus_routing remove [HOSTNAME_NUMBER/all] Remove Modbus Routing Table record. HOSTNAME_NUMBER is line number from /show/ command. Example: modbus_routing remove 2 Example: modbus_routing remove all Network settings The following commands might be helpful to change network settings according to target LAN parameters,  ipconfig ipconfig addr ADDRESS Set IP address to ADDRESS. Example: ipconfig addr 192.168.0.10 ipconfig mask NETMASK Set subnet mask to NETMASK (in dot-decimal format). Example: ipconfig mask 255.255.255.0 ipconfig mask BIT_COUNT Set subnet mask to BIT_COUNT bits. Example: ipconfig mask 24 ipconfig gateway GATEWAY_IP Set network gateway to GATEWAY_IP. Example: ipconfig gateway 192.168.0.1 ipconfig dhcp [enable/disable] Enable or disable DHCP client. Example: ipconfig dhcp enable ipconfig dns1 ADDRESS Set primary DNS to ADDRESS, disable getting DNS from DHCP if enabled. Example: ipconfig dns1 192.168.100.1 ipconfig dns2 ADDRESS Set secondary DNS to ADDRESS, disable getting DNS from DHCP if enabled. Example: ipconfig dns2 1.1.1.1 eth_mac eth_mac help Print the help message. eth_mac default Set device’s MAC address to factory-default one. eth_mac set MAC_ADDR Set device’s MAC address to MAC_ADDR. Accepts both dash and colon-separated formats. Example: eth_mac set 01-02-03-04-05-06 Example: eth_mac set 01:02:03:04:05:06 http_port http_port help Print the help message. http_port PORT_NUMBER Set http port to PORT_NUMBER. A PORT_NUMBER value must be in range: 1-65535. Example: http_port 80 http_port status Print current http port. Example: http_port status A current http port is 80 telnet_port telnet_port help Print the help message. telnet_port PORT_NUMBER Set Telnet port to PORT_NUMBER. A PORT_NUMBER value must be in range: 1-65535. Example: telnet_port 23 telnet_port status Print current Telnet port. Example: telnet_port status A current telnet port is 23 modbus_tcp_port modbus_tcp_port help Print the help message. modbus_tcp_port PORT_NUMBER Set http port to PORT_NUMBER. A PORT_NUMBER value must be in range: 1-65535. Example: modbus_tcp_port 502 modbus_tcp_port status Print current Modbus port. Example: modbus_tcp_port status A current modbus port is 502 Changing username or password To change username or password, use user command. Available commands: user help Print the help message. user mod_name USER_NAME NEW_NAME Change the user name to NEW_NAME. It fails if the name is used by another user. Example: user mod_name admin NEW_NAME user passwd USER_NAME Change USER_NAME's password. Example: user passwd admin ****** <- here is entered password, but '*' appears instead Note: Everyone can change the password for themselves. Service mode Procedure to enter service mode for G01 - G03 gateways Turn off the power of the device. Connect Ethernet converter to the dedicated USB/UART converter via the microUSB port. Connect the USB/UART converter to the PC. Open the serial console (default baud rate is 115200 bps). Press and hold the S1 button. Turn on the power. Wait until the ST indicator ( red  LED) lights up. Release the S1 button. If the process is successful, service commands can be typed into the terminal. Procedure to enter service mode for G14 - G16 gateways Install STM32 Virtual COM Port Driver (if it was not done before). Turn off the power of the device. Connect Ethernet converter directly to the PC (the dedicated USB/UART converter is not obligatory). Open the serial console (default baud rate is 115200 bps). Press and hold the S1 button. Turn on the power. Wait until the ST indicator ( red  LED) lights up. Release the S1 button. If the process is successful, service commands can be typed into the terminal. List of commands in the service mode Command Description help Print the help. credits Print current credits value for this device. dev_ident Print the device identification value. restart Restart the system. serial_num Print the serial number of this device. version Display the bootloader version. xmodem Download image to the internal flash using xmodem. defaults Reset application variables to defaults. ipconfig Print or change the network configuration. In the service mode, the “ipconfig” command can only show a last static IP address. Factory reset To restore default settings, type “defaults”. After that, user will be asked for type “default network” to reset the network settings as well. Then user will be informed if the process is successful. Default login details: - login: admin - password: admin123 - IP: 192.168.100.100 Additional notes In order to avoid issues like connecting to host, type “help” to get more information. To get more details about every particular command, append “help” after each commands (example: "ipconfig help").