Optional Features

This chapter describes optional features that are not included in the default firmware but can be used by building a project with their modules.

LPD

Line Printer Daemon (LPD) is a printing protocol used for submitting print jobs to a remote printer. After setting the Line protocol to LPD, a device can send a print job using TCP/IP to the gateway, which will then print over the Line using LPD.

For example, to print from a Windows PC to a printer attached to the gateway, add the printer on a Standard TCP/IP port using the gateway's IP address, the LPR (line printer remote) protocol, and a queue name that matches the queue name configured on the gateway. See the Send a print job from a Windows PC using LPD Use Case for an example.

Note

LPD is not included in the default firmware. To use LPD, use the SDK to create a project including the lpd module. See Building Projects for more information. When LPD is included in a project, LPD will appear as a Line protocol choice.

LPD Status

You can view the current connection status of LPD, including the queue name, information on what was last printed, and information on the last and current client.

To view LPD status:

  • In Web Manager, go to LPD and click Status.
  • For CLI, see Status LPD level in the Command Line Interface (CLI) Reference chapter of the XPort EDGE User Guide.

LPD Configuration

To configure LPD:

  • In Web Manager, go to LPD and click Configuration.
  • For CLI, see Config LPD level in the Command Line Interface (CLI) Reference chapter of the XPort EDGE User Guide.
  • For XML, see configgroup LPD in the XML Reference chapter of the XPort EDGE User Guide.
Settings Description
Banner Enables or disables printing of the banner page with the print job.
Binary When enabled, the entire file is passed to the printer. When disabled, only valid ASCII characters and control characters (tab, linefeed, formfeed, backspace, and newline) are passed to the printer.
SOJ Text This is the Start Of Job string sent to the printer at the start of the print job. Non-printable characters must be represented in decimal or hexadecimal and must be enclosed in square braces and separated by commas. To specify an open square brace, use two in a row. For example AB[255,0xFF]C[[D] results in AB..C[D].
EOJ Text This is the End Of Job string sent to the printer at the end of the print job. Non-printable characters must be represented in decimal or hexadecimal and must be enclosed in square braces and separated by commas. To specify an open square brace, use two in a row. For example AB[255,0xFF]C[[D] results in AB..C[D].
Formfeed When enabled, a formfeed will be sent to the printer at the end of each print job.
Convert Newline When enabled, single newlines and single carriage returns will be converted into DOS-style carriage return and linefeed line endings. If carriage return and linefeed characters are already in the correct DOS line-ending order, they will remain unchanged.

Use Case: Send a print job from a Windows PC using LPD

This example sends a print job from a Windows PC to the XPort EDGE gateway using LPD. The instructions have been validated in Windows 10.

Step 1 - Set up the gateway

  1. In Web Manager, go to LPD > Configuration.
  2. Type testQueueName in Queue Name and click Submit.
  3. Click Line > Line 1 > Configuration.
  4. Set Protocol to LPD and click Submit.

Step 2 - Add a printer in Windows

  1. From a Windows 10 PC, open Printers & scanners in Settings.
  2. Click Add a printer or scanner.
  3. Click The printer that I want isn't listed when it appears after a few seconds.
  4. In the Add Printer dialog, select Add a printer using a TCP/IP address or hostname and click Next.
  5. Type the IP address of your XPort EDGE gateway in Hostname or IP address. Uncheck Query the printer and automatically select the driver to use. Click Next.
  6. Under Device Type, select Custom and click Settings.
  7. Set the Protocol to LPR and click OK.
  8. Click Next.
  9. To choose a driver, under Manufacturer select Generic and under Printers select Generic / Text Only. Click Next.
  10. Select Use the driver that is currently installed (recommended). Click Next.
  11. In Printer name, type XPort EDGE.
  12. Choose whether to share the printer and click Next.
  13. A dialog box with the option to print a test page will appear. Leave this dialog box open while continuing to the next step.

Step 3 - Connect using a terminal and view print job

  1. Connect the XPort EDGE gateway to the PC using a serial cable.
  2. On the PC, open a terminal such as Tera Term and connect to the device using serial.
  3. In the Add Printer dialog, click Print a test page and view the test page in the terminal.

Microsoft Azure Integration

Microsoft Azure integration allows the gateway to be used with Microsoft's cloud computing service, Azure. For more information on Microsoft Azure, please see azure.microsoft.com.

To use the gateway with Microsoft Azure, a new device must be created in your IoT Hub in Azure, and Azure IoT state must be enabled on the gateway. Integration can be configured with a SAS Token, which can be generated in Visual Studio Code if Azure IoT Tools is installed, or X.509 credentials. To use Azure over a Line, the Line protocol on the gateway must be set to Azure IoT.

For an example of setting up a device with Azure, please see Application Note: Integrating xPico 200 Series with Microsoft Azure. The procedure is the same on the XPort EDGE.

Note

Microsoft Azure integration is not included in the default firmware. To use Azure, use the SDK to create a project including the azure_iot module. See Building Projects for more information. When Azure is included in a project, Azure IoT will appear as a Line protocol choice.

To configure Azure settings:

  • In the Web Manager, go to Azure IoT and click Configuration.
  • For CLI, see Config Azure Level in the Command Line Interface (CLI) Reference chapter of the XPort EDGE User Guide.
  • For XML, see configgroup Azure in the XML Reference chapter of the XPort EDGE User Guide.
Status Description
State State of the Azure connection. Enabled or Disabled.
Hub Name The name of the Hub created in the Azure portal.
Device ID The Device ID of the device set in the Azure portal.
Security Can be Security Keys or X.509 Certificate.
SAS Token The SAS Token used when Security is set to Security Keys.
Credential Name The name of the credential found in TLS Credentials. This is applicable when Security is set to X.509 Certificate.
MQTT Local Port The MQTT local port to use. Blank the value to use a random port.
Receive Buffer The maximum size of a device message in bytes that can be received from Azure. Do not make the Receive Buffer larger than needed. Doing so may make the device become unstable and crash without sufficient memory. If this happens, consider removing unneeded modules. The tlog will indicate if the Receive Buffer needs to be increased.
Reply Buffer The maximum size of a device reply in bytes that can be sent to Azure. Do not make the Reply Buffer larger than needed. Doing so may make the device become unstable and crash without sufficient memory. If this happens, consider removing unneeded modules. The utility Device Explorer will indicate if the Reply Buffer needs to be increased.

Modbus

Modbus is a serial communications protocol implemented on the gateway over a line with a TCP server. A line must be set to one of the Modbus protocols in order to use Modbus. The XPort EDGE gateway acts as a bridge with a network device operating as Modbus master and the devices connected via serial operating as Modbus slaves. There are four Modbus Input CP roles and four Modbus Output CP roles on the XPort EDGE gateway that can be read or written from the Modbus TCP Master. You will first need to configure the CPs appropriately for the Modbus CP role. For more information on CP roles, see Configurable Pin Roles in the XPort EDGE User Guide. You will need to use a Modbus Master application on your network device to communicate with the gateway and attached Modbus devices.

When the Modbus module is included in firmware, the following configurable pin roles will be found in the Configurable Pin Manager:

Role Name Description
Role Modbus Input 1 Can be read by Modbus TCP.
Role Modbus Input 2 Can be read by Modbus TCP.
Role Modbus Input 3 Can be read by Modbus TCP.
Role Modbus Input 4 Can be read by Modbus TCP.
Role Modbus Output 1 Can be written by Modbus TCP.
Role Modbus Output 2 Can be written by Modbus TCP.
Role Modbus Output 3 Can be written by Modbus TCP.
Role Modbus Output 4 Can be written by Modbus TCP.

Note

Modbus is not included in the default firmware. To use Modbus, use the SDK to create a project including the modbus module. See Building Projects for more information. When Modbus is included in a project, Modbus ASCII and Modbus RTU will appear as Line protocol choices.

The following example uses the modpoll third-party application to read data from the gateway's CPs using Modbus. The gateway responds to address 255:

c:\modpoll-3.6\win>modpoll.exe -t3 -a 255 -r 1 -c 4 -1 -m tcp 172.20.197.120
modpoll 3.6 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2018 proconX Pty Ltd
Visit https://www.modbusdriver.com for Modbus libraries and tools.

Protocol configuration: MODBUS/TCP
Slave configuration...: address = 255, start reference = 1, count = 4
Communication.........: 172.20.197.120, port 502, t/o 1.00 s, poll rate 1000 ms
Data type.............: 16-bit register, input register table

-- Polling slave...
[1]: 1
[2]: 0
[3]: 0
[4]: 0

The following example uses the modpoll third-party application to read from an attached slave device at address 1 using Modbus:

c:\modpoll-3.6\win>modpoll.exe -t 0 -a 1 -r 1 -c 4 -1 -m tcp 172.20.197.120
modpoll 3.6 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2018 proconX Pty Ltd
Visit https://www.modbusdriver.com for Modbus libraries and tools.

Protocol configuration: MODBUS/TCP
Slave configuration...: address = 1, start reference = 1, count = 4
Communication.........: 172.20.197.120, port 502, t/o 1.00 s, poll rate 1000 ms
Data type.............: discrete output (coil)

-- Polling slave...
[1]: 1
[2]: 0
[3]: 1
[4]: 0

Modbus Status

You can view the current connection status of the Modbus server listening on the TCP port.

  • In Web Manager, go to Modbus, click a particular Modbus line, and click Status.
  • For CLI, see Status Modbus level in the Command Line Interface (CLI) Reference chapter of the XPort EDGE User Guide.

Modbus Configuration

The following table describes the Web Manager Modbus configuration settings. Settings can be configured for each available Line on the gateway. To use Modbus TCP to Modbus serial bridge, the TCP Server State needs to be enabled in Modbus Configuration and the appropriate Line must be set to the Modbus RTU or Modbus ASCII protocol.

  • In Web Manager, go to Modbus, click the appropriate line, and click Configuration.
  • For CLI, see Config Modbus level in the Command Line Interface (CLI) Reference chapter of the XPort EDGE User Guide.
  • For XML, see configgroup Modbus in the XML Reference chapter of the XPort EDGE User Guide.
Settings Description
TCP Server State Enables or disables the Modbus TCP server.
Port Sets the TCP server port on which Modbus will accept a connection. Enter 0 for "<None>". The default is 502.
Response Timeout This is the timeout waiting for a response from the slave device in milliseconds. The default is 3000 milliseconds.

Modbus ASCII Protocol

A line protocol can be set to Modbus ASCII. The Modbus ASCII line provides a mode to bridge from a Modbus TCP Master on the network side to Modbus ASCII devices with checksum.

In order to select this operating mode, set the line protocol for the selected interface to "Modbus ASCII" and the threshold to 513 bytes. The TCP Server State must be enabled for a line instance in the Modbus settings before assigning that line instance a Modbus protocol.

To configure Modbus settings:

  • In the Web Manager, go to Modbus, click a particular line, and click Configuration.
  • For CLI, see Config Modbus Level in the Command Line Interface (CLI) Reference chapter of the XPort EDGE User Guide.
  • For XML, see configgroup Modbus in the XML Reference chapter of the XPort EDGE User Guide.

To configure the Line operating mode:

  • In the Web Manager, go to Line, click a particular line, and click Configuration. Next to Protocol, select "Modbus ASCII.” Next to Threshold, enter "513". Click Submit.
  • For CLI, see Config Line Level in the Command Line Interface (CLI) Reference chapter of the XPort EDGE User Guide.
  • For XML, see configgroup Line in the XML Reference chapter of the XPort EDGE User Guide.

Modbus RTU Protocol

A line protocol can be set to Modbus RTU. The Modbus RTU line provides a mode to bridge from a Modbus TCP Master on the network side to Modbus RTU devices with CRC.

In order to select this operating mode, set the line protocol for the selected interface to "Modbus RTU" and the threshold to 513 bytes. The TCP Server State must be enabled for a line instance in the Modbus settings before assigning that line instance a Modbus protocol.

To configure Modbus settings:

  • In the Web Manager, go to Modbus, click a particular line, and click Configuration.
  • For CLI, see Config Modbus Level in the Command Line Interface (CLI) Reference chapter of the XPort EDGE User Guide.
  • For XML, see configgroup Modbus in the XML Reference chapter of the XPort EDGE User Guide.

To configure the Line operating mode:

  • In the Web Manager, go to Line, click a particular line, and click Configuration. Next to Protocol, select "Modbus RTU.” Next to Threshold, enter "513". Click Submit.
  • For CLI, see Config Line Level in the Command Line Interface (CLI) Reference chapter of the XPort EDGE User Guide.
  • For XML, see configgroup Line in the XML Reference chapter of the XPort EDGE User Guide.

SNMP

The Simple Network Management Protocol v2 (SNMP) agent allows devices to query the gateway for information or to configure that information. The Lantronix SNMP agent supports responding to RFC MIBs and custom MIBs, and sending notifications (traps). With traps enabled, the gateway will send notifications to the specified destination for the following events: when the gateway is powered on, its network link is established, or its network link is disabled.

The Lantronix SNMP agent may be extended to support distributed MIBs loaded into the host processor rather than requiring customized agent code to be loaded into the XPort EDGE firmware.

The SNMP module is not present in the standard build. The application developer may either

  1. add the SNMP module to the build and write their own agent code to be built into the XPort EDGE device, or
  2. add the SNMP module to the build, and use the built-in extended agent feature to communicate with their agent in an external device.

For details on how to configure and demonstrate the SNMP extended agent feature, see Application Note: Configuring the SNMP Extended Agent for xPico 200 Series and XPort EDGE. The application note may be downloaded from the Lantronix application notes web page.

Note

SNMP is not included in the default firmware. To use SNMP, use the SDK to create a project including the snmp module. See Building Projects for more information.

SNMP Status

You can view the current status of the SNMP Agent, the System Name, and the System Description.

  • In Web Manager, go to SNMP and click Status.
  • For CLI, see Config SNMP level in the Command Line Interface (CLI) Reference chapter of the XPort EDGE User Guide.

SNMP Configuration

To configure SNMP:

  • In Web Manager, go to SNMP > Configuration.
  • For CLI, see Config SNMP Level in the Command Line Interface (CLI) Reference chapter of the XPort EDGE User Guide.
  • For XML, see configgroup SNMP in the XML Reference chapter of the XPort EDGE User Guide.
Settings Description
State Enable or disable the SNMP Agent.
Listen Network Select eth0 to listen for SNMP requests.
Community Read Specify the community used to read SNMP data. The default is public. May contain up to 64 characters.
Community Write Specify the community used to write SNMP data. The default is private. May contain up to 64 characters.
System Contact Specify the system contact. May contain up to 64 characters.
System Name Specify the system name. The default is the gateway model. May contain up to 64 characters.
System Description Specify the system description. The default is the gateway model, firmware version, and serial number. May contain up to 64 characters.
System Location Specify the system location. May contain up to 64 characters.
(Traps) State Enable or disable traps. When traps are enabled, the gateway will send notifications to the destinations specified below when the gateway is powered on, its network link is established, or its network link is disabled.
Primary Destination Specify the IP address of the primary destination to notify.
Secondary Destination Specify the IP address of the secondary destination to notify, used when the primary destination is unreachable.
Extended Agent IP Address Specify the IP address of the extended agent. May contain up to 31 characters.
Extended Agent Port This enables the SNMP extended agent to connect to the loopback interface with the specified port.
Blank the value for “<None>”.
By default, the extended agent is disabled.