This repository is a port of the open-source P-Net evaluation version to RT-Thread, used for implementing the P-Net protocol stack for Profinet devices.
Open the bsp's env interface, go to ->RT-Thread online packages->IoT, and find [*] P-Net stack for Profinet device implementation ---> to enable it. Also, leave configurations for the user:
-*- Default netif name for P-NET --->
-> (e00) default ethernet interface name for p-net app, default as 'e00'
-*- Enable P-NET sample board config --->
-> (0x0209) p-net user led pin
-> (0x0005) p-net user key pin
-*- Default root filesystem path for P-NET --->
-> [*] p-net using ramfs filesystem by default, or you can turn this off and choose another way to enable the filesystem
-> (8192) default memory size for ramfs
-*- P-NET sample slave network ip config --->
-> (192.168.137.196) set static ip address for Profinet slave
-> (192.168.137.1) set static gateway address for Profinet slave
-> (255.255.255.0) set static mask address for Profinet slave
version (latest) --->
Next, configure DHCP to be disabled and use a static IP. Go to → RT-Thread Components → Network → LwIP: lightweight TCP/stack, and disable DHCP:
After completing the configuration, compile and download the program to the development board.
Connect the development board to the PC using an Ethernet cable, and configure a static IP on the PC side:
Check the IP information on the development board and test the connectivity:
CODESYS Overview: CODESYS is a PLC software developed by the German company 3S. It integrates functions like PLC logic, motion control, and configuration displays. CODESYS, short for "Controller Development System," is an industrial automation programming tool based on the IEC 61131-3 standard. It supports multiple programming languages (e.g., ladder diagram, structured text, function block diagram) and offers a wide range of libraries and functional modules, helping engineers quickly develop and debug PLCs and industrial control systems. Its flexibility and powerful features make it widely used in industrial automation.
Ensure that the CODESYS software is installed. After installation, the following three pieces of software will be used:
First, open CODESYS V3.5 SP20 Patch 3, select -> New Project -> Projects -> Standard Project, configure the project name and location, then click OK:
After this popup window appears, click OK to keep the default configuration:
Note: If you purchased the CODESYS Control RTE SL, you can choose the device: CODESYS Control RTE V3 (CODESYS) / x64 (CODESYS). For normal evaluation purposes, you can skip installing this extension package and select CODESYS Control Win V3 (CODESYS) / x64 (CODESYS) device to create the project.
After the creation is successful, you will see the main interface:
Open the following two software applications:
Go back to the CODESYS master software, double-click Device (CODESYS Control Win V3 x64) -> Communication Settings -> Scan Network:
After the device user login window appears, configure the username and password (user-defined):
Check if the gateway device and softPLC device are online:
GSD (Generic Station Description) files: These are used in PROFIBUS DP (GSD files) and PROFINET IO (GSDML files) communication, acting as a bridge between the CPU module and IO modules in a PLC system. They typically include channel data, parameter data, diagnostic data, and user-defined data.
The GSDML file for this project is located at:
Install the GSDML file from the device repository by selecting GSDML-V2.4-RT-Labs-P-Net-Sample-App-20220324.xml under the above path:
After the installation is successful, you will see the P-net slave description file:
the left navigation panel -> General, and modify the default slave IP parameters according to the prompts.
You should now see that the PN master has successfully come online:
Start the PN slave on the development board by executing the command: pnet_app:
In this section, we will use CODESYS and PRONETA software to test the interaction between PN master and slave as well as network topology status.
Go back to the CODESYS software, select PN_Controller from the left navigation panel, right-click and scan for devices. After clicking on the device name, click Blink LED:
At this point, you will see the log output on the development board (PN slave IO), and the onboard User LED will blink:
In the device scanning interface, click the I&M button at the bottom left, modify the information, and write the new I&M data:
PNIO will update the slave configuration information:
Click I&M again to see that the I&M modification has been successfully applied!
PRONETA Overview: PRONETA Basic is a simple tool for quickly analyzing and configuring PROFINET networks. It also supports basic testing of ET 200 distributed IO systems and other components.
Open the PRONETA software and add the GSDML file:
After installation is successful, you can see the status information:
Click Settings -> Network Adapter and choose the PN corresponding Ethernet port:
Select Network Analysis -> Online from the top left navigation panel, click Refresh, and after a moment, you should see the PN network status. The specific PNIO information can be viewed on the right sidebar. Since we modified the PNIO information in CODESYS, you can also see the updated information here.
Since pnet only supports a single AR by default, we need to disable the gateway device and softPLC device on the CODESYS master:
Then, refresh the device and right-click rt-labs-dev to test the LED and I&M data modification: