550 564 06

 

 

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

RegNo.

Identifier

Memory type

Read out

Type

0

 

 

 

 

1

 

 

 

 

2

IPState

RAM ReadWrite

--------

Record

3

SpecialFeatures

EEPROM RPW

--------

Record

4

 

 

 

 

5

NodeParam

EEPROM RPW

--------

Record

6

IPNetTable

Flash ReadWrite

--------

Record

7

Retries

EEPROM RPW

Decimal

Byte

8

 

 

 

 

9

 

 

 

 

10

 

 

 

 

11

 

 

 

 

12

PasswordTable

EEPROM RPW

(Partly WriteOnly)

--------

Record

13

 

 

 

 

14

ChType

PROM ReadOnly

--------

Record

15

ChError

RAM ReadOnly

--------

Record

 

 


 

RegNo. 2: IPState

This variable is a record having the following structure:

 

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

 

IPErrorsType = Record

 

IPTableFull:

LongInteger;

 

NoFreeCtrl:

LongInteger;

 

NoFreeBuffers:

LongInteger;

 

TransmitErrors:

LongInteger;

 

NIC:

LongInteger;

 

Overrun:

LongInteger;

 

Other:

LongInteger;

 

MissedFrames:

LongInteger;

 

Collisions:

LongInteger;

End;

 

IPState: Record

 

IPAddr:

IPAddrType;

 

MACAddr:

Array[1..6] of Byte;

 

ReceivedPackets:

LongInteger;

 

SentPackets:

LongInteger;

 

Errors:

IPErrorsType;

 

LineState:

Bit16; (From version 2.0)

End;

 

 

 

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.

 

 

RegNo. 3: SpecialFeatures

This variable is a record having the following structure:

 

SpecialFeatures: Record     

(* Factory setting *)

 

Flags:              

Bit8;

(* All False *)

 

WLAN_UpdateInterval:

Byte;

(* 0 (seconds) *)

 

Reserved:           

Integer;

(* 0 *)

 

MaxResponseTime:     

Real;

(* 2.0 (seconds) *)

End;

 

SpecialFeatures is used to define special functions for the communication channel.

The Reserved parameter may not be changed.

 

Flags

 

SpecialFeatures.Flags

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

 

 

No write access

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

No access

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Full duplex on Ethernet

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

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).

 

 

RegNo. 5: NodeParam

This variable is a record having the following structure:

 

NodeParam: Record

(* Factory setting *)

 

PNETNo:         

Byte;

(* 0 *)

 

NotUsed:        

Byte;

(* 0 *)

 

IPAddr:         

IPAddrType;

(* 172.17.17.0 *)

End;

 

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.

 

RegNo. 6: IPNetTable

 

IPNettypeType = (IPUnUsed, IPRange, UDPRangeRecord)

 

IPNetTableElement = Record

 

IPAddress:    

IPAddrType;

 

UDPPort:       

Word;

 

UsePassword:

Boolean;

 

Router:

Byte;

 

IPNettype:

IPNettypeType;

End;

 

IPNetTable: Record (* Factory setting: $FFFF *)

 

NoOfIPNets:

Integer;

 

IPNets:

Array[1..124] of IPNetTableElement;

End;

 

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.

 

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.

 

RegNo. 12: PasswordTable

 

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

 

PasswordTable: Record

(* Factory setting *)

 

Checksum:        Word;

(* 0 *)

 

ClientPassword:  PWType;

(* 0 *)

 

NoOfPasswords:   Integer;

(* 0 *)

 

Passwords: Array[1..20] of PWType;

(* 0 *)

End;

 

Checksum

Checksum holds the value obtained by adding (on a word-by-word basis), all the following fields in this register (85 words). This facility has been introduced to enable a password configuration tool to check whether a new configuration was stored correctly. This is not possible by reading back the actual passwords, as these fields are “WriteOnly”.

 

ClientPassword

This field holds the password used by this node when acting as a client, and sending a request to a server that requires a password. Whether a server requires a password or not, is defined in ServerTable.

 

NoOfPasswords

NoOfPasswords holds the actual number of passwords in the Passwords field. This field has been introduced to reduce the amount of time used for password checking in the operating system.

 

Passwords

The Passwords field holds all the acceptable passwords that can be used when this node is acting as a server, and is accessed using the remote communication UDP Port number. A P-NET UDP packet to this UDP Port must hold a password. When a request is received, a search is made (by the operating system) through the Passwords. If a match is found between the password in the received packet and an element in the Passwords field, the request is accepted. If not, the request is ignored.

 

To prevent users with access to this device from reading the passwords of other users, this variable is “WriteOnly”. The Checksum field can be used to ensure, that the password configuration is correct.

 

 

RegNo. 14: ChType

This variable is a record having the following structure:

 

ChType: Record

 

ChannelType:         Word;

 

Exist:               Bit16;

End;

 

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  =

Bit no

15

 

 

 

 

 

 

7

 

 

 

 

 

 

0

Value

1

1

0

1

0

0

0

0

1

1

1

0

1

1

0

0

 

 

RegNo. 15: ChError

This variable is a record having the following structure:

 

ChError: Record   

 

His:                  Bit8;

 

Act:                  Bit8;

End;

 

 

ChError for Ethernet Communication channel

 

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

 

 

Hardware initialisation error

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

IP Address conflict

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Device error

 

 

 

 

 

 

 

 

 

 

 

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.