GRIDCONNECT Modbus Gateway
GRIDCONNECT Modbus Gateway
User Guide
The information in this guide may change without notice. The manufacturer assumes no
responsibility for any errors that may appear in this guide.
2. Hardware
The NET232 and NET485 Adapters, designed by Grid Connect, use the XPort Device Server. The NET232
is a complete RS232 Serial to Ethernet interface. The Modbus version of this product is the NET232-MB.
The NET485 is an RS422/485 Serial to Ethernet interface. The Modbus version of this product is the
NET485-MB.
GND
RTS IN VIN
NO SIGNALS TXD OUT
ON THESE PINS
RXD IN
DO NOT USE THESE
HOLES FOR MOUNTING.
THEY HAVE POWER ON
THEM.
U2
8
TRANSMIT 3 Vcc
ENABLE DE
4
DI
D
C
P
6
U 1 TXDA DATA
RO
R 7 LINE S
3.3V TXDB
2
RE
G ND
5
The NET485 provides the Transmit enable signal for RS485 two-wire applications. When configured for
RS485 two-wire applications, the NET485 automatically asserts the transmit enable when it is ready to
transmit data from its serial port. Once the data has been transmitted, the NET485 automatically de-asserts
the enable signal to allow other nodes to transmit their data.
The Transmit enable pin is called a Configurable Pin, meaning it can be selected to do several functions.
One of those options is the transmit enable, which is labeled “RS485 TX Enable”. The Quick Start Guide
explains how to configure the NET485 for proper RS485 operation.
WARNING: The NET485 comes from the factory already configured for RS485 operation.
The NET485 uses Configurable Pin 1 (CP1) for the transmit enable. You must enable CP1 for
RS485_TXEN during the configuration process. (See the Quick Start Guide for details)
The NET485 uses CP1 in the Active High condition. You must set CP1 to Active High during the
configuration process. (See the Quick Start Guide for details)
2 8
3 Vcc
Vcc RS422
DE
Half-Duplex
4 4
Mode
TX
DI
D
6
1 TXDA (Pin 7)
RO
R 7
CPU 3.3V TXDB (Pin 6)
2
RE
GND
5
R13
6
CP0
10K 3.3V
8
3 Vcc
DE
3.3V D
4
DI
6
5 1 RXDA (Pin 5)
RX
RO
R 7
RXDB (Pin 4)
3 2 2
RE
GND J2 1 GND
1 5 SGND (Pin 3)
TXDA
TXDB
RXDA
RXDB
SGND
2 8
3 Vcc
Vcc
DE
4 4 RS485
TX
DI
D RS485 Mode
Mode
6
1 TXDA (Pin 7)
CPU R 7
RO TXDB (Pin 6)
3.3V
2
RE
GND
5
R13
6
CP0
10K 3.3V
8
3 Vcc
DE
3.3V D
4
DI
6
5 1 RXDA (Pin 5)
RX
RO
R 7
3 2 2 RXDB (Pin 4)
RE
GND J2 1 GND
1 5 SGND (Pin 3)
TXDA
TXDB
SGND
RS422 Networks
A typical RS422 application uses a four-wire interface (two twisted pairs) and a shield. RS422 networks are
often used in a half-duplex mode, where a single master in a system sends a command to a slave device and
the slave responds with data. Typically one device (node) is addressed by the host computer and a response
is received from that device. Systems of this type (4-wire, half-duplex) are often constructed to avoid "data
collision" (bus contention) problems on a network. Figure 3 shows a typical RS422 four wire interface.
CP1 CP1
DE 4000 ft . DE
TX
DI D DI D TX
DE DE
D D
DI DI
RXDA (Pin 5) RXDA
Rt
RX
RO
R RXDB (Pin 4) RXDB
RO
R RX
SGND
SGND (Pin 3)
CP1 CP1
Rg Rg
TX
DI
D DI
D TX
SGND (Pin 3) SGND
RO
R RO
R
TXDB (Pin 6)
DE DE
D D
DI DI
RXDA (Pin 5)
RX
RO
R RO
R RX
CP1 CP1
CP1
DE
DI
D TX
SGND
TXDA
RO
R
DE
D
DI
RO
R RX
RXDB
CP1
Power Terminals
The table below lists the RS422/485 signals for the NET485. The RS422/485 and power interface is a 7-pin
removable Phoenix connector, with two of the pins used for power.
Table 2 - RS422/485 Signals
NET485 Signal 7-Pin Phoenix
TXDA (+) 7
TXDB (-) 6
RXDA (+) 5
RXDB (-) 4
SGND 3
GND 2
8-24VDC 1
RX TERM
TX TERM
TXDA
TXDB
RXDA
RXDB
SGN D
GND
8-24VDC
Termination Jumpers
Figure 6 - Phoenix Connector
The NET485 uses protective clamping structures on its inputs and outputs that clamp the voltage to a safe
level and dissipate the energy present in ESD (electrostatic) and EFT (electrical fast transients) discharges.
This protection structure achieves ESD protection up to 8 kV according to IEC1000-4-2, and EFT protection
up to 2 kV on all input/output (I/O) lines.
The NET485 has jumper terminals for adding termination resistors to the RX and TX lines. Add these
jumpers ONLY if you have long transmission lines and termination resistors are needed.
WARNING: Jumpers must be installed vertically.
Note: Do NOT use RX Term and TX Term jumpers on short transmission lines. Remove these jumpers to remove the
120 Ohm resistors from the transmit and receive lines.
Note: Only use one jumper when wired for RS485 two-wire mode (Figure 2 above).
J2
Figure 7 - J2 Setting for Half Duplex
To change the jumper J2 to Full Duplex, open the case and locate the jumper J2. Move the jumper to pins 1
and 2 as shown in the drawing.
J2
Figure 8 - J2 Setting for Full Duplex
Mounting Holes
The following drawing shows the mounting holes for the Wi232 OEM board. If the power jack is removed,
one of the holes can be used for mounting the board.
125mil (3.175mm)
BOTTOM LAYER
Board Dimensions
The dimensions for the mounting holes are shown in the following drawing.
3.400
2.075
0.450 A
2.000 A
1.925
1.150
0.125 0.150
A
B
0.275
2.925
Activity Link
Modbus is a registered trademark of Schneider Automation.
A B C Device Server
Modbus
Modbus/RTU or
D Modbus/ASCII G H
Figure 10 - Extended Modbus System Example
In Figure 0, we can see four specific styles of Modbus operations. Modbus/RTU devices are traditionally
split into two groups.
Modbus slave devices generally are the workhorse devices. Often industrially hardened, they tirelessly
perform their tasks 24 hours a day, 365 days a year. They perform tasks such as flow metering, temperature
control, batch loading, or even running entire automated assembly lines. The slave devices are not called
“slaves” because they work all the time; they are called slaves because as far as the data communications is
concerned, they function as passive servers. Modbus slave devices passively sit and wait for a remote
Modbus master device to ask them to report existing data values (Read) or accept new data values (Write).
Modbus master devices generally are higher-level computers, devices in which data and software are very
important. The most common examples of Modbus master devices are the “Human-Machine-Interface”
(HMI) computers, which allow human operators to monitor, adjust, and maintain the operations of the field
devices. Modbus master devices are clients that actively go out and “Read” from and/or “Write” to remote
Modbus slave devices to monitor or adjust slave behavior.
3.4 IP Address
Every device connected to the TCP/IP network including the XPort-MB Device Server must have a unique
IP address. When multiple Modbus devices share a single IP, then Modbus/TCP includes an additional
address called the Unit ID.
When the XPort-MB Device Server is receiving Modbus/TCP messages from remote masters, the Unit ID is
converted to use in the Modbus/RTU message as the slave address.
When the XPort-MB Device Server is receiving Modbus/RTU messages from local serial masters, a user-
defined lookup table is used to match the 8-bit Modbus slave address to a remote IP address. The Modbus
slave address received is used as the Unit ID.
Figure 11 shows two devices found on the network, with the IP addresses assigned by the DHCP server. The
device IP Address is normally set to 0.0.0.0 at the factory. The Hardware Address is an individual
permanent address assigned to a particular device on the network. The Hardware Address can be found on
the product label.
Note: The unit Type shown as XPort-IAP is the Modbus device.
Double-click the XPort-IAP in the Device Installer window to display the expanded window shown in
Figure 12. The Device Details tab is automatically selected and will display information about the selected
device.
Note: The ERROR displayed by DeviceInstaller’s Device Details is reported because the Modbus firmware
has different setup record data than the standard serial tunneling firmware.
4. Web Configuration
From the DeviceInstaller Utility, click the Web Configuration tab. The IP address and Port number will be
displayed. To view the Web-Manager in the current DeviceInstaller window, click the Navigate icon .
To open the Web-Manager in your default web browser (recommended method), click the External
Browser icon .
If a password window appears, leave the User name and Password fields empty and click OK or press
Enter. By default the Device Server configuration will not have password protection. If a password has
been installed, then you would need to enter it here.
2. You’ll see the following lines, which tell you the Device Server’s Ethernet MAC address (hardware
address).
3. Within 5 seconds, press Enter to display the Setup (configuration) Mode screen. Here you can change
the parameters that define how the XPort-MB Device Server does its job.
Note: When you set up a new unit, and especially if you just reflashed the unit with a new firmware type, we
recommend that you reset all of the parameters to the factory defaults.
4. To reset the parameters to the factory defaults, type D on the command line and press Enter. The default
parameters display.
5. Select an option on the menu (1-7) by typing the number of the option.
6. To enter a value for a parameter, type the value and press Enter, or to confirm a default value, press
Enter.
7. Review your entries.
8. You have the following options:
To save the configuration and exit, type S on the command line and press Enter. This saves the
parameters to EEPROM.
Caution: DO NOT POWER CYCLE the unit too fast after doing this. Allow the unit to reboot naturally one
time first.
6. Configuring Modbus
6.1 Network/IP Settings
Select 1 in the Telnet Setup menu to configure the Device Server’s network parameters. In the Web-
Manager click Network in the main menu.
The following values can be set/changed. To understand and select the appropriate values, consult one of
the many TCP/IP books available today and your network administrator.
6.3.4 Delay after CTS Going Active (0-1275 ms, 5ms increments)
Only asked if RTS/CTS mode is variable and set to wait for CTS to go active. After the Device Server sees
the modem assert an RTS/CTS response input, it delays from 0 to 1275 msec before transmitting. If the
Device Server waits without seeing a valid response from the modem, it will return the Modbus exception
response 0x0B (hex) to the Modbus/TCP requesting master.
6.4.1 NET232/NET485/XPort-MB
The Modbus Master/Slave functionality on the XPort-MB is very similar to the Modbus implementation on
other device servers. The major difference is that the configurable pins on the XPort-MB (CP1-3) can be
configured from the setup menu or web manager.
Selecting Wait for CTS will cause CP3 to be auto-configured for CTS Input. You
will not be able to configure CP3 and the following message will appear:
CP3 Function already configured for CTS Input
Selecting DTR Output for CP2 will prompt you for additional options.
DTR Mode (1=Fixed, 2=Active with connection)
Selecting RS485 Output Enable for CP2 will prompt you for additional control options.
Invert RS485 Output Enable(active low) (N)
The RS485 Output Enable function is used for controlling an external RS485 line driver when in RS485
2-wire mode and this output can be configured for active high (default) or active low.
Note: During a Telnet connection, CP1 LED (Status LED) is ON. For a serial port connection, CP1 LED
(Status LED) blinks for 2 seconds, then OFF for 2 seconds. (It appears as 4 blinks, then OFF for 2 seconds)
6.4.2 XPort-Direct+-MB
The Modbus Master/Slave functionality on the XPort-Direct+ is very similar to the Modbus implementation
on other platforms such as the NET232 or NET485. The major difference is that the configurable pins on the
XPort-Direct+ (CP1-CP3) can be configured from the setup menu and web manager. The configurable pin
options are as follows:
The assignment for each configurable pin is set by cycling through the menu options by entering a space or
any key other than <enter>. GPIO assigns the pin as a general purpose input or output. The GPIOs can be
written and read via Modbus/TCP when in slave attached mode. Diag LED, Status LED-G and Status LED-
Y are the outputs for diagnostic LED (red), green status LED and the yellow status LED. After assigning the
applicable function by pressing <enter> you are then asked if the pin is inverted (active low).
CP1 Function (hit space to toggle) GPIO (In) Invert (active low) (Y) ?
A function should be assigned to each configurable pin. GPIO (Input) should be the default for all unused or
unassigned pins.
CP1 Function (hit space to toggle) GPIO (In) Invert (active low) (N) ?
CP2 Function (hit space to toggle) GPIO (In) Invert (active low) (N) ?
CP3 Function (hit space to toggle) GPIO (In) Invert (active low) (N) ?
After all the configurable pins have been assigned, the standard modem control settings can be entered if
applicable.
RTS/CTS Mode (1=Fixed 2=Variable) (1) ?
The setting for each configurable pin is displayed in the setup menu.
Modbus/TCP to RTU Bridge Setup
1) Network/IP Settings:
IP Address ................. 192.168.0.2
Default Gateway ............ --- not set ---
6.4.3 MatchPort/WiPort/Wi232-MB
The Modbus Master/Slave functionality on the MatchPort, WiPort and WiBox is very similar to the Modbus
implementation on other platforms such as the NET232 or NET485. The major difference is that the
configurable pins on the MatchPort/WiPort (CP0-CP10) and the WiFi settings on the
MatchPort/WiPort/WiBox can be configured from the setup menu and web manager.
The WiPort/WiBox is a 2 serial port device and you can choose which serial port the firmware uses for
sending and receiving Modbus/RTU or Modbus/ASCII serial data under the “Serial & Mode Settings”
menu option. Channel 1 on WiBox only supports RS232 while channel 2 supports RS232 and RS422/RS485
2/4-Wire modes.
Use serial connector (1=CH1 2=CH2) (1) ?
The assignment for each configurable pin is set by cycling through the menu options by entering a space or
any key other than <enter>. GPIO assigns the pin as a general purpose input or output. The GPIOs can be
written and read via Modbus/TCP when in slave attached mode. DTR is the modem control output (MCO)
signal for Data Terminal Ready. Diag LED, Status LED-G and Status LED-Y are the outputs for diagnostic
LED (red), green status LED and the yellow status LED. RS485 Select is an output made active when
configuring the serial channel for RS422/485 operation. RS485 2-Wire and 4-Wire are outputs made active
when configuring RS422/485 2-Wire or 4-Wire operation respectively. Defaults is an input read at startup
that tells the firmware to reset configuration to factory defaults. After assigning the applicable function by
pressing <enter> you are then asked if the pin is inverted (active low).
CP0 Function (hit space to toggle) GPIO (In) Invert (active low) (Y) ?
A function should be assigned to each configurable pin. GPIO (Input) should be the default for all unused or
unassigned pins.
CP0 Function (hit space to toggle) RS485 Select Invert (active low) (Y) ?
CP1 Function (hit space to toggle) RS485 2-Wire Invert (active low) (Y) ?
After all the configurable pins have been assigned, the standard modem control settings can be entered if
applicable.
RTS/CTS Mode (1=Fixed 2=Variable) (1) ?
The setting for each configurable pin is displayed in the setup menu.
Modbus/TCP to RTU Bridge Setup
1) Network/IP Settings:
IP Address ................. 192.168.0.2
Default Gateway ............ --- not set ---
Netmask .................... --- not set ---
2) Serial & Mode Settings:
Protocol ................... Modbus/RTU,Slave(s) attached
Serial Interface ........... 9600,8,N,1,RS232,CH1
3) Modem/Configurable Pin Settings:
CP0..!RS485 Select CP1..!RS485 2-Wire CP2.. GPIO (In)
CP3.. GPIO (In) CP4.. GPIO (In) CP5.. Diag LED
CP6.. Status LED-G CP7.. Status LED-Y CP8.. GPIO (In)
CP9.. GPIO (In) CP10. GPIO (Out)
RTS Output ................. Fixed High/Active
4) Advanced Modbus Protocol settings:
Slave Addr/Unit Id Source .. Modbus/TCP header
Modbus Serial Broadcasts ... Disabled (Id=0 auto-mapped to 1)
Local Slave Addr for GPIO .. 003 mapped to 0x/1x00100-00110
MB/TCP Exception Codes ..... Yes (return 00AH and 00BH)
Char, Message Timeout ...... 00050msec, 05000msec
6) WLAN Settings:
WLAN ....................... Enabled, FW Rev 0, network:LTRX_IBSS
Ad Hoc network creation .... Enabled, LTRX_IBSS, Country:US, Channel:11
Security ................... None
Data rate .................. Up to 11 Mbps
Power management ........... Disabled
The menu option for “WLAN Settings” has been added to configure the WiFi parameters of the
WiPort/WiBox.
6.6.6 Frequency
Frequency is the period in milliseconds between accesses to the registers (50 – 65000 ms).
Close Idle TCP sockets after (3-60 sec, 0=leave open) (10)
Redundant entry retries after (15-60 sec. 0=disable feature) (0)
(Set 4th octet to 0 to use Slave Address as part of IP)
6.7.1 Close Idle TCP sockets after (3-60 sec, 0=leave open)
Sockets are opened as required. Entering a 0 holds a single socket open to the last remote Modbus/TCP
slave accessed.
Otherwise enter values 3 to 60 to automatically close the last socket after 3 to 60 seconds of idle time.
" Net_Req[#nn] xx …" Dump of the received Modbus/TCP request with header (length nn). The
Modbus/TCP header is the first 6 bytes followed by the Modbus message. The first
byte of the Modbus message is the slave address and the second byte is the function
code.
" Net_Rsp[#nn] xx …" Dump of the Modbus/TCP response with header (length nn). The Modbus/TCP
header is the first 6 bytes followed by the Modbus message. The first byte of the
Modbus message is the slave address and the second byte is the function code
(OR’ed with 80hex if there was an error).
"Mas_Req[#nn] xx …" A dump of bytes for the master request (Master attached mode).
" no_slave" No matching slave in the Unit ID -> IP Address Table (Master attached mode).
" newsck" Closing TCP socket to reach new IP address (Master attached mode).
" new_opn:n.n.n.n" Open new TCP socket to IP address n.n.n.n (Master attached mode).
" discard stale rsp seq_no:xx" Modbus/TCP response received with the wrong sequence number (xx).
" master impatient" A new master request available on the serial port before the Modbus/TCP response
was received or timeout (Master attached mode).
" Discard 0x0B" Modbus/TCP response had a gateway error status (0A/OB) and gateway errors were
disabled in configuration (Master attached mode).
" Pipe-N" The current request is being discarded because more Modbus/TCP requests were
queued on the socket and the pipeline option was disabled.
" rsp_delay_msec nnn" Reports the response delay time in milliseconds (nnn).
" bad slv/cmd " The slave address or function code of the response did not match the command.
“ Pause nnn” The firmware has injected a pause of ‘nn’ milliseconds. There is a minimum time
that must be met of 3.5 character times between commands and responses. This
minimum can be increased using the “Serial TX delay after RX” configuration
option. Otherwise, it is based on the baud rate.
" CTS_TimeOut!" A timeout occurred while waiting for CTS to go active (optional modem control).
" sTx[#nn] xx xx …" A dump of nn bytes of serial transmit data (debug firmware only).
" Ser_In ccc…" A dump of received serial characters (Modbus/ASCII mode only).
" Ser_In rxx rxx…" A dump of received serial bytes (Modbus/RTU, debug firmware only).
" No Response!" Modbus message timeout with no bytes received on the serial port.
" sRx[#nn] xx xx …" A dump of received serial bytes (debug firmware only).
" CharTO" Character Time Out reached during serial receive. Normally the firmware tries to
predict the end of the Modbus message, but if the function is unknown, the CRC is
bad or more incoming bytes are available then the character timeout is used.
" Ovr" Overflow, too many bytes received for Modbus message (>255).
" LftO" Unexpected byte received, the returned slave address or function code does not
match the command (Modbus/RTU only).
"CH Err err” Modbus serial error reported (see Error Codes).
01 Illegal Function
02 Illegal Data Address
03 Illegal Data Value
04 Illegal Response Length
05 ACKnowledge
06 Slave Device Busy
07 Negative ACKnowledge
08 Memory Parity Error (Prog)
10 (0Ah) Gateway Path Unavailable
11 (0Bh) Gateway Target Device Failed to Respond
Note: Grid Connect does not endorse WinTECH software. The information is provided to assist software
developers. No support for this software will be provided by Grid Connect.
Baud Byte/Sec Bit Time Byte Time 256 Byte (in sec)
Rate (msec) (msec) Time (msec)
300 30 3.333333 33.333333 8533.333333 8.53
600 60 1.666667 16.666667 4266.666667 4.27
1200 120 0.833333 8.333333 2133.333333 2.13
2400 240 0.416667 4.166667 1066.666667 1.07
4800 480 0.208333 2.083333 533.333333 0.53
9600 960 0.104167 1.041667 266.666667 0.27
19200 1920 0.052083 0.520833 133.333333 0.13
38400 3840 0.026042 0.260417 66.666667 0.07
57600 5760 0.017361 0.173611 44.444444 0.04
115200 11520 0.008681 0.086806 22.222222 0.02
The overall time it takes to poll is the combined sum of these delays:
1. Delay for Master /Client to recognize need for poll
2. Delay to issue and get the poll onto the Ethernet
3. Delay for the poll to cross Ethernet and arrive error-free at the Modbus Bridge device (may include
retries and contention)
4. Delay for Modbus Bridge to process and queue Modbus/RTU poll
5. Delay for the serial link to be free (remember other Masters/Clients may be actively polling)
6. Physical delay to shift poll bit-by-bit across the serial link
7. Delay in the device to recognize, process, and start reply
8. Physical delay to shift response bit-by-bit across the serial link
9. Delay for Modbus Bridge to process and queue Modbus/TCP Response
10. Delay for the response to cross Ethernet and arrive error-free at the Master/Client (may include retries
and contention)
11. Delay for Master /Client to recognize need for poll