PROFINET ctrlX CORE X3 with ctrlX CORE plus X3 using CoDeSys Fieldbus libraries

PROFINET - ctrlX CORE X3 with ctrlX COREplus X3

sanX
New Contributor
 
1. Overview

In this article, a ctrlX CORE X3 as a Profinet Controller will be configured to connect with a ctrlX COREplus X3 that will be a Profinet Device. To be able to establish the connection between both, the CoDeSys Profinet library will be used in both devices. This configuration can also be done between two ctrlX CORE X3 or between two ctrlX COREplus X3.

ctrlX CORE X3 with ctrlX CORE plus X3 PROFINET Connection

2. Prerequisites
3. ctrlX CORE X3 (PN-Controller) configuration

Note: Before starting with the configuration it is required to install the CoDeSys Fieldbus libraries. Please follow the steps shown here: Manual - CODESYS Fieldbus communication packages for ctrlX CORE.

1. Configure IP address:

  1. First, in the ctrlX CORE web interface, go to the “Settings” menu
  2. "Connectivity"
  3. Select the "eth1" connecion
  4. Select "IPv4" 
  5. Write the desired IP address. NOTE: To avoid conflicts with the web interface IP address (192.168.1.1) an IP address of the type 192.168.2.X will be written. In this case: 192.168.2.12. To configure the subnet mask, the /24 is added
  6. Save configuration

IP address configuration

2. Configure PLC program

  • A new project is created: First, select a ctrlX CORE template -> Provide a project name -> Press “Ok

Project creation

A new project tree will be created.

  • Add drivers to the project: Right click over “Device” and select “Add Device

Add device menu access

  • 1. Extend the Profinet IO section and select Ethernet adapter -> 2. Press “Add Device

Ethernet node addition

  • Now the Ethernet node should be visible in the Device tree

Device tree with the added ethernet node

  • Communicate to the ctrlX CORE

Right click over "Device" -> "Communication settings" -> Enter ctrlX CORE IP Address -> Test connection by pressing over the "Run" button -> Press “Ok

Communication settings

  • Configure Ethernet Node

First, double click over "Ethernet" -> 2. Press “Browse” -> 3. Select "eth1" where the previously configured IP address should be visible -> 4. Press “Ok

ethernet node configuration

  • Add PN Controller
  1. Right click over “Ethernet” -> "Add device"
  2. Select PN-Controller in the Profinet IO Master section
  3. Press “Add device

PN-Controller device addition

  • Change priorities.

Double click over "Profinet_communicationTask" -> Include a priority of 37 as a recommendation

Priority change

For the "Profinet_IOTask" the same steps are followed:

Double click over "Profinet_IOTask" -> Include a priority of 30 as a recommendation

Priority change

  • Configure PN Controller

Double click over "PN_Controller" -> Provide a PN-Controller station name (By default the name will be controller) -> Configure Slave IP Parameters

PN-Controller configuration

  • Add Profinet device
  1. Right click over "PN_Controller" -> "Add Device"
  2. Expand the I/O folder -> CODESYS PLC -> Select CODESYS PROFINET Device
  3. "Add device"

PN-Device addition

  • Configure PN-Device:
  1. Double click over CODESYS_Profinet_Device
  2. Give the station name configured in the PN Device
  3. Write the configured IP address in the PN Device (In this case, 192.168.2.13)

NOTE: Notice that PN-Controller and PN-Device have the same IP 192.168.2.X type. Otherwise, it would not work.

PN-Device configuration

  • Add IO to read the sent values:
  1. Right click over "CODESYS_Profinet_Device" -> "Add device"
  2. Select "Output 8bit" because this will be the type of data sent from the PN-Controller to the PN-Device
  3. Press “Add device

Output variable addition

NOTE: If the PN-Device is already configured and connected, there is other way to add the Profinet Device to the project. Login to the ctrlX CORE

Login button

NOTE: You can also run the program, but it is not required to scan the profinet devices

Login and run buttons

Once the PLC program has been transferred to the ctrlX CORE:

  1. Right click over “PN_Controller” -> "Scan Devices"
  2. In the case it has not scanned the devices -> "Scan Devices"
  3. The device should appear with its outputs
  4. Copy al the devices to object

Profinet devices scan

  • The PN-Device should appear in the device tree

Added devices check

Troubleshooting: In the case, the PN-Controller is not able to scan the PN-Device, reset cold the PLC program in the PN-Device.

  • Write little program to send data:
  1. Double click over "PLC_PRG" in the device tree
  2. Define the variables
  3. Write the program

Code writing

  • Map the program variable with the output:
  1. Double click over "Output_8Bit"
  2. Select the PNIO Module I/O Mapping tab
  3. Double click over the USINT type variable
  4. Look for the counter variable and select it
  5. Press “Ok

Variable mapping

Once everything has been configured, the following window should appear:

PLC program overview

Before testing the PLC program, it is required to configure the PN-Device. Keep the window open because later it will be used to check the sent values.

4. ctrlX COREplus X3 (PN-Device) configuration

1. Configure IP address

  1. First, in the ctrlX CORE web interface, go to the “Settings" menu
  2. "Connectivity"
  3. Select the "eth1" connection
  4. Select "IPv4"
  5. Write the desired IP address. NOTE: To avoid conflicts with the web interface IP address (192.168.1.2) an IP address of the type 192.168.2.X will be written. In this case: 192.168.2.13 because the defined IP address by the PN-Controller was this one. To configure the subnet mask, the /24 is added
  6. Save configuration IMPORTANT: Write an IP address different to the one configured in the PN-Controller

NOTE: This step is not mandatory because with the configuration performed in the PLC program, it will be enough. In this case it would create a dynamic IP address.

IP Address configuration

2. Configure PLC program

  • A new project is created: First, select a ctrlX CORE template -> Provide a project name -> Press “Ok

Project creation

  • A new project tree will be created.

Add drivers to the project: Right click over “Device” and select “Add Device

Device addition menu

  • 1. Extend the Profinet IO section and select "Ethernet" -> 2. Press “Add Device

Ethernet addition

  • Now the Ethernet node should be visible in the Device tree

Device tree with Ethernet added

  • Communicate to the ctrlX CORE:
  1. Right click over "Device" -> "Communication settings"
  2. Enter ctrlX CORE IP Address
  3. Test connection by pressing the Run button
  4. Press “Ok

Communication settings between ctrlX CORE and PLC Engineering

  • Configure Ethernet Node:
  1. First, double click over "Ethernet"
  2. Press “Browse
  3. Select "eth1" where the previously configured IP address should be visible
  4. Press “Ok

Ethernet configuration

NOTE: In the case, the IP address was not configured in the ctrlX CORE web interface, select also the eth1 option, but the IP address will be 0.0.0.0. Later, it is required to fill the following spaces:

Ethernet configuration

Write the PN-Device address defined in the PN-Controller (192.168.2.13) and write the subnet mask.

When following these last steps in the eth1 connectivity overview, a dynamic IP address will be visible:

Dynamic IP address configuration check

Otherwise, this would be the overview:

Static IP Address check

  • Add PN Device
  1. Right click over “Ethernet” -> "Add device"
  2. Select "CODESYS Profinet Device"
  3. Press "Add device"

PN-Controller addition

  • Change priorities.

Double click over "Profinet_communicationTask" -> Include a priority of 37 as a recommendation

Priority change

For the "Profinet_IOTask" the same steps are followed:

Double click over "Profinet_IOTask" -> Include a priority of 30 as a recommendation

Priority change

  • Configure PN Device:
  1. Double click over "CODESYS_Profinet_Device"
  2. Change to “Use project parameters
  3. Write the previously defined station name for the PN_Device. In this case PN_Device-plus_X3

PN-Controller configuration

  • Add Output
  1. Right click over "CODESYS_Profinet_Device" -> "Add device"
  2. Select "Output 8bit"
  3. Press “Add device

Output variable addition

NOTE: To be able to read the sent values from the PN-Controller to the PN Device it is required to write a line of code in the PLC_PRG as follows:

Line of code addition

The IB1 value is the output address of the output which can be found as follows:

Input variable check

 
5. Testing

NOTE: To be able to use the PLC programs in both ctrlX COREs, it is required to be in “Running” mode

From the ctrlX COREplus X3 side, the PLC program is transferred to ctrlX CORE. Press the “login” button and later the “Run” button

Login and run PLC program

From the ctrlX CORE X3 side, the PLC program is transferred by following the same step as for the ctrlX COREplus X3.

Login and run PLC program

Once executed: in the device tree the symbols shown in the following image should be visible.

Status check

As seen in the previous figure, the output values are not updated and to be able to see them, it is required to perform the following steps:

1. Unlog and select the “Enabled 2 (always in bus cycle task)" option. Once done this, log again and check if the values are updated.

Update values

As it can be seen, now the values are updated. In the case, they still do not appear, perform a reset origin and try again

Data check

From the ctrlX CORE X3 side, perform the same steps and check how all the data is sent.

Sent and received values in the PLC Engineering app

6. Related Links
LunatiX
LunatiX
Hi, I'm Stefan from the DCEM Application Team. If you have any questions, do not hesitate to contact me.
Editorial work by: sanX
Must Read
Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist