Profinet (In Development)
The PROFINET driver implements a class 3 real time controller. Which is able to communicate with multiple devices on the same network segment.
Connection String Options
On linux as the Java executable won’t have permission to capture raw packets, this needs to be enabled via:-
sudo setcap cap_net_raw,cap_net_admin=eip /usr/lib/jvm/jdk-19/bin/java
The executable will change based on the jdk and OS you are using.
Name |
Type |
Default Value |
Required |
Description |
Name |
Profinet |
|||
Code |
|
|||
Maven Dependency |
<dependency> <groupId>org.apache.plc4x</groupId> <artifactId>plc4j-driver-profinet-ng</artifactId> <version>pre-release</version> </dependency> |
|||
Default Transport |
|
|||
Supported Transports |
|
|||
Config options: |
||||
|
STRING |
~/.gsd |
required |
|
|
STRING |
|||
|
STRING |
|||
Transport config options: |
||||
raw-socket |
||||
|
STRING |
Network interface name to use (e.g., "eth0", "en0", "\\Device\\NPF_{GUID}" on Windows). If not specified, will use the first available interface. |
||
|
STRING |
Local MAC address to send from. If not set, uses interface’s MAC address. |
||
|
STRING |
required |
Remote MAC address to send to. |
|
|
INT |
required |
EtherType / Protocol number (e.g., 0x88B5 for PROFINET, 0x88CC for LLDP, custom values) |
|
|
BOOLEAN |
false |
Promiscuous mode - capture all packets on the network, not just those destined for this interface. |
|
|
INT |
1000 |
Packet capture timeout in milliseconds. |
|
|
INT |
65536 |
Snapshot length - maximum bytes to capture per packet. 0 means capture entire packet. |
|
|
INT |
1048576 |
Buffer size for packet capture in bytes. |
|
|
INT |
0 |
VLAN ID (0 means no VLAN tag). Range: 0-4095 |
|
|
INT |
0 |
VLAN priority (0-7). Only used if vlanId > 0. |
|
|
BOOLEAN |
false |
Reuse the underlying network interface across multiple transport instances. When true, instances with the same interface and protocol will share a pcap handle. This is useful for protocols where multiple logical connections share one Ethernet type. |
|
|
STRING |
BPF (Berkeley Packet Filter) expression to filter packets. |
||
|
INT |
1500 |
Maximum frame size (MTU) in bytes. |
|
|
INT |
0 |
Read timeout for blocking reads in milliseconds. |
|
|
BOOLEAN |
false |
Deliver full Ethernet frames to the driver and accept raw Ethernet frames on send. Required for L2 protocols that build their own Ethernet headers. |
|
| Name | Value | Description |
|---|---|---|
Supported Operations |
||
|
Only the subscription service is currently supported. |
|
Connection String
The Profinet driver uses the connection string
profinet:raw://{ip-address}:{port}?{options}
Where the {ip-address}, unlike other PLC4X driver, uses the local IP address of the network interface you would like to bind to. This allows us to connect to multiple devices at once via the devices parameter.
An example of this connection string which has two devices test-device-1 and test-device-2, connected on the localhost interface would be:-
profinet:raw://127.0.0.1?gsddirectory=/Profinet/GSD&devices=[[test-device-1,MOD_1,(SUBMOD_1,,SUBMOD_1,)],[test-device-2,MOD_1,(SUBMOD_1,,SUBMOD_1,)]]
Note the transport, port fields shouldn’t have to be changed
Address Format
The format of address will be in the format.
device.slot.id.module_name.channel.bit:format
An example would be
device-1.1.1.DIGITAL_INPUT.0.1:BOOL
Note:-
Data Types
The following data types are supported
-
BOOL (boolean)
-
SINT (int 8)
-
USINT (uint 8)
-
BYTE (uint 8)
-
INT (int 16)
-
UINT (uint 16)
-
WORD (uint 16)
-
DINT (int 32)
-
UDINT (uint 32)
-
DWORD (uint 32)
-
LINT (int 64)
-
ULINT (uint 64)
-
LWORD (uint 64)
-
REAL (float)
-
LREAL (double)
-
CHAR (char)
-
WCHAR (2 byte char)
-
STRING (utf-8)
-
WSTRING (utf-16)
Some useful tips
Although the GSD file contains all the information needed to configure which data will be available from a device. The easiest approach is to use the browsing function of the Profinet driver to return a list of all available tags. Then only the addresses of interest can be selected.