Siemens S7-1200 profinet communication with codesys plc

raghu_k

Member
Join Date
Feb 2024
Location
Metzingen
Posts
21
Hi Guys, I am trying to establish communication over profinet between Siemens S7-1200 PLC as IO device and codesys plc as IO controller. But I am facing the error of IO device failure. Could you guys please help me with the process to establish the communication. Thanks in advance.
 
Hi Guys, I am trying to establish communication over profinet between Siemens S7-1200 PLC as IO device and codesys plc as IO controller. But I am facing the error of IO device failure. Could you guys please help me with the process to establish the communication. Thanks in advance.
You should be able to export the GSD / GSDML file from TIA Portal and import this into your IO Controller (Codesys) project. This should help eliminate any configuration error of the device on the IO Controller side.

Make sure the S7-1200 controller Profinet settings are set up appropriately:
- In the controller properties, go to the PROFINET interface ---> Operating Mode settings
- Make sure the Operating Mode has "IO device" set
- Set up your transfer areas (data map)
- Further down in the settings, there should be an Export button to get the GSD file.

Important: In the Operating Mode --> Real Time settings, there is an option to set "IO Controllers outside the project with access to this I-Device". I believe this needs to be set to 1 or more, otherwise it will not accept connections to IO Controllers OUTSIDE the TIA Portal project.

From the TIA Portal help file "Useful information on Shared Devices"

Setting of the real-time properties

If, apart from the CPUs in the project, other CPUs outside the project have access to the shared device, you must input the number of project-external IO controllers at the PROFINET interface of the shared devices. Only then does STEP 7 correctly calculate the communication load and thus the resulting update times.

The maximum possible number of IO controllers for the shared device depends on the device. This number is stored in the GSD file of the shared device.
 
Thank you for the replies.

Make sure the S7-1200 controller Profinet settings are set up appropriately:
- In the controller properties, go to the PROFINET interface ---> Operating Mode settings
- Make sure the Operating Mode has "IO device" set
- Set up your transfer areas (data map)
- Further down in the settings, there should be an Export button to get the GSD file.

Important: In the Operating Mode --> Real Time settings, there is an option to set "IO Controllers outside the project with access to this I-Device". I believe this needs to be set to 1 or more, otherwise it will not accept connections to IO Controllers OUTSIDE the TIA Portal project.

I have followed the same procedure but I still get the error as IO device failure and the plc is in error state. The screenshots attached to this message can make it more clearer.

I also get an error in IO controller side after importing the GSD file exported from Siemens TIA portal as RPC Blocked (Firewall ?). Please refer to the screenshots attached.
I would like to know what other configurations have to be done for successful communication.
 

Attachments

  • Siemens PLC Error state.jpg
    Siemens PLC Error state.jpg
    197.4 KB · Views: 23
  • Error in scan of device.png
    Error in scan of device.png
    6.7 KB · Views: 25
  • diagonistic buffer.PNG
    diagonistic buffer.PNG
    24.9 KB · Views: 23
  • IOdevice_settings.PNG
    IOdevice_settings.PNG
    65.3 KB · Views: 23
  • Number of IO controllers.PNG
    Number of IO controllers.PNG
    83.4 KB · Views: 22
Hi Raghu_k: Since the CoDeSys is the Profinet controller we need to see that the configuration is on the controller side, and what error is the CoDeSys reporting.
And if possible, if you can connect to CoDeSys using VNC client and can run Wireshark and get the traces, it would provide more insights into your problem.
 
From the TIA Portal help file "Useful information on Shared Devices"

kdcui, hi. Why are you suggesting raghu_k to look into the "Shared Devices" documentation. This use case's requirement is to use the S7-1200 as an "i-device" and CoDeSys as a Profinet IO controller. It is not the case that the S7-1200 and CoDeSys will be used both as controllers and that some third device will need to communicate simultaneously with both controllers. Maybe I am misunderstanding the problem?
 
Hi Raghu_k: Since the CoDeSys is the Profinet controller we need to see that the configuration is on the controller side, and what error is the CoDeSys reporting.
And if possible, if you can connect to CoDeSys using VNC client and can run Wireshark and get the traces, it would provide more insights into your problem.
Hi, currently when I import the GSDML file into IO controller (i.e. Codesys), I try to scan the IO device during which I get the error as RPC Blocked (Firewall ?).
But this error doesnt really give much idea that what is exactly wrong or what exactly it is requiring. You can also please refer to the screenshots posted earlier in this thread which includes the IO device configuration and error got at the IO controller side.

I can try to run Wireshark but before that I have tried to ping the devices and I can ping them through their IP addresses set manually.
 
I have never seen this CoDeSys error. Is it Windows, Linux, RspberryPi CoDeSys.
If it is Windows you may need to create a rule for the firewall. It looks like something on the scope of the operating system, not the CoDeSys engineering tool or the GSDML. It seems to be something below this level
 
Yes, I am using the codesys software on Windows. Could you also tell what exactly you mean by creating rule for the firewall.
 
kdcui, hi. Why are you suggesting raghu_k to look into the "Shared Devices" documentation. This use case's requirement is to use the S7-1200 as an "i-device" and CoDeSys as a Profinet IO controller. It is not the case that the S7-1200 and CoDeSys will be used both as controllers and that some third device will need to communicate simultaneously with both controllers. Maybe I am misunderstanding the problem?

These are the settings that appear when using the S7 PLC as an IO Device (to connect to an external IO Controller). See screenshots. By default this is "1" when IO Device is initially set.
2024-03-01-08.59.34.png2024-03-01-09.00.56.png2024-03-01-09.02.06.png

Unless I am mistaken about the function of this setting? I interpret this as if this is not set to 1 or greater, the IO Controller outside the project (in this case, the CodeSyS controller) cannot connect.
 
Last edited:
This seems like a networking issue, not a PLC configuration issue.
Before you mess around with firewall rules, I'd do some basic network troubleshooting:
1. Can you ping the PLC from the CodeSys system?
2. Are you able to temporarily run a network cable directly from the PLC to the Codesys machine to bypass any network switches which may be causing problems (assuming the Codesys machine is relatively nearby).
3. Before changing Firewall rules in Windows, just completely disable the firewall (temporarily) to confirm it is in fact the firewall causing the problem.
 
These are the settings that appear when using the S7 PLC as an IO Device (to connect to an external IO Controller). See screenshots.View attachment 68475View attachment 68476View attachment 68477

Unless I am mistaken about the function of this setting? I interpret this as if this is not set to 1 or greater, the IO Controller outside the project (in this case, the CodeSyS controller) cannot connect.
But in my case I have already set it to 1 or 2 as you see in the attached image.
 

Attachments

  • Number of IO controllers_1.PNG
    Number of IO controllers_1.PNG
    98.8 KB · Views: 7
This seems like a networking issue, not a PLC configuration issue.
Before you mess around with firewall rules, I'd do some basic network troubleshooting:
1. Can you ping the PLC from the CodeSys system?
2. Are you able to temporarily run a network cable directly from the PLC to the Codesys machine to bypass any network switches which may be causing problems (assuming the Codesys machine is relatively nearby).
3. Before changing Firewall rules in Windows, just completely disable the firewall (temporarily) to confirm it is in fact the firewall causing the problem.
1. Yes, I can ping plc from codesys and vice-versa.
2. Not really
3. I tried disabling the firewall temporarily but it didnt work.
 
What is the network topology between the PLC and the Codesys machine? Are you going through any managed switches or routers?
Also, I did a quick Google search and found this document. It talks about the RPC Blocked error in Codesys.

When you disabled the Windows firewall, did you reboot the computer before trying again?


1709302754225.png
 
What is the network topology between the PLC and the Codesys machine? Are you going through any managed switches or routers?
Also, I did a quick Google search and found this document. It talks about the RPC Blocked error in Codesys.

When you disabled the Windows firewall, did you reboot the computer before trying again?


View attachment 68480
Thank you. I haven't tried to reboot the computer after disabling the firewall. I will try this way.
 

Similar Topics

Hi all.. I'm working on something that is bugging the heck out of me. I have a S7-1200 setup as an i-device with 128 bytes in, 128 bytes out...
Replies
14
Views
7,183
Hi I'm wanting to basically get data from a Siemens S7-1200 PLC and write it in to my D registers on my Q series PLC. If I went for profinet...
Replies
6
Views
2,274
Hi all, Quoting a system which calls for a Siemens S7-1200 and a Danfoss FC280. Cost-wise, it's much the same whether I use a higher-spec PLC...
Replies
8
Views
4,244
Afternoon all, I'm using TIA Portal V12 SP1 to program a Siemens S7-1200 (Part No. 212 1AE31-0XB0) to control a Siemens Sinamics G120 (Part No...
Replies
4
Views
8,729
Hi all, Currently having trouble getting a speed reference to write over modbus to an Omron M1... I can successfully write a run command and...
Replies
6
Views
255
Back
Top Bottom