Example for CODESYS with a PROFINET IO Controller and a PROFINET IRT Gateway

In this example, we run a PROFINET IO-Controller on RevPi Connect and exchange data with KUNBUS PROFINET IRT Gateway (PROFINET IO-Device). The application has a KUNBUS PROFINET IRT Gateway (PR100074) connected over piBridgeLeft interface of RevPi Connect.A PROFINET IO-Controller runs on RevPi Connect and exchanges data with PROFINET IRT Gateway.

The example is targeted for CODESYS Control for Raspberry Pi MC SL,
e.g. article no.100337 (Connect+ 16 GB plus CODESYS Multi Core).

The application writes to the first 16 Bytes of the output Slot (kunbus_gw_9) the values [0,1,2..15]

Output 16 Byte Description: Output 16 byte
Module ID: 0x00000050
Usable in Slot: 1 – 8
Total Number of Input Bytes: 0
Total Number of Output Bytes: 16
Number of Submodules: 1

The application writes to the first 16 Bytes of the PROFINET IRT Gateway Process Image output area the values [16,17…31].

The eth1 interface of the RevPi Connect is configured for PROFINET in /etc/dhcpcd.conf with the following IP setting:

#Example static IP configuration:
interface eth1
static ip_address = 192.168.0.11/24

  • Configure the KUNBUS Profinet IRT Gateway (IO-Device) Station name as “kunbus-gw” and IP as 192.168.0.15 using Proneta.

For detailed procedure please refer to the User Manual Gateway Component for PROFINET.

Here you can see a graphical overview of the PROFINET network.

Executing “Scan for Devices” on the PROFINET Controller (PN_Controller) shall identify the configured PROFINET IRT Gateway. “Copy All Devices to Project” can
copy the IO Device to CODESYS device tree.

Alternatively, you can add the KUNBUS-GW-PROFINET module manually to CODESYS device tree.

CODESYS device tree view of the example project.

Following figure shows the vales in Input/Output Process Image area of KUNBUS Profibus IRT Gateway.

Following figure shows the PROFINET IO-Controller application Process data mapping for the first Input Slot (kunbus_gw_1) of 16 Bytes for the PROFINET IRT Gateway.

Following figure shows the PROFINET IO-Controller application Process data mapping for the first Output Slot (kunbus_gw_9) of 16 Bytes for the PROFINET IRT Gateway.