Ethernet#

This section describes the Ethernet specific communication with an iLCD controller. Please read the “iLCD Commands” documentation available from http://www.demmel.com/download/ilcd/ilcd-color-commands.pdf to learn about how to send commands to iLCD panels first.

iLCDs with the DPC3080, DPC3090 and DPM5050 controller have the possibility to communicate via Ethernet with an additional Ethernet-Add-on-Board (DPA-TCPIP). iLCDs with DPC3050 or other controllers do not support Ethernet!

For more information about the Ethernet-Add-on-Board DPA-TCPIP, please have a look at the specification.(Ethernet Expansion Board)

To control the iLCD the protocol TCP with the port 54131 is used. For security reasons it is possible to protect the connection with a password. You can choose different password modes, which are configurable with the iLCD Manager. (refer to Setting Up the iLCD Panel for Ethernet Communication)

Sample code is available at: http://www.demmel.com/download/ilcd/iloader.zip

Note

Please ensure your iLCD controller firmware has a version greater or equal version 2.02 for using the Ethernet functionality, earlier versions don’t support Ethernet or showed misbehavior of the Ethernet functionality under certain circumstances.

Detecting Devices (UDP broadcast)#

If you send a UDP package with the magic number 0x636c7064 to port 54131, it responses with some basic information in form of a structure. Be aware that the LSB is sent first, so the send sequence is { 0x64, 0x70, 0x6c, 0x63 }.

#define FW_VERS_LEN	6
#define CHIP_NAME_LEN 	8
#define SERIAL_NUM_LEN 	24
#define MAGIC_NUMBER	0x636c7064
PACK_STRUCT_BEGIN
typedef struct
{
  dword magic_no;				// 0x636c7064
  byte struct_vers;				// 0x01
  byte struct_len;				// length of structure	
  byte hardware_revision;			// in BCD
  char chip_name[CHIP_NAME_LEN];			// name of chip (e.g. "DPC3080")
  char fw_version[FW_VERS_LEN];			// firmware version (e.g. "2.04")
  char serno[SERIAL_NUM_LEN];			// serial number
  byte pw_mode;					// password mode (0x00 - 0x03)
} tcp_info_1_t;

Structure version 1 (tcp_info_1_t) is used with firmware version older than 2.10.

typedef struct
{
  dword magic_no;				// 0x636c7064
  byte struct_vers;				// 0x02
  byte struct_len;				// length of structure	
  byte hardware_revision;			// in BCD
  char chip_name[CHIP_NAME_LEN];		// name of chip (e.g. "DPC3080")
  char fw_version[FW_VERS_LEN];			// firmware version (e.g. "2.04")
  char serno[SERIAL_NUM_LEN];			// serial number
  byte pw_mode;					// password mode (0x00 - 0x03)
  dword restricted_ip;				// ip to which the iLCD is restricted
    							// if 0 the iLCD is not restricted
  dword connected_ip;				// ip to which the iLCD is currently connected
      							// if 0 the iLCD is not connected
   } tcp_info_2_t;				

Structure version 2 (tcp_info_2_t) is used with firmware version 2.10 and newer.

If you send an UDP broadcast, which means sending the magic number to the IP address 255.255.255.255, every iLCD in the subnet will response. That’s an easy way to detect iLCDs in a network. Normally it’s only possible in a subnet because most routers are blocking UDP broadcasts across subnets.

General Information about the TCP connection#

  • For the UDP and TCP connection port 54131 is used. Make sure that your firewall doesn’t block this port.

  • It’s not possible to simultaneously have more than one TCP connection. If someone successfully connects (with the right password) to the iLCD, the old connection will be closed. Therefore be careful, if someone else connects to the iLCD.

  • If a TCP connection is not needed anymore, it is recommended to close the connection.

  • If the restricted IP address of the iLCD is different from yours, it’s not possible to connect to the iLCD. (If 2 or more people are working with multiple iLCDs this feature is very useful.)

  • For debugging your software the free tool Wireshark is useful. http://www.wireshark.org/

Starting a TCP connection (without password)#

If you have no password mode specified with the setup software, connecting to the device is very simple:

  • First of all connect to the iLCD with a typical 3-way handshake. Therefore you need the IP address of the iLCD. If you don’t know it, you can get the IP address of the device via a UDP broadcast. (refer to “Detecting Devices (UDP broadcast)”)

  • After a successful 3-way handshake the iLCD sends 2 byte, the startup sequence, which is ‘#’ and ACK (0x06).

  • Now it is possible to send iLCD commands to the iLCD.

Starting a TCP connection (with password)#

If you want to use a password, there are 3 different password modes:

  1. plain text: The password is transferred in plain text. It’s the simplest method, but everyone who has access to the network can see the password with a packet analyzer.

  2. CRC32: A challenge response method is used. Therefore the password is not transferred in plain text. This method doesn’t need much calculation time but is also not very secure.

  3. MD5: A challenge response method is used. Therefore the password is not transferred in plain text. It’s the most secure mode, but also needs the most calculation time.

If you have specified a password mode and a password with the setup software, the procedure is the following:

  • First of all connect to the iLCD with a typical 3-way handshake. Therefore you need the IP address of the iLCD. If you don’t know it, you can get the IP address of the device via a UDP broadcast. (refer to “Detecting Devices (UDP broadcast)”)

  • After a successful 3-way handshake the device sends 3 or 19 bytes: ‘$’, password mode (0x01 - 0x03), 16 byte challenge, ACK (0x06) The device only sends the challenge in case of the password modes CRC32 and MD5.

  • Then you have to send the right password or the right hash. It’s important to note that if you don’t send the password / hash after 200 seconds the connection will automatically be closed. Therefore it’s recommended to ask the user for a password before you start a connection.

    • In case of plain text mode you have to send: CIN (0xAA), ‘$’, password mode (0x01), password string terminated with null character (0x00)

    • In case of CRC32 mode you have to send: CIN (0xAA), ‘$’, password mode (0x02), 4 byte CRC32 hash The 4 byte CRC32 hash is calculated over the 16 byte challenge and then over the password Attention! If one byte equals 0xAA, you have to quote it. That means you have to send it twice. E.g. If you have a CRC32 of 0x23, 0x93, 0xAA, 0xC5, you have to send 5 bytes: 0x23, 0x93, 0xAA, 0xAA, 0xC5.

    • In case of MD5 mode you have to send: CIN (0xAA), ‘$’, password mode (0x03), 16 byte MD5 hash The 16 byte MD5 hash is calculated over the 16 byte challenge and then over the password. Attention! If one byte equals 0xAA, you have to quote it. That means you have to send it twice.

  • If the password or the hash is right, the device sends an ACK (0x06) and the startup message: ‘#’, ACK (0x06). If the password or the hash is wrong, the device sends a NACK (0x15).

  • If you have successfully connected, you can send commands to the iLCD.

For better explanation here you can see a state machine:

HTTP#

The iLCD device has a built in http server on port 80. If you go to the IP address of the device with a web browser you will see a page with information about the device.

Ethernet on iLCD in Real-Life#

Setting Up the iLCD Panel for Ethernet Communication#

On the “Settings” page of the iLCD Manager XE, enable the “TCP/IP Settings” and “TCP/IP” checkbox.

It is also possible to use DHCP. With DHCP enabled you need a DHCP server in the network, which automatically assigns an IP address. Otherwise you have to specify the IP Address, the Standard Gateway and the Subnet Mask manually according to your needs.

With the Access IP address you can restrict the access via TCP to only one IP address. If the Access IP address is set to 0.0.0.0 all IP addresses can access the iLCD.

Another feature is to restrict the device with a password. Therefore you have to specify the password mode and the password. The password has to be at least 4 characters and maximum 16 characters.

If you have changed any values you want to update, don’t forget to check Update above values in Flash memory when writing data.