SBL2 e Dual Serial To Ethernet Users Manual
SBL2 e Dual Serial To Ethernet Users Manual
Table of Contents
1. 2. 3. Overview ....................................................................................................................................... 4 IPSetup Software Utility .............................................................................................................. 4 Initial Configuration ................................................................................................................... 4
3.1 3.2 3.3 Serial Port Hardware ......................................................................................................................5 Network Configuration ...................................................................................................................5 Operational Configuration .............................................................................................................6
4.
5. 6. 7.
Serial Settings ............................................................................................................................ 12 Password Settings ...................................................................................................................... 13 Multi-Function Pin Control ...................................................................................................... 14
7.1 7.2 7.3 7.4
7.4.1 7.4.2 7.4.3
Multi-Function Pin Control .........................................................................................................15 Command Syntax ..........................................................................................................................15 Machine Command Mode ............................................................................................................17 Machine Command Examples .....................................................................................................18
Set Pins 14 and 15 to GPIO Outputs..........................................................................................................18 Set All GPIO Pins as Inputs and Readback ...............................................................................................18 Read A/D Inputs ........................................................................................................................................18
8.
AT Commands ........................................................................................................................... 19
8.1 8.2 8.3 8.4
8.4.1
Enter and Exit Command Mode ..................................................................................................19 Command Syntax ..........................................................................................................................20 System/Network Configuration ...................................................................................................21 Serial Port Configuration .............................................................................................................22
Custom Packetization ................................................................................................................................23
8.5 8.6
8.6.1 8.6.2 8.6.3 8.6.4 8.6.5
9. 10. 11.
LEDs .......................................................................................................................................... 27 RS-232 NULL Modem Wiring .............................................................................................. 27 Network IP Address Configuration ...................................................................................... 27 Page 2
Web Browsers and Proxy Servers ......................................................................................... 28 Testing with a Telnet Connection ......................................................................................... 28 Telnet to Serial Test Procedure............................................................................................. 29
Page 3
1. Overview
The NetBurner SBL2e is a dual serial-to-Ethernet device that will enable your serial device to communicate on an Ethernet network using TCP or UDP. In addition to the serial capabilities, the SBL2e also provides a separate network connection command channel for control of digital I/O signals and analog-to-digital readback. A list of features and functions is below:
2 Serial UARTs, TTL level, baud rates from 300 to 115,200 4 12-bit analog to digital converters, 0-3.3VDC input Up to 10 Digital inputs/outputs, also referred to as GPIO 10/100 Ethernet Serial to Ethernet capability through TCP or UDP DHCP and Static IP addressing Custom data packetization options Web page configuration AT command set configuration and operation 3.3VDC input power @ 250mA max
3. Initial Configuration
Before you can begin using your SBL2e, three areas of configuration are required to tell your SBL2e what type of serial interface you want to use, the network IP address network port number, and the serial data baud rate. 1. Hardware configuration 2. Network configuration 3. Operational configuration
Page 4
3.1
The SBL2e has two asynchronous UART type serial ports, referred to as Port 0 and Port 1. The SBL2e provides to TTL level UART serial ports: Port 0 signals : TX, RX, RTS, CTS Port 1 signals : TX, RX If you need RS-232 electrical levels, then you must add the appropriate level shifters to the TTL signals. The Debug Serial Port, or Debug Port for short, is used to display status messages from the application. If your application needs only a single serial port we recommend setting the other serial port to Debug.
3.2
Network Configuration
1. Run IPSetup.exe (by double clicking its icon). This program is located on the SBL2e product page at www.netburner.com. To view the Advance Settings, click on the Advanced button (the button name will change to Basic). In this example, I am using Uart 1 as my Monitor port (screen shot below). 2. Locate your SBL2e in the "Select a Unit" pane by matching its MAC address. The MAC address is located on the bottom of your SBL2e. If your SBL2e device does not appear in the list box, verify the power, speed, and link LEDs are illuminated, and click the Search Again button. If you are still unable to see your SBL2e, remove power, correct any cabling errors, reapply power, and click the Search Again button. Note: IP Setup uses a UDP broadcast protocol and will not operate through a router. FIREWALLS: IPSetup uses UDP and TCP port number 20034. If your computers firewall is blocking this port number you will need to either disable the firewall, or add a rule to the firewall to allow communication on this port number. 3. If your network supports DHCP (factory default): The assigned IP Address will appear in the "Select a Unit" pane. Write down this address. If your network does not support DHCP, configure the IP Address and Network Mask fields as shown in the screen shot below. If you need help selecting values, please read the "Selecting an IP Address" section at the end of this guide. After you have entered all of your values, click the Set button in the center of the IP Setup window to configure your SBL2e with its new parameters. Note: If you do not click the Set button, your values will not be saved. If you have multiple NetBurner devices, make sure you selected your SBL2e in the "Select a Unit" pane (as shown in the screen shot) before you input your information.
Page 5
3.3
Operational Configuration
Once the network parameters are, you can use the web server interface or serial AT commands to modify the settings of your SBL2e. We recommend using the web interface first to familiarize yourself with the operation of the SBL2e. To access the web page, click on the Launch Webpage button in IP Setup, or you can open your web browser, and enter the numeric IP Address in the address field (e.g. http://10.1.1.110).
Page 6
Device Name Address Mode Device IP Address Device Subnet Mask Device Gateway Device DNS
Ethernet Link
Specifies the device name to send to your DHCP server. Select between DHCP and Static IP address settings. If Address Mode is set to DHCP, your DHCP server will provide these values and they will be displayed in the DHCP Assigned Values column. If you wish to specify these values yourself set the Address Mode to static and type the values in the appropriate fields. Note that if you do not specify a Gateway or DNS server you will not be able to communicate outside your LAN. Normal = Auto-negotiate. You may also force 10MB or 100MB modes. Page 7
4.2 Incoming Connections (Server Mode) This section configures the SBL2e in a device server mode in which it listens for incoming TCP connections (or UDP packets if enabled) for each serial port.
Allow new connection if the existing connection has been idle for this many seconds.
Select checkbox to enable the port to listen for incoming TCP connection requests or UDP packets. Checking this box will override the TCP Client mode. Port number to listen on. The default port is 23 (telnet). The listen port numbers for Port0 and Port1 must be different. Terminate TCP connection if no incoming network data or outgoing serial data has occurred. This is useful because there is no way to detect if a client has crashed or abnormally terminated unless unacknowledged data exists and times out. A value of 0 disables this feature. This field has no effect in UDP mode. Similar to the disconnect timeout, but does not disconnect a connection until a new connection is requested. A value of 0 disables this feature. This field has no effect in UDP mode.
Page 8
4.3
Selects between connect on power-up for a permanent TCP connection, or make a TCP connection when serial data available. This feature has no effect on UDP. Specifies destination TCP or UDP port number Specifies destination IP address for TCP or UDP. When using UDP you must specify an address and port number in this section, or enable the Learn UDP Reply Address feature in the Custom Packetization section. Terminate TCP connection if no incoming network data or outgoing serial data has occurred. This is useful because there is no way to detect if a client has crashed or abnormally terminated unless unacknowledged data exists and times out. A value of 0 disables this feature. This feature has no effect on UDP. Number of seconds to wait before retrying an outgoing connection. This feature has no effect on UDP.
Page 9
4.4
Custom Packetization
Custom packetization can apply to TCP and UDP communication. Unlike TCP, UDP is a connectionless protocol. The SBL2e provides two methods to determine the destination network IP address: you can specify a static IP address, or you can use the source IP address of the last received UDP packet by selecting the Learn UDP Reply Address checkbox.
Use custom packetization logic Use UDP instead of TCP Learn UDP reply Address
Number msec to wait for accumulated characters (0 waits forever) Flush TCP frame when this character is received (Enter NA to disable)
Enables/disables custom packetization settings Check to enable UDP Send outbound serial to the IP address from the last received UDP packet. Useful for clients that may have changing IP addresses. If not using this feature, you must specify the destination IP address and port number in the Outgoing Connections section. Maximum number of characters to accumulate from the serial port before sending them out the network port. This setting will be overridden if the accumulation delay time setting is used and the delay time expires. Maximum wait time in milliseconds for received serial characters before sending any available characters out the network port. Send all accumulated serial data upon receipt of this character from the serial port. Enter the decimal value of the character. For example, a line feed is 10.
Page 10
Page 11
5. Serial Settings
The SBL2e provides two TTL level UARTs, Port 0 and Port 1. The RS-232 setting will enable the TTL level signals for transmit, receive, RTS and CTS, but you will need to add external level shifters if you need the RS-232 electrical signals instead of 0-3.3VDC TTL RS-232 DEBUG Select for use as TTL or if you have a RS-232 level shifter. Specifies whether or not to use the serial port as stdin, stdout and stderr for serial status messages or debugging.
Data Port Settings (If both are DEBUG, defaults to Port 0) Data Baud Rate Data bits Data parity Stop bits Flow control
Select serial mode RS-232 or DEBUG. Set serial baud rate Serial data bits Serial parity Number of stop bits Set to None for no flow control. If using RS-232 or TTL valid selections are None, Xon/Xoff software flow control, or RTS/CTS hardware flow control.
Page 12
6. Password Settings
Use the Password Settings screen to enable, disable or change an existing password. Only one password is allowed. To clear a password leave the fields blank and click on submit.
Page 13
Page 14
7.1 Multi-Function Pin Control In addition to Serial-to-Ethernet capabilities, the SBL2e provides external control and readback functionality for General Purpose Input/Outputs and Analog to Digital inputs. The function of each multi-function pin is set in the GPIO configuration web page (GPIO is the most common function). The "GPIO Network Server" on the SBL2e listens on the TCP port number specified in the "GPIO Server Port" field. For a quick test, you can use the telnet utility: "telnet <ip address> 1000" for the default port of 1000. Some pins are fixed, but are shown for reference. The pin configuration can only be done through the HTML web page or serial AT commands. Access to the pin functions can only be done through a TCP connection to the GPIO Network Server (not the serial port).
7.2 Command Syntax Once you have established a TCP connection to the GPIO Network Server, the following commands can be used, where "xx" is a value from 03 to 15. All commands and queries must be terminated by a line feed character: 0x0A. You may also terminate with a carriage return and line feed; the carrage return will be ignored by the parser. General Purpose I/O Functions: Pxx = 0 Pxx = 1 Pxx = I Pxx? Set pin output low. Set pin out put high. Set pin as input. Read input value. Note that this command will automatically program the pin as an input. The value of an output pin cannot be read. The return value is 0 or 1 in the format: "0, OK\r\n" or "1, OK\r\n".
returns "0, OK\r\n" returns "1, OK\r\n" if the pin is logic high
Analog to Digital Functions: Pxx? Read input value. The value read is a number from 0-4095 representing the number of counts. The counts represent a ratiometric value to the 3.3V reference voltage. The maximum voltage input is 3.3V.
Example: "P07?\n" , returns "1234, OK\r\n" if the number of counts was 1,234.
Page 15
Network Functions: X If the TCP client application, such as telnet, sends an 'X', the connection with the GPIO Network Server will be terminated.
Character Echo: Echos characters back to TCP client. Default is echo off. E e Enable echo Disable echo
Command and Query Return Strings: Each command and query will return an integer value followed by a ',' and optional text to provide details on the response. Any successful command will return: "0, OK\r\n". Any command error will return a negative number, followed by an explanation of the error. For example, sending the command "abcd\n" returns: "-3, Syntax Error\r\n". Any readback/query response will be the value of the readback followed by the status. For example, sending "P07?\n" could return "2034, OK\n". The 2034 is the decimal number of counts. Any readback/query that generates an error will return a negative number instead of the readback value. Error Codes: -1 -2 -3
Pin not in GPIO mode Invalid pin number Command syntax error
Page 16
7.3
The Machine Command Mode is so named because the data sent and received is in hex or binary, as opposed to the AT Command Mode which is more of a human readable text syntax and format. All non-programmable pins such as power, ground and /RSTI, will read back as 0 and programming commands will have no effect on them. Syntax: All commands are terminated with a linefeed, which is a hexadecimal value of 0x10, also represented by a \n character in C. A carriage return value of 0x13 (or \r) is ignored, so commands may be terminated with \n or \r\n. Command parameters are in hexadecimal format, with the most significant bit (MSB) first.
Return Values Commands to set parameters will return a status value 0 on success, or 1 for a syntax error. Commands that return values will be in format: <status>,<result>, where status is 0 (success) or 1 (syntax error) and the return value is one or more hexadecimal values, depending on the command. Hexadecimal values have the MSB first. Return values are terminated by \r\n.
Command Summary: MGxxxx MG MRxxxx MR MOxxxx MO MH ML MP MQ MT M? GPIO Enable: Set pin configuration, primary function (0) or GPIO mode (1). GPIO Enable Query: Return primary/GPIO pin configuration. GPIO Direction: Set the GPIO pin direction, input (0) or output (1). GPIO Direction Query: Return GPIO pin direction. GPIO Output Set: Set individual GPIO output pins, low (0) or high (1). GPIO Output Query: Return programmed state of all GPIO output pins. Set all GPIO output pins high (1) Set all GPIO output pins low (0) Save current settings as the power-on state Query all A/D and GPIO values Terminate the GPIO command TCP connection Return all GPIO input and output pin values, low (0) or high (1).
Page 17
7.4
7.4.1 Set Pins 14 and 15 to GPIO Outputs MG6000 0 MR6000 0 MO6000 0 MO 0,0x6000 MO4000 0 MO 0,0x4000 M? 0,0x5BCC // Set pin configuration to GPIO mode for both pins // Return value of 0 for success // Set GPIO pin direction to output for both pins. // Return value of 0 for success // Set GPIO output pin value to 1 for both pins // Return value of 0 for success // Query all output pin values // Success, driving outputs high on pins 14, 15 // Set pin 15 low, pin 14 high // Success // Query all output pin values // Pin 15 low, pin 14 high // Query all input and output pins // Pin 15 low, pin 14 high, remaining pins report input value.
7.4.2 Set All GPIO Pins as Inputs and Readback MG7BCC 0 MR0000 0 M? 0,0x3BCC // Set pin configuration to GPIO mode for all GPIO capable pins // Return value of 0 for success // Set GPIO pin direction to input for all pins. // Return value of 0 for success // Read all GPIO input pin values // Return value of 0 for success (note pins are floating inputs on dev. board)
7.4.3 Read A/D Inputs MG03C0 0 MQ // Set pin configuration to A/D primary function for all 4 A/D inputs // Return value of 0 for success // Read A/D inputs
// 0=success, A/D values of pins 7,8,9,10, all GPIO inputs as a 16-bit word 0, 0x4F38, 0x4910, 0x42A0, 0x4FE0, 0x3BCC
Page 18
8. AT Commands
As an alternative to the web page configuration, you can configure the SBL2e over a serial port using an AT command format. The configuration sequence is: 1. Enter command mode 2. Send configuration change commands 3. Save changes and exit The AT command operation is different for configuration commands versus GPIO pin programming commands. Please refer to GPIO Server and Analog to Digital Readback later in this section for additional details. 8.1 Enter and Exit Command Mode AT configuration commands can only be processed when the SBL2e is in AT Command Mode. To enter AT command mode: 1. Pause for 1 second (send no data). 2. Send +++. 3. Wait for 1 second. 4. The device will respond with \r\nOK. To exit command mode: 1. Wait 30 seconds for timeout, any changes will be lost. 2. Send AT&X or ATO to exit and discard any changes. 3. Send AT&P to exit and save new settings. 4. Send AT&F to reset all settings to factory default (does not save). Returns: 1, Returning to active connection 2, Returning to listening connection 3, Returning to active UDP mode 0, Returning to idle Exiting command mode with any changes terminate all existing TCP connections.
Page 19
8.2
Command Syntax
Syntax rules: All white space outside quotations is ignored All commands and queries are terminated by a carriage return <cr> (decimal value 13), if a line feed <lf> follows a <cr>, it will be ignored.
Page 20
8.3
System/Network Configuration
Example: AT#SYSIP=10.1.1.100<cr> #SYS IP=<ip address> MK=<mask ip> GW=<gateway ip> DN=<dns ip> DH=1 // To enable DHCP, set IP to 0.0.0.0. NB=<device name> UN=<string> PW=<string> GS=<enable/disable gpio server> GP=<gpio server listen port> #CUR //Get current active values IP? MK? GW? DN? ST? // Return port status for current port S0? // Return port status for port 0 S1? // Return port status for port 1 Return Values: Connected to IP xx.xx.xx.xx Listening on port xx UDP mode with learned send-to IP Address : xx.xx.xx.xx UDP mode send to Address : xx.xx.xx.xx Idle // 0 = disable, 1 = enable
Page 21
8.4
Example: AT#SER0LN=0<cr> #SERn // n = serial port number, 0, 1 NP=< T|U|L > // network protocol T = tcp, U = udp, L = udp learn SM=<R|D|H|F > // R=RS232, D=debug, H=Half duplex RS485, F=Full duplex RS485 LN=< 0|1 > // 1 = listen for connection 0= dont listen BR=<baud rate > DB=< data bits > // 7, 8 PR=< N|O|E > // none, odd, even ST=< stop bits > // 1, 2 FL=< N|S|H > // none, software or hardware SP=<listen network port number> SD=<disconnect timeout in seconds> SO=<override timeout in seconds> CM=<N|P|R> // outgoing connection mode: never (listen mode only), power-up or upon received serial data CI=<dest ip name/addr> CP=<destination port number> CD=<disconnect timeout in seconds> CR=<retry timeout in seconds>
Page 22
8.4.1 Custom Packetization The custom packetization settings provide control over when serial data is packetized and sent to the destination network host. You can configure the SBL2e to send serial data after a certain number of characters have been received, a certain amount of time has expired, or upon receipt of a specific character. Example: AT#SER0LNPE=1<cr> // enable packetization options
0 = disable packetization, 1 = enable Number of serial characters to accumulate before sending a packet. Number of milliseconds since last character to wait before sending a packet. A value of 0 waits forever. Sends all accumulated serial data upon receipt of the specified ASCII character. The character value must be entered as a hexadecimal number.
PC=<hex char>
Return Values: A ?at the end of the command will return the setting. For example, AT#PE?<cr> will return a value of 0 or 1.
Page 23
8.5 GPIO Server and Analog to Digital Readback In addition to the system and serial configuration, you can also use AT commands to send commands and receive status information from the GPIO Server. For example, you can set pins GPIO pins high or low, or read the analog-to-digital inputs. A very important point to remember when accessing the GPIO and A/D pins is that the operations will occur immediately upon issuing the AT command. The typical sequence of events in this case are: 1. Enter command mode 2. Send configuration change commands 3. Exit command mode with AT&X or ATO to avoid losing any existing TCP serial connections. Example: AT#P07?<cr> or AT#P07M=GPIO<cr> #Pnn #Pn ? =<0|1> M=<mode> M? #PD? #PD=<1|0>
// Where n or nn is the pin number // Read a GPIO or A/D pin, ERR if pin is not a GPIO or A/D. // Write GPIP pin high or low, ERR if not GPIO // Modes: GPIO, RX, TX, RTS, CTS, AD // Return the current mode of the pin // Return the system pin current drive level: 0 = 2mA, 1 = 10mA // Set all pin current drive levels: 0 = 2mA, 1 = 10mA
Page 24
8.6
AT Command Examples
The following examples display the full transcript of serial communication including commands sent and replies from the SBL2e. Commands are marked in red, responses are marked in blue. 8.6.1 Changing the System IP Address This example first queries the current IP address, and then changes the current IP to 10.1.1.79. Once the IP address change request is made, the settings are saved, and the device reboots. +++ OK>AT#CURIP?10.1.1.99 OK>AT#SYSIP=10.1.1.79 OK>AT&PIP Address Changed Rebooting Waiting 2sec(s) to start 'A' to abort
8.6.2 Configuring the Serial Server Listen Port This example first queries the current TCP Serial Server listening port number, and then changes the current port number to 30. Once the port number change request is made, the settings are saved. No system restart was required. +++ OK>AT#SER0SP?23 OK>AT#SER0SP=30 OK>AT&P2,Returning to listening connection
8.6.3 Configure Outgoing Network Client Connection This example changes the client connections IP and port. Once the changes are made, the settings are saved. No system restart was required. +++ OK>AT#SER0CI=10.1.1.78 OK>AT#SER0CP=30 OK>AT&P2,Returning to listening connection
Page 25
8.6.4 Read Analog to Digital Input Channel 1 This example reads the A2D pin 8. The value is immediately returned. +++ OK>AT#P08?2248
8.6.5 Change Pin to GPIO and Set Output to High This example checks the current pin mode, and finds it in a2d channel 1. The mode is then updated to GPIO, and set to high. +++ OK>AT#P08M?AD1 OK>AT#P08M=GPIO OK>AT#P08M?GPIO In=1 OK>AT#P08=1 OK>
Page 26
9. LEDs
Power LED: Illuminated while power is applied. LED1 on RJ-45: Ethernet speed 10 (off) or 100 (on) LED2 on RJ-45: Link and data activity
Page 27
Ethernet Cable
The objective of this example is to use a single host computer running telnet and a serial terminal program to send data in either direction. When you type text in the telnet window, it should appear in the serial terminal window and visa versa. In the following example, an IP Address of 10.1.1.79 is be used for the SBL2e. Replace this IP address with the actual IP Address of your SBL2e.
Page 28
5. In your command prompt window, run Telnet by typing: telnet 10.1.1.79 23 after the prompt, and press the Enter key. The 23 is the network port number of the SBL2e that is listening for incoming connections. This example syntax uses the default value of 23 for SBL2e serial port 0, which is connected to the USB serial interface and to the SBL2e serial port 0. If you have modified the listening network port number in the SBL2e web interface, replace this port number with the listening port number that you assigned.
6. At this point, anything you type in the Telnet window should appear in the serial terminal window and vice versa.
Page 29
Revision History
Revision 1.0 1.1 1.2 1.3 1.4 Date 8/10/2009 12/17/2009 2/22/2010 5/5/2010 Description Internal draft Initial release Added AT command set Clarified description of packetization settings to indicate the settings only apply to the outgoing serial to Ethernet direction. Added machine commands
Page 30