The text of a manual · part 10 of 16
CoBox-FL/CoBox-FL-IAP User Guide, pages 81 to 89
Pages 81 to 89 of 135: Monitor Mode; Network Configuration using UDP
The original document is the PDF (1.7 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Lantronix CoBox-FL
Page 81
Monitor Mode
7. Monitor Mode 7.1 Monitor Mode Monitor Mode is a command-line interface used for diagnostic purposes (see Table 17 Monitor Mode Commands). There are two ways to enter Monitor Mode: locally via the serial port or remotely via the network.
7.1.1 Entering Monitor Mode Via the Serial Port To enter Monitor Mode locally: 1. Follow the same principles used in setting the serial configuration parameters (see Configuring via the Setup Mode Window on page 3-10. 2. Instead of typing three “x” keys, however, type zzz (or xxl) to enter Monitor Mode with network connections. Type yyy (or yyy) to enter Monitor Mode without network connections. 3. A 0> prompt indicates that you have successfully entered Monitor Mode.
7.1.2 Entering Monitor Mode Via the Network Port To enter Monitor Mode using a Telnet connection: 4. First establish a Telnet session to the configuration port (9999). The following message appears: Serial Number 1400280 MAC address 00:20:4A:14:01:18 Software Version 4.3 (xxxxxx) Press Enter to go into Setup Mode
5. Type M (upper case). A 0> prompt indicates that you have successfully entered Monitor Mode.
7.1.3 Monitor Mode Commands The following commands are available in Monitor Mode. Many commands have an IP address as an optional parameter (xxx.xxx.xxx.xxx). If the IP address is given, the command is applied to another Device Server with that IP address. If no IP address is given, the command is executed locally. Note: All commands must be given in capital letters.
CoBox-FL User Guide
7-1
Page 82
Monitor Mode
Table 17 - Monitor Mode Commands Command
Command Name
Function
DL
Download
SF x.x.x.x
Send Firmware
VS x.x.x.x
Version
GC x.x.x.x
Get Configuration
SC x.x.x.x
Send Configuration
PI x.x.x.x
Ping
AT TT
ARP Table TCP Connection Table Network Connection Reset Send/Set IP Address
Download firmware to the Device Server via the serial port in hex format Send firmware to Device Server with IP address x.x.x.x Query software header record (16 bytes) of Device Server with IP address x.x.x.x Get configuration of Device Server with IP address x.x.x.x as hex records (120 bytes) Set configuration of Device Server with IP address x.x.x.x from hex records Ping Device Server with IP address x.x.x.x to check device status Show the Device Server’s ARP table entries Shows all incoming and outgoing TCP connections Shows the Device Server’s IP configuration Resets the Device Server’s power Remotely assign an IP address to a Device Server, where xxx.xxx.xxx.xxx is the IP address, and yyyy.yyy.yyyy.yyy is the two-part identification number at the bottom of the label, converted to decimal, and written twice. Exit diagnostics mode Gets a memory page of configuration information from the device. Sets a memory page of configuration information on the device.
NC RS SI xxx.xxx.xxx.xxx: yyy.yyy.yyy.yyy
QU G0, G1, ....,Ge, Gf S0, S1,...,Se, Sf
Quit Get configuration from memory page Set configuration to memory page
Responses to some of the commands are given in Intel Hex format (see The Intel Hex Format on page 8-5). Note: Entering any of the commands listed above will generate one of the following command response codes: Table 18 -Command Response Codes Response
Meaning
0> 1> 2>
OK; no error No answer from remote device Cannot reach remote device or no answer Wrong parameter(s) Invalid command
8> 9>
7-2
CoBox-FL User Guide
Page 83
UDP
8. Network Configuration using UDP 8.1 UDP Datagrams The Device Server can also be configured or queried over the network using UDP datagrams. The Device Server has a UDP listener set for port 30718 (77FE Hex). Responses from the Device Server are returned to the source port of the UDP packet. The first three bytes of the UDP data block should be set to zero. The fourth byte selects the function as described in the following table: Table 19 - UDP Configuration Byte Command
Parameters
Notes
03
Node Reset
2 bytes, software type
F6
Query for Firmware Version Firmware Information
None
These 2 bytes are used to prevent accidental reset of the Device Server. (Value for standard CoBox firmware: 33 51 [Hex], 3Q) The Device Server responds with the F7 block below.
F7
F8 F9
Query for Setup Record Configuration Readback
FA
Set Configuration
FB
Configuration Change Acknowledge
FC
Set IP Address
CoBox-FL User Guide
First 16 bytes of the firmware image, and 4 bytes device information and serial number. None 120 byte setup record (see Setup Records on page E7) 120 byte setup record (see Setup Records on page E7) None
First 8 bytes must be set to the string
The first 16 bytes of the firmware image contain the software type (offset 4,5) and checksum (offset 14,15). The last two bytes of the device information contain the serial number. The Device Server responds with the F9 block below. n/a
The IP address (byte 0-3) will not be overridden using FA. See FD for this functionality. This block is sent back to the host requesting a configuration change (FB). After sending out this block, the Device Server resets and uses the new configuration sent with the FA command. This block can be sent as a broadcast, because the serial number is unique. It 8-1
Page 84
UDP
Byte Command
Parameters
Notes
IP-SETUP (Hex 49 50 2D 53 45 54 55 50).
provides one method to set the IP address of the Device Server if is on the local network and the serial number is known. Remember, broadcasts are only ‘heard’ on the subnet on which they are generated. No reply is sent by the Device Server, which restarts using the new IP address after the block is received.
Next 2 bytes have to be set to 00. Next 2 bytes must contain the serial number. Next 4 bytes have to be the new IP address. FD
8-2
Set Configuration and IP Address
Same as FA, but changes IP address as well (bytes 0-3).
Example (all in Hex): 49 50 2D 63 45 54 55 50 00 00 2A 12 81 00 01 02 IP address of the node with serial number 42-18 set to 129.0.1.2 n/a
CoBox-FL User Guide
Page 85
UDP
8.2 Configuring Multiple Devices When configuring a number of Device Servers identically, it is useful to create a template setup record. The setup record can then be sent to the “target” Device Servers from a “master” Device Server via “cut and paste” or UDP (see Network Configuration using UDP on page 8-1). Device Servers use a 120-byte setup record in Intel Hex format. This format facilitates the transfer of binary data using ASCII characters. See Setup Records on page 8-7 and The Intel Hex Format on page 8-5 for information about setup records and converting them to Intel Hex format. :20000010AC10C81D0000100000000000AC10010B4C0200001127000000000000C000 000011 :20002010000000000000000000000000000000000000000000000000000000000000 0000B0 :200040104C0200001227000000000000C00000000000000000000000000000000000 000049 :1800601000000000000000000000000000000000000000000000000078 :00000001FF
Figure 20 - Sample Setup Record in Intel Hex Format
8.2.1 Acquiring a Valid Setup Record There are a number of ways to acquire a valid setup record: • Copy the setup record of a properly configured Device Server via Monitor Mode (easiest method). • Request the setup record of a properly configured Device Server via another Device Server on the network. • Build the setup record in software. • From a host PC, request the setup record of a properly configured Device Server via UDP. To copy the setup record of a properly configured Device Server: 1. Configure a “master” Device Server with the desired parameters. 2. Enter Monitor Mode on the master Device Server (see Monitor Mode on page 7-1). 3. At the prompt, enter GC followed by a carriage return. The Device Server will respond with its setup record in Intel Hex format. 4. Copy the setup record into a text file and save it for future use.
CoBox-FL User Guide
8-3
Page 86
UDP
To request the setup record of a properly configured Device Server via another Device Server on the network: 5. Make sure that both units are plugged onto the network properly. 6. Enter Monitor Mode (with network support enabled) on the unit that is not properly configured. (see Monitor Mode on page 7-1) 7. Issue the command GC x.x.x.x followed by a carriage return, where x.x.x.x is the IP address of the properly configured device. The properly configured device will respond by sending its setup record to the unit you are currently on. This configuration will be displayed in Intel HEX format. 8. Copy that HEX string, and then issue the command SC. Now paste the copied string. The unit will not reboot on its own. You must reboot the unit before the settings take effect. To build the setup record in software: 1. Create a 120-byte setup record. 2. Convert it to an Intel Hex record (see The Intel Hex Format on page 8-5). 3. Copy the setup record into a text file and save it for future use. To request the setup record of a properly configured Device Server via UDP: 1. Configure a Device Server with the desired parameters and place it on the network. 2. From a host PC, send the F8 datagram to the Device Server (see Network Configuration using UDP on page 8-1). The Device Server responds with the F9 datagram, which includes its setup record. 3. Send a previously saved setup record from a host PC via UDP.
8.2.2 Sending a Setup Record There are also a number of ways to send a setup record to a Device Server: • Send a previously saved setup record via Monitor Mode (easiest method). • Send the setup record of a properly configured Device Server to another Device Server on the network. • Send a previously saved setup record from a host PC via UDP.
8-4
CoBox-FL User Guide
Page 87
UDP
To send a setup record via Monitor Mode: 1. Configure a “master” Device Server with the desired parameters and place it on the network. 2. Place another Device Server (the “target”) on the network. 3. Enter Monitor Mode (with network support enabled) on the master Device Server (see Monitor Mode on page 7-1) 4. At the prompt, enter SC, the IP address of the target, and a carriage return. 5. Send the setup record to the target Device Server. Note: For example, using Hyperterminal, copy the setup record and select “Paste to Host” to send it to the Device Server. The Device Server reboots with the new configuration. To send a previously saved setup record to a Device Server via UDP, from a host PC, send the FA (or FD) datagram to the “target” Device Server (see Network Configuration using UDP on page 8-1). Note: The Device Server responds with the FB datagram. Refer to the table.
8.2.3 The Intel Hex Format With this format, 8-bit binary data can be sent and received as ASCII text. The transmission is blocked in records, and every record has its own checksum. The record begins with a colon (:) and consists of a block length (2-character Hex), a 16-bit address (4-character Hex), and a block type (2-character Hex). It is built by adding all binary 8-bit values and taking the complement, so adding all byte values (including length, address, and type) should yield zero. Example: 00000001FF
End record, type 01, length 00, address 00 00, checksum FF. 01002000805F
Data record consisting of one byte (value 80 Hex) for address 0020 (32 decimal). For communication with the node, the following block types are defined: Table 20 - Block Types Option
Hex
Data block program memory (firmware) End record Data block configuration memory
00 01 10
CoBox-FL User Guide
8-5
Page 88
UDP
To get and set the node configuration, 120 bytes should be exchanged at once in 32-Byte records. The IP address in the record (bytes 0 to 3) will be ignored (unless the UDP FD command is being used).
8.2.4 Calculating the Checksum As mentioned in Table 20 - Block Types above, the last two characters of an Intel Hex setup record represent a checksum of the data in the line. Since the checksum is a two-digit hexadecimal value, it can represent a value from 0 to 255. The checksum is calculated by summing the value of the data on the line and taking the two’s complement of the sum. Note: Do not include the leading colon or the checksum byte in the sum. Example: 0300300002337A1E
Record length: 03 (3 bytes of data) Address: 0030 (the 3 bytes will be stored at 0030, 0031, and 0032) Record Type: 00 (normal data) Data: 02, 33, 7A Checksum: 1E 03 + 00 + 30 + 00+ 02 + 33 + 7A = E2 The two’s complement of E2 is 1E. See Calculating the Two’s Complement below.
8.2.5 Calculating the Two’s Complement The two’s complement of a number is the value that must be added to the number to reach a Hexadecimal value of 100 (256 in decimal). In the example above, E2 + 1E = 100. You can also calculate the two’s complement by subtracting the sum from 100. Using the example above again, 100 - E2 = 1E. It may help to use a scientific calculator.
8-6
CoBox-FL User Guide
Page 89
UDP
8.3 Setup Records A setup record consists of 120 bytes. They are transmitted at once from and to the node. Unused bytes should be initialized as 00. Table 21 - Setup Record Construction defines the structure of a setup record: Table 21 - Setup Record Construction Byte(s) Function 00-03 04 05
06 07 08-11 12-15 16-63 64-111 112-119
IP address of the unit (x.x.x.x) Reserved (0) Flag BYTE Bit 7: Reserved (0) Bit 6: Set 1 for AUI, 0 for 10BASE-T (CoBox-Micro only) Bits 5-0: Reserved (0) Number of host bits for subnetting; if 0, matching standard netmask for Class A, B, C is used. Reserved (0) Telnet configuration password (0 if not used) Gateway IP address (0,0,0,0 if not used) 48-byte Channel 1 parameters; parameter setup Channel 1 (see Table E-4: Channel Parameters) 48-byte Channel 2 parameters; parameter setup Channel 2 (see Table E-4: Channel Parameters)) Reserved (0)
CoBox-FL User Guide
8-7