Cypress | Chameleon CTM-130 | User manual | MODBUS Operation for a CTM-200

Add to My manuals
10 Pages

advertisement

Cypress | Chameleon CTM-130 | User manual | MODBUS Operation for a CTM-200 | Manualzz

MODBUS

OPERATION

Model

Revision

Chameleon CTM-200 gateway

1.0

3066 Beta Avenue Burnaby, B.C. V5G 4K4

Phone: 604.294.4465

Fax: 604.294.4471 [email protected]

Contents 2

Contents

Contents .......................................................................................................................................................... 2

Revision Control .............................................................................................................................................. 2

1 CTM-200 MODBUS Operation ................................................................................................................ 2

2 MODBUS Configuration Commands ....................................................................................................... 3

2.1 MODBUS Serial Master Gateway Gateway Configuration .............................................................. 3

2.2 MODBUS Slave Gateway Gateway Configuration ........................................................................... 4

3 MODBUS Command Reference .............................................................................................................. 5

3.1 General MODBUS Command Reference ......................................................................................... 5

3.2 MODBUS Serial Master Gateway Command Reference ................................................................. 6

3.3 MODBUS Slave Gateway Command Reference .............................................................................. 8

4 Technical Support/Warranty: ............................................................................................................... 10

Revision Control

Description

Customer Release

Updated Documentation for CTM-200

Revision

revision 1.0

Date

07-19-2012

1 CTM-200 MODBUS Operation

The CTM-200 gateway supports the MODBUS protocol commonly used in SCADA applications. The gateway can be configured as one of three types of MODBUS devices:

MODBUS slave with its own MODBUS ID

MODBUS serial master gateway

MODBUS slave gateway for a single serial slave and multiple TCP slaves (default configuration)

This application note details how to setup a CTM-200 gateway in MODBUS mode. The MODBUS connection uses the cellular wireless packet data network so is able to provide the advantages of high data rates, and being always connected so available for quicker response times. Over-the-air MODBUS

© 2011 Cypress Solutions MODBUS Operation (Revision 1.3)

MODBUS Configuration Commands 3 messages can be configured to be sent as MODBUS RTU messages encapsulated in UDP packets, or as

MODBUS TCP messages. MODBUS RTU over UDP messages minimizes wireless data usage at the cost of unreliable data delivery. MODBUS TCP messages provide reliable data delivery at the cost of increased wireless data usage. The default configuration for the gateway in MODBUS mode is to use MODBUS TCP as the over-the-air protocol.

2 MODBUS Configuration Commands

The following section details the CTM-200 gateway specific commands used to configure the gateway as either a MODBUS slave gateway or a MODBUS master gateway.

Note: For all commands to be saved to non-volatile memory, a “cmd save” must be entered before turning off or restarting the gateway. After saving commands, a power cycle is required for the CTM-

200 to run in a MODBUS gateway mode

2.1 MODBUS Serial Master Gateway Configuration

The following set of gateway commands will configure the gateway to act as a MODBUS serial master gateway using MODBUS RTU between the MODBUS master application and the gateway, and using

MODBUS RTU over UDP over-the-air.

cmd factory Reset gateway configuration to factory defaults

cmd modbusctm130 1 Set gateway to use MODBUS RTU over UDP over-the-air

© 2011 Cypress Solutions MODBUS Operation (Revision 1.3)

MODBUS Configuration Commands 4 to maintain backward compatibility with CTM13x modems configured as MODBUS gateways

cmd modbusmode 1

cmd port 1 9600 8 n 1 0

Set gateway to be a MODBUS serial RTU master gateway

Set primary serial port as MODBUS serial master with baud rate of 9600bps, 8 data bits, no parity, 1 stop bit and no flow control

cmd modbusidmap 1 123.2.1.2 502 Add an entry to the MODBUS ID to slave gateway IP map.

Repeat this command for MODBUS IDs = 2 to 247.

cmd modbusidmap

cmd mode 6

List all entries in MODBUS ID to slave gateway IP map

Set the gateway to auto connect to both the wireless network and the MODBUS host interface

cmd save

cmd pwr mode 2

Save the gateway configuration to non-volatile memory

Power cycle the gateway for the configuration to take effect

2.2 MODBUS Slave Gateway Configuration

The following set of gateway commands will configure the gateway to act as a MODBUS slave gateway using MODBUS RTU between the gateway and the MODBUS serial slave devices, and using MODBUS RTU over UDP over-the-air. cmd factory Reset gateway configuration to factory defaults

cmd modbusctm130 1 Set gateway to use MODBUS RTU over UDP over-the-air to maintain backward compatibility with SCADA master devices that polled CTM13x modems configured as MODBUS slave gateways

cmd modbusmode 0 Set gateway to be a MODBUS slave gateway

cmd modbusdel 0

cmd port 1 9600 8 n 1 0

Delete all previously configured entries of MODBUS slave IDs

Set primary serial port as MODBUS serial slave device with baud rate of 9600bps, 8 data bits, no parity, 1 stop bit and no flow control

cmd modbusadd 1 Serial R Set the serial port slave device to have a slave ID of 1 and to use

MODBUS RTU as the serial transmission mode.

© 2011 Cypress Solutions MODBUS Operation (Revision 1.3)

MODBUS Command Reference 5

cmd modbusadd

cmd mode 6

cmd save

cmd pwr mode 2

List all entries in MODBUS slave list

Set the gateway to auto connect to both the wireless network and the MODBUS host interface

Save the gateway configuration to non-volatile memory

Power cycle the gateway for the configuration to take effect

3 MODBUS Command Reference

3.1 General MODBUS Command Reference

The gateway provides a set of common commands used for configuring both types of MODBUS gateways.

These commands are used for enabling the CTM-200 gateway to initiate the MODBUS host interface, for configuring the over-the-air protocol, and for configuring the transmission mode used between the CTM-

200 gateway and the MODBUS device.

modbusctm130 n (enable backward compatibility with CTM13x MODBUS messages over-the-air)

This command enables MODBUS backward compatibility with the CTM-13X by using MODBUS RTU encapsulated in UDP packets for messages transmitted/received over-the-air. The CTM-13X modems only use MODBUS RTU over UDP as the over-the-air protocol for communicating between other gateways configured as MODBUS master and slave gateways.

n = 0 use MODBUS TCP for over-the-air communications (default)

n = 1 use MODBUS RTU over UDP for over-the-air communications

A cmd save, and a power cycle are required before the gateway is configured to use the specified

MODBUS over-the-air protocol.

Examples:

cmd modbusctm130 1 Set MODBUS gateway to send/receive MODBUS RTU over UDP messages

cmd modbusctm130 Query the currently configured MODBUS over-the-air protocol modbusmode n (sets the MODBUS gateway mode)

This command sets the specified MODBUS gateway mode of the gateway, specifically, the transmission mode between the gateway configured as the serial master gateway and the MODBUS serial device connected to the gateway. n = 0 slave gateway (default)

© 2011 Cypress Solutions MODBUS Operation (Revision 1.3)

MODBUS Command Reference 6 n = 1 n = 2

RTU master gateway

ASCII master gateway

A cmd save, and a power cycle are required before the gateway is placed in the specified MODBUS gateway mode. mode n (sets serial port(s) connection mode)

This command sets the required connection mode of the gateway.

n = 1

n = 2

n = 3

n = 4

n = 5

n = 6

n =7

n=8 manual connection (default) auto connect to the network auto connect to the network and go directly into PPP mode auto connect to both the network and the PAD host interface auto connect to the network and serial LCD (future) auto connect to both the network and the MODBUS host interface auto connect to both the network and the ZigBee mode auto connect to both the network and the ElmScan tool for OBD II

A cmd mode 6, a cmd save, and power cycles are required before the gateway is placed in MODBUS mode.

3.2 MODBUS Serial Master Gateway Command Reference

The following section provides commands used to configure the gateway as a MODBUS serial master gateway. For the following commands to be applied, the gateway must be configured for MODBUS mode using cmd mode 6 and configured as a serial master gateway using either cmd modbusmode 1 or cmd

modbusmode 2. port n r d p s f (serial port settings)

Configures the baud rate and data format of the specified serial port.

After implementing this command it will be necessary to change the baud rate of the MODBUS master or slave device connected to the gateway to match the new configuration.

n = 1 configure Primary DB9 port

n = 2 configure Secondary DB9 port

n = 3 configure RS485 port

r = 1200 1200 Baud

r = 2400 2400 Baud

r = 4800 4800 Baud

r = 9600 9600 Baud

r = 19200 19200 Baud

r = 38400 38400 Baud

© 2011 Cypress Solutions MODBUS Operation (Revision 1.3)

MODBUS Command Reference 7

r = 57600 57600 Baud

r = 115200 115200 Baud (default)

d = 5,6,7 or 8 number of data bits (d=8, default)

p = n or N no parity (default)

p = e or E even parity

p = o or O odd parity

s = 1 or 2 number of stop bits (s=1, default)

f = 0 no flow control (default)

f = 1 software flow control

f = 2 hardware flow control

The current port setting can be queried by using the port command without parameters.

Examples:

cmd port 1 115200 8 n 1 2 configure primary serial port baud rate=115200bps, 8 data bits, no parity,

1 stop bit and hardware flow control

cmd port returns the current port configuration settings

Note 1: For MODBUS Serial Master Gateway there are 2 options only for the data bit configuration:

7 and 8 for ASCII Mode.

8 for RTU-over-UDP Mode.

Note 2: If the baud rate of the serial port is changed from the serial console using the port command, and the baud rate of the host application is changed to match the new configuration after implementing this command, then the serial console should still be able to accept commands. This functionality is only available if the connection mode is mode = 1 or mode = 2 before issuing port.

A cmd save and a power cycle is required for this command to take effect. modbusidmap n a.a.a.a p (set up MODBUS ID to gateway IP:port map)

This command is only configured when using the CTM-200 as a MODBUS master gateway (cmd

modbusmode 1 or cmd modbusmode 2). This command returns ERROR if the CTM-200 is configured as a

MODBUS slave gateway (cmd modbusmode 0).

This command sets up the MODBUS ID to gateway IP for each remote MODBUS slave device (i.e. another

CTM-200 gateway configured as a MODBUS slave gateway). The default for all entries is n 0.0.0.0. Use n

0.0.0.0 0 to erase an entry. One entry is added at a time with a limit of up to 247 entries (each entry requires a unique ID). To change an entry, one must first erase it then enter the changed IP address and port number.

© 2011 Cypress Solutions MODBUS Operation (Revision 1.3)

MODBUS Command Reference 8

n = 1 to 247 MODBUS ID, in decimal

a.a.a.a = 0.0.0.0 to 255.255.255.255 MODBUS slave gateway IP address, in decimal

p = 0 to 65535 Port that the slave gateway will be listening on, in decimal

Examples:

cmd modbusidmap 1 123.1.2.3 502 Set the MODBUS master gateway to forward messages for the slave device with ID 1 to port 502 of the gateway at 123.1.2.3

cmd modbusidmap 1 0.0.0.0 Clear the MODBUS ID to gateway IP entry for slave ID 1

cmd modbusidmap 1 123.1.2.4 502 Change slave ID 1 entry to the gateway at 123.1.2.4

cmd modbusidmap 0 0.0.0.0 Clear all MODBUS ID to gateway IP entries

cmd modbusidmap Query all MODBUS ID to gateway IP entries

3.3 MODBUS Slave Gateway Command Reference

The following section provides commands used to configure the gateway as a MODBUS slave gateway.

For the following commands to be applied, the gateway must be configured for MODBUS mode using

cmd mode 6 and configured as a slave gateway using cmd modbusmode 0.

When the MODBUS slave gateway is enabled, the gateway will look at its MODBUS slave list to handle all

MODBUS functions and traffic. This MODBUS gateway is able to function as:

MODBUS TCP slave gateway

MODBUS Serial slave gateway

Self MODBUS device (one only allowed)

The MODBUS slave gateway will be using the default port of 502.

To add a MODBUS slave device entry to the MODBUS list. One entry is added at a time with a limit of up to 247 entries (each entry requires a unique ID). MODBUS TCP slaves, serial slaves and self slave can be added to the list. For the MODBUS self slave, the entry on the MODBUS list will be “Localhost, id”. modbusadd (query MODBUS slave gateway list)

To display all the entries in the MODBUS list. Read only.

Example:

cmd modbusadd displays the MODBUS list

(192.168.1.20,247) TCP slave device with ID = 247

(Localhost,10) self slave device with ID = 10

(19200.N.8.1 A,155) serial slave device (baud 19200, no parity, 8 data, 1 stop, ASCII, no flow control) with ID = 155 modbusadd id nnn.nnn.nnn.nnn (add a MODBUS TCP slave)

id = 1 to 247 MODBUS ID

nnn.nnn.nnn.nnn = 1.0.0.0 to 255.255.255.255 MODBUS slave IP address

© 2011 Cypress Solutions MODBUS Operation (Revision 1.3)

MODBUS Command Reference 9

modbusadd id Serial m (add a MODBUS serial slave)

Adds a MODBUS Serial Slave

id = 1 to 247 MODBUS ID

m = a or A ASCII transmission mode

m = r or R RTU transmission mode

Notes:

The MODBUS slave gateway will use the serial port settings configured using the port command for all serial slaves.

For MODBUS RTU configuration to function properly d = 8 must be entered for the port command. (This configuration is in accordance with the MODBUS specification)

modbusadd will return “Invalid IP address (Sx)” followed by an “OK” if modbusadd is configured with parameters missing or incorrect parameters. Ensure that the modbussadd parameters match those from the above list.

All MODBUS serial slave devices connected to a serial bus configuration such as RS485 must use the same transmission mode. (This configuration is in accordance with the MODBUS specification) modbusadd id (add MODBUS self slave - only one is permitted)

id = 1 to 247

Examples:

cmd modbusadd 1 192.168.100.122

cmd modbusadd 3

cmd modbusadd 17 115200 N 8 1 a

MODBUS ID add TCP slave with ID 1 and IP 192.168.100.122 add itself as a MODBUS slave with ID = 3 add serial slave with baud 115200, no parity, 8 data bits, 1 stop bit and as ASCII transmission mode

Note: modbusadd will return “Invalid IP address (Sx)” followed by an “OK” if modbusadd is configured with parameters missing or incorrect parameters. Ensure that the modbussadd parameters match those from the above list. modbusdel n (delete MODBUS entry)

This command is used to delete an entry or all entries from the MODBUS list.

n = 0 deletes all MODBUS entries

MODBUS ID entry n = 1 to 247

Examples:

cmd modbusdel 1

cmd modbusdel 0 delete the entry with MODBUS ID 1 delete all entries in the MODBUS list

© 2011 Cypress Solutions MODBUS Operation (Revision 1.3)

4 Technical Support/Warranty:

Cypress Solutions Service

Support Group

1.877.985.2878 or 604.294.4465

9.00am to 5.00pm PST [email protected]

Technical Support/Warranty: 10

© 2011 Cypress Solutions MODBUS Operation (Revision 1.3)

advertisement

Related manuals

Download PDF

advertisement