UDP/IP Ethernet Communication Channel

 
The function of a communication channel is to provide a mechanism for transferring data externally using different electrical standards to form a communication Port. The actual electrical interface is achieved by means of hardware, but the channel registers provide the user with facilities for selecting transfer timings and format, and for reading and writing data.

A UDP/IP Ethernet Communication channel can be used for transferring P-NET packets over an Ethernet network. The P-NET packets are wrapped into UDP packets.

For a UDP/IP Ethernet device, one channel is used for Ethernet data transfer, for local as well as for remote communication. ‘Local’ means communication within a local, secure IP network, whereas ‘remote’ means communication outside the secure IP network, typically on the Internet, through NAT routers. A default UDP Port number (34378) is reserved for local communication, and another (34379) for remote. All remote P-NET communication must include a password, to protect the device from unauthorized access. The network administrator should set up the NAT router to transfer packets to the remote communication UDP Port only. If this is done, only P-NET packets including a correct password will be accepted if they come from the NAT router, whereas P-NET packets from the local, secure IP network are accepted without password.

In general, it is recommended to use only a switched network, to reduce collisions, and to eliminate the time taken by P-NET nodes for rejecting packets intended for other nodes in a network. To completely avoid collisions, select Full Duplex. As auto negotiation to 10 MBit, Full Duplex is not possible, managed switches must be used, and manually configured.

Furthermore, it is recommended to use a separate IP subnet for P-NET nodes. P-NET devices with a UDP/IP Ethernet Communication Channel are set up to the default IP subnet address 172.17.17.xx. The subnet mask is fixed at 255.255.255.0. There are two ways of enabling a PC to communicate on this subnet: Either in the Advanced TCP/IP setup window in the control panel, add a new IP address (for example 172.17.17.10), or set up a local router to route packets to subnet 172.17.17.xx. Any other subnet address can be used, and is easily configured by means of the “Set P-NET Node Address” feature in VIGO.

Every server in a P-NET UDP/IP network must have a fixed IP address, and does not use DHCP. Normally, P-NET devices with a UDP/IP Ethernet Communication Channel have the IP address 172.17.17.NA, where NA is the P-NET Node Address. When the P-NET Node Address is set (for example by means of the Set P-NET Node Address utility in VIGO), the complete IP address is automatically set too. The P-NET Node address of a server can be in the interval 1..125. 0 is illegal, and 126 and 127 are used for netcast (broadcast within IP subnet).

A NetIndex and a NodeAddress form the address of a node in a P-NET UDP/IP network. The NetIndex selects the subnet, to which the node is logically connected, and the NodeAddress selects the node on that net. Up to 124 different subnets can be configured in the IPNetTable of the Ethernet communication channel. Subnet number 125 is reserved for dynamic client nodes. A subnet can be of type IPRange or UDPRange.

On an IPRange subnet, the first 3 bytes of the IP address come from the IPNetTable entry selected by the NetIndex, and the last byte from the NodeAddress. Example: IPNetTable[24] is an IPRange subnet, with IP address 172.18.19.00. The server logically connected to this subnet, with NodeAddress 12 is addressed with NetIndex = 24, NodeAddress = 12. IPRange subnets are used for direct addressing of nodes, without going through NAT routers. The same UDP port number is used to address all nodes on the same IPRange subnet. The UDP port number is defined in the IPNetTable. The value is typically 34378.

On a UDPRange network, the complete IP address comes from the IPNetTable entry selected by the NetIndex. The NodeAddress is added to the UDPPort defined in the IPNetTable entry. This configuration is used to access nodes on a remote network, through a NAT router. The IPAddress of the UDPRange subnet is the IPAddress exposed to the Internet by the remote NAT router. The router must be configured to translate the incoming UDP port number into the IPAddress of the node to be accessed, and to UDP port number 34379. A separate UDPRange subnet must be used for each remote network to be accessed.

Variables in a UDP/IP Ethernet Communication Channel

RegNoIdentifierMemory TypeRead OutType
0
1
2IPStateRAM ReadWrite_ _ _ _ _ _Record
3SpecialFeaturesEEPROM RPW_ _ _ _ _ _Record
4
5NodeParamEEPROM RPW_ _ _ _ _ _Record
6IPNetTableFlash ReadWrite_ _ _ _ _ _Record
7RetriesEEPROM RPWDecimalByte
8
9
10
11
12PasswordTableEEPROM RPW (Partly WriteOnly)_ _ _ _ _ _Record
13
14ChTypePROM RPW ReadOnly_ _ _ _ _ _Record
15ChErrorRAM ReadOnly_ _ _ _ _ _Record

[sta_anchor id=”Reg2″]

RegNo 2: IPState

This variable is a record having the following structure:

IPAddrType = Array[1..4] of Byte;

IPErrorsType = Record   
   IPTableFull:
   NoFreeCtrl:
   NoFreeBuffers:
   TransmitErrors:
   NIC:
   Overrun:
   Other:
   MissedFrames:
   Collisions:
End;

 


LongInteger
LongInteger
LongInteger
LongInteger
LongInteger
LongInteger
LongInteger
LongInteger
LongInteger

IPState: Record
   IPAddr:
   MACAddr:
   ReceivedPackets:
   SentPackets:
   Errors:
   LineState:
End;


IPAddrType;
Array[1..6] of Byte;
LongInteger;
LongInteger;
IPErrorsType;
Bit16; (From version 2.0)

IPState holds the actual parameters for the communication channel, and statistics information.

IPAddr
Holds the IP address of this node. The IP address is defined in RegNo. 5: NodeParam. It can be changed using the “Set P-NET Node Address” utility in VIGO.

MACAddr
MACAddr holds the Ethernet MAC address of this node. The MAC address is fixed.

ReceivedPackets, SentPackets
The values of ReceivedPackets and SentPackets hold the number of UDP/IP packets received and sent respectively. The values are cleared following a master reset.

Errors
This record holds counters for different error situations. The name of each counter indicates the type of error. The counters are cleared following a master reset.

LineState
This field holds the actual state of the Ethernet connection. Bit15 indicates, whether the link signal is present (True) or not (False). The information is automatically updated once pr. second. This field was introduced in version 2.0.

 

[sta_anchor id=”Reg3″]

RegNo. 3: SpecialFeatures

This variable is a record having the following structure:

SpecialFeatures: Record
   Flags:                          Bit8;
   WLAN_UpdateInterval: Byte;
   Reserved:                    Integer;
   MaxResponseTime:       Real;
End;

(* Factory setting *)
(* All False *)
(* 0 (seconds) *)
(* 0 *)
(* 2.0 (seconds) *)

SpecialFeatures is used to define special functions for the communication channel. The Reserved parameter may not be changed.

Flags

Following a Master reset, the device will act as if all flags were false.

Bit 0
If No write access is True, it means that no P-NET write requests are legal on this port. Any P-NET request holding one of the instructions STORE, AND, OR, TAS or LONGSTORE will result in a “Write protection” response. This goes for all requests, whether they are requests for this device, or gateway requests.

Bit 1
If No access is True, it means that no P-NET requests are legal on this port. In other words, this port only works as a P-NET master. Any P-NET slave request will result in a “Write protection” response. This goes for all requests, whether they are requests for this device, or gateway requests.

Bit 2
Not used

Bit 3
Not used

Bit 4
This flag was introduced in version 1.14.
If Full duplex on Ethernet is True, the full duplex Ethernet configuration will be selected. As the PD 602 cannot auto negotiate duplex mode, switches and other Ethernet equipment will not be able to automatically detect that this device is running in full duplex mode. Therefore, Full duplex on Ethernet should only be selected if the switch to which this device is connected is a managed switch, and configured to run at 10 Mbits/sec full duplex. Hubs can never run in full duplex mode.
If Full duplex on Ethernet is False, half duplex is selected.

Bit 5
Not used

Bit 6
Not used

Bit 7
Not used

WLAN_UpdateInterval
Devices connected to a Wireless LAN might have to send out their MAC address in an Arp packet on a periodic basis, to keep the radio modules updated with the actual network configuration. This can be achieved by inserting a non-zero value in this variable. The value defines the time interval in seconds between transmissions of Arp packets.

MaxResponseTime
The value of this variable defines for how many seconds this device should wait for a response after sending a request. If no response is received within the specified time, the P-NET error “TIME OUT” is generated (or the request is retransmitted if Retries > 0).

[sta_anchor id=”Reg5″]

RegNo. 5: NodeParam

This variable is a record having the following structure:

NodeParam:                 Record
   PNETNO:                      Bit8;
   NotUsed:                      Byte;
   IPAddr:                        IPAddrType;
End;

(* Factory setting *)
(* 0 *)
(* 0 *)
(* 172.17.17.0 *)

PNETNo
The field PNETNo holds the P-NET node address of this device, seen from the Ethernet port. The P-NET Node Address is also the last byte of the IP Address. Each time the Node Address is changed, the value of IPAddr is also changed.

The value of the field PNETNo may also be changed via Service.PNETSerialNo, for example, by using the “Set P-NET Node Address” utility in VIGO. This will result in a netcast, where the first 3 bytes of the destination IP address is the subnet address, and the value of the last byte = 255. The P-NET packet holds the serial number of the device, and the new PNETNo. The value of PNETNo is transferred to the EEPROM, regardless of the state of Service.WriteEnable, as is the value of IPAddr. The first 3 bytes of IPAddr is set to the first 3 bytes of the destination IP address of the netcast UDP/IP packet. The last byte of IPAddr is set to the same value as PNETNo.

IPAddr
This field holds the IP Address of this node. The default value is 172.17.17.0, which is an illegal IP Address. At least the last byte should be changed. Changing the value of PNETNo will do this. As the last byte of the IP Address is the same as PNETNo, it is NOT possible to change this byte by writing to IPAddr. Refer to the description of PNETNo for information on how the value of IPAddr is typically changed.

[sta_anchor id=”Reg6″]

RegNo. 6: IPNetTable

IPNettypeType = 

IPNetTableElement =
   IPAddress:
   UDPPort:
   UsePassword:
   Router:
   IPNettype:
End;

IPNetTable: Record    
   NoOfIPNets:
   IPNets:
   IPNetTableElement;
End;

(IPUnUsed, IPRange, UDPRangeRecord)

Record
IPAddrType;
Word;
Boolean;
Byte;
IPNettypeType;
End;

(* Factory setting: $FFFF *)
Integer;
Array[1..124] of IPNetTableElement;

This variable holds a list of all the subnets that can be accessed from this
node when it is acting as a master (client). A configuration tool is normally used to configure the table.

Refer to the general ” UDP/IP Ethernet Communication Channel” description for an overview of the purpose of this table.

By default, all fields in this table hold $FFFF. A value of $FFFF or 0 in NoOfIPNets indicates, that the table has not been initialised by any configuration tool. In this situation, a default subnet with NetIndex = 1 is set up as an IPRange net, with the same subnet address as the subnet address of this node, and with UDP port number = 34378.

This means, that from PROCESS-PASCAL, all IP nodes on the same subnet can be accessed with NetIndex = 1, and NodeAddress = the P-NET node address of the node. It also means, that the gateway functionality of P-NET systems is fully supported by P-NET over IP, without any further configuration.

IPAddress
The IPAddress field holds the IP subnet address, if the net is an IPRange net, or the complete IP address of the remote NAT router if, the net is a UDPRange net.

UDPPort
The UDPPort field holds the UDP port number sent to all nodes, if the net is an IPRange net, or the start UDP port number, if the net is a UDPRange net.

Router
The Router field holds the node address of the router through which requests to nodes on this subnet are to be sent. Routers are always located on the same subnet as this device. If the nodes on a subnet are accessed directly, the value of Router must be = 0.

IPNettype
The IPNettype field defines the type of this subnet. The value of this field can be UnUsed, IPRange or UDPRange.

[sta_anchor id=”Reg7″]

RegNo. 7: Retries

   Retries:                      Byte;

(* Factory setting: 0 *)

This register defines the maximum number of retries made in the event of a transmission error, before the error is reported. The defined maximum number of retries is for each 54 byte block in a LONG LOAD / STORE. Therefore, the value of Retries should be very low.

[sta_anchor id=”Reg12″]

[sta_anchor id=”Reg12″]

RegNo. 12: PasswordTable

PWType = Array[1..8] of Byte;

PasswordTable:             Record
   Checksum:                     Word ;
   ClientPassword:              PWType ;
   NoOfPasswords:              Integer:
   Passwords: Array[1..20] of PWType;
End;

 

(* Factory setting *)
(* 0 *)
(* 0 *)
(* 0 *)
(* 0 *)

[sta_anchor id=”Reg14″]

RegNo. 14: ChType

This variable is a record having the following structure:

ChType: Record
   ChannelType:
   Exist:
End;


Word;
Bit16;

The ChType variable indicates what type of channel this is, how many channel registers are used, and what functions this channel offers.

ChType has the following values:

ChannelType = 17 (Ethernet Communication Channel)

Exist =

[sta_anchor id=”Reg15″]

RegNo. 15: ChError

This variable is a record having the following structure:

ChError: Record
   His:
   Act:
End;

Bit8;
Bit8;

[sta_anchor id=”Reg15″]

Bit 7
Device error. If this bit is set, the rest of the bits have no meaning because a device error can cause random error codes on the individual channels (see also “Service channel”).

Bit 4
IP Address conflict. If this bit is set, two different MAC addresses have been detected for the same IP address. That means, two different nodes have the same IP address.

Bit 0
Hardware initialisation error is generated when initialisation of the built-in Ethernet communication chip fails.