Profinet has emerged as one of the most popular and widely used Fieldbus systems for data communication over industrial Ethernet – and with good reason. It offers flexible and efficient performance, with high real-time data rates, to power the digitalization process.
But for an industrial device or controller to operate on Profinet, they need to be able to ‘speak the same language’ of the network, which often requires the selection of a dedicated application-specific integrated circuit (ASIC) or hardware module. These approaches have several drawbacks related to interoperability and cost, with some ASIC and module manufacturers insisting on a royalty payment for each device sold, resulting in overhead over the product lifetime.
Fortunately, a more elegant solution is provided by sourcing a Profinet software stack to run instead on the system microcontroller in an embedded device. This method of industrial communication delivers several advantages – it supports a fully customized product offering and makes it possible for equipment manufacturers to take complete ownership and control of their supply chain. Furthermore, removing the need for a hardware module results in cost savings and reduces supply chain complexity by reducing the bill of materials.
Another positive of the software-configured approach is that it can reuse the same design within various products. A quick and easy modification of the code in the software stack allows the microcontroller to communicate with another Fieldbus – making it possible to bring a new product to the market in a shorter timeframe than where a hardware redesign is required. A software-based approach also makes adding customized features to higher-end product offerings simple by tweaking the stack’s code. So, when using RT-Labs’ Profinet device stack for Profinet implementations, its small code footprint makes it less complex than other Profinet stacks, making it well-suited for embedded systems.
Learning to configure a Profinet software stack
But just how easy is it to configure a Profinet software stack? Could a software developer more familiar with deploying ASICS or hardware modules for industrial communication be able to download the code and run a sample application within a short space of time? The answer to this question is a resounding Yes. Typically speaking, it is possible to build a software stack within an hour, using the following six key steps as a guide that can help you achieve your aims.
Step 1: Identifying the relevant hardware
As a starting point, you will need some hardware, including a laptop. For this step-by-step guide, we suggest running the P-Net Profinet device stack and its sample application on a Raspberry Pi, an embedded Linux board. A second Raspberry Pi is used as a PLC (Programmable Logic Controller = IO controller) running Codesys soft PLC.
Other necessary hardware to complete the activity include:
- 1 Raspberry Pi as IO-device
- 1 Raspberry Pi as IO-controller, or a PLC
- 1 Ethernet switch
- 3 Ethernet cables
Step 2: Setting up the IO-device Raspberry Pi for running p-net
As the PLC typically will change the IP address of the IO device, it is recommended to connect a keyboard, mouse and monitor to the Raspberry Pi running the P-Net application. Alternatively, a USB-to-serial cable can be used to communicate with the Raspberry Pi from your laptop.
Step 3: Installing the dependencies
The Raspberry Pi needs to be connected to the Internet via LAN or WiFi to be able to download software. To compile P-Net on Raspberry Pi, you need a recent version of Cmake, the open-source, cross-platform family of tools designed to build, test and package software, and which can be used to control the software compilation process. Once Cmake is installed and verified, it can then be compared with the minimum version required for P-Net.
Step 4: Downloading and compiling p-net
RT Labs’ P-Net device stack is open source, and is available on a GPLv3 license. It is supported by extensive documentation and support materials, including generic Profinet information and tutorials. Then simply clone and build the source.
Create and enter a working directory:
mkdir profinet cd profinet # Download P-Net using git clone git clone --recurse-submodules https://github.com/rtlabs-com/p-net.git
Create and configure the build, before building the code:
cmake -B build -S p-net cd build make all
The source code contains a GSD file (written in GSDML), which tells the IO-controller how to communicate with the IO device.
Step 5: Running the sample application
It is then possible to run the sample app in the build directory, enabling the Ethernet interface and setting the IP address.
Once you have installed the sample app on the Raspberry Pi, it needs to be connected to a PLC to see it in action. To set up the PLC, we suggest using Codesys soft PLC. Install Raspberry Pi OS on the second Raspberry Pi – no serial cable or LEDs are required. Connect the two Raspberry Pi boards and your laptop via an Ethernet switch.
Step 6: Configuring and studying the communication
With the sample application running, it is possible to build new features such as enabling the automatic start of the sample application once the power is turned on. The resulting communications can be manipulated – such as by triggering alarms or adding diagnostics. For Profinet members, the ART tester tool is available for conformance testing, with tests run against the sample app to verify stack compliance.
That’s a rapid-fire run-through of how to configure and run a Profinet software stack – and it is possible to achieve these actions within a short time. Having worked through these six steps, you can start developing your applications by using the sample app as a starting template. Experiment by modifying the available modules, and the data types they send and receive. And you can modify the GSDML file accordingly to explain the IO-device behaviour to the PLC configuration tool. Plenty of online resources are available with ideas on how to write your application.
Embedded industrial communications needn’t be difficult
In conclusion, the benefits of Profinet as a Fieldbus system for data communication over Ethernet have long been established in industrial markets. But there are new ways of connecting a device or controller to operate on Profinet and getting them to speak the same language. Using an RT Labs software stack is an alternative approach that provides greater flexibility, more innovation, lower costs, and reduced vulnerability to supply-chain interruption. And it is possible to start experimenting with this exciting technology within an hour.