Modbus Communication through Profinet Bus

I am trying to setup Modbus communication through the profinet bus, but I am not having any success.

I have a Siemens 1515 connected to a network switch that has profinet devices and the modbus device. In TIA, I have an MB_CLIENT block that is setup with the correct CONNECT parameters.
Using QModMaster, I can not connect to the device. However, monitoring this request on WireShark, I can see the device respond with [RST, ACK]. Similarly, I can ping the device from the command prompt, and also see this back-and-forth on WireShark.

Currently, the status of the MB_CLIENT block is stuck at 7002 without changing. There have been a few restarts where it does reach 7004, but upon requesting to read information, the block is stuck at 7006 with no data being recieved.

I read this thread proving it is possible and easy: https://www.plctalk.net/forums/threads/s7-1200-profinet-modbus-tcp.93134/page-2
This is the device: Vista Touch Power | Digital Touchscreen 3 Phase Power Meter1764344388154.png
 
You're not doing modbus tcp through the profinet. You're just doing modbus tcp over ethernet.

That's fine because that's what you should be doing.

Modbus 101 is that you always do things in this order:
  1. Connect to your modbus device using a PC (as modbus client)
  2. Verify what you can successfully communicate with it.
  3. Connect your PC (as modbus server) to your PLC.
  4. Verify that the your PLC can retrieve modbus requests from your PC.
  5. When all is working, now connect to the modbus device to the PLC.

If you need to troubleshoot, use wireshark (as you did) to see what communication goes between PC and modbus device or PLC.
I recommend changing the IP of your PC to whatever it is emulating. That way know everything works with the IP you want it to work with.

After everything works with the PC but you still have problem with PLC to modbus tcp device, use a smart/managed switch and set up a mirror port. Connect your PC to the mirror port and run wireshark. Now you can see the communication betwen PLC and modbus tcp device.



In Siemens case you want to look very carefully at the programming examples Siemens have on modbus communication with S7-1500 or S7-1200.
It's a good idea to actually test those examples on your PLC and communicate with a PC.
There are many pitfalls that will result in communication not working.



 
Hi Pete,

Thank you for your reply and your help!

I am currently trying to connect the Modbus device to the PC (no PLC in the loop). I can successfully ping the device in command prompt, and I can connect to the device in Modbus Poll. However, Modbus Poll is reporting a no-data error and there it is constantly reporting zeros.

On Wireshark, I can see the connection and communication from the computer (192.168.12.241) and the device (192.168.12.124), however I noticed that the data Len=0. From the picture, I tried all 4 types of function codes, and I have tried many of the addresses from the documentation.

1764427746188.png

After a few minutes of no data, I also get this dump on Wireshark. I am not sure what this means. Any help would be much appreciated!1764427915498.png
 
OK, so you have a problem with the modbus device and not the PLC.

Things to look for on the device:

  1. is modbus tcp enabled?
  2. is tls or someother security enabled on modbus?
  3. is there an example of modbus request in the user manual you can try?
  4. does the device require a slave address?
  5. have you tried reading one register that has values surrounding it?
  6. is there some other software that communicates with the device over modbus tcp that you can try?
  7. is there another device you can try?
  8. do you have access to different firmware versions? Try older or newer, it might be a bug.

If none of this works you should contact the manufacturer for support.
 
Thank you for you replies!

I need to try changing the firmware on the device and see if that works.

Do you know how I can verify if there is any security that is blocking modbus in any way (using a windows PC)? Others have claimed a firewall issue, but I don't know how to verify that this is causing problems. Also, they could solve the issue by changing the device port, but that doesn't change my performance in any way.

For the other points, I have in fact acknowledged them all and have tested them already to no success.


FYI, the device settings are below. For the gateway and DNS settings, these values were the only ones that were working
Static IP: 192.168.12.124
Subnet: 255.255.255.0
Gateway: 192.168.12.1
DNS: 1.1.1.1
Modbus TCP: TRUE
Modbus RTU: FALSE
Slave ID: 1
Port: 502
Timeout: 1000s
 
The packets with length of 0 are ACKs i.e. part of the TCP/IP protocol. There are packets with length 11 and length 9.

In Modbus Poll, I think it displays the bytes coming back from the Slave/Service device, usually interlaced with the request bytes. Can you put up a screenshot of those displayed bytes from Modbus Poll?
 
Thank you for you replies!

I need to try changing the firmware on the device and see if that works.

Do you know how I can verify if there is any security that is blocking modbus in any way (using a windows PC)? Others have claimed a firewall issue, but I don't know how to verify that this is causing problems. Also, they could solve the issue by changing the device port, but that doesn't change my performance in any way.

For the other points, I have in fact acknowledged them all and have tested them already to no success.


FYI, the device settings are below. For the gateway and DNS settings, these values were the only ones that were working
Static IP: 192.168.12.124
Subnet: 255.255.255.0
Gateway: 192.168.12.1
DNS: 1.1.1.1
Modbus TCP: TRUE
Modbus RTU: FALSE
Slave ID: 1
Port: 502
Timeout: 1000s
Sorry, I didn't mention the firewall since I assumed you thought of that. Disable the windows firewall completely when running tests.

Modbus tcp is running as tcp communication. That means it runs in a session (similar to how you log in somewhere and log out when your done but without any password).

So step one of communicating is establishing this session. After that is done, the actual communication is starting.

Usually modbus clients have the session open as long as there is communication going on. There is a break in the communication, for example when someone takes ut a network cable and puts it back in. Then the session needs to be established again (by the client).

You only need to think and worry about these thing when looking at wireshark. Usually this is behind the scenes and transparent to the user.
 
The packets with length of 0 are ACKs i.e. part of the TCP/IP protocol. There are packets with length 11 and length 9.

In Modbus Poll, I think it displays the bytes coming back from the Slave/Service device, usually interlaced with the request bytes. Can you put up a screenshot of those displayed bytes from Modbus Poll?
Better yet, maybe attach the actual wireshark dump. It's usually a *.pcapng file.

Also I don't like the modbus poll. It's confusing compared to modpoll which is no BS and completely free. Like ping and other utilities.
 
Unfortunately for my organization, I can not uninstall the windows firewall.

However, does this explain why it could not communicate with the Siemens PLC? On TIA, I had 'Disabled access control' and had 'Permit access with PUT/GET communication from remote partner', so, correct me if I'm wrong, but I don't think there's any explicit firewall? Is there a chance that it fails even if the PC is in the loop?

The attachment also includes ICMP from the PC pinging the device from the command line.

Thank you both for your help, I really appreciate it!
 

Attachments

  • wiresharkModbus30.zip
    3.2 KB · Views: 1
Unfortunately for my organization, I can not uninstall the windows firewall.

Haven't looked at the file but I'm very fimilar with your situation as most of our enterprise clients are in the same boat.

That's why we suggest one of three options
  1. running PLC programming on dedicated machines that are not sourced from IT and are not connected to the IT network ever.
  2. or run the development in VMs and for example have USB network card in passtrough mode
  3. or have dedicated test laptop for situations like this. Not sourced from IT. This is what I most often do.

Other typical problem we have is:
  1. can't email PLC programs (enterprise email gateways remove contant)
  2. can't email any file even inside zip files (enterprise email gateways remove contant)
  3. aren't allowed to use USB memory sticks (security risk)
  4. can't install programs on PCs (blocked by IT)
  5. can't change settings on PCs (blocked by IT)
  6. devices on industrial IT aren't allowed internet access and all ports are locked down (security risk)
  7. locked down firewall on the PCs, enterprise firewalls between subnets, everything blocked by default (security risk)
  8. long red-tape filled process to change any of the above, usually blocked be people who understand nothing.
Oh, well.
 
Yeah, definitely in the same boat here!

Would this all affect the PLC's firewall? Lets say I took the PC out of the loop, would the device now work with the PLC? Or is there some 'imprint' that the PC is leaving on the PLC through Siemens TIA?
 
Yeah, definitely in the same boat here!

Would this all affect the PLC's firewall? Lets say I took the PC out of the loop, would the device now work with the PLC? Or is there some 'imprint' that the PC is leaving on the PLC through Siemens TIA?
There is a firewall in the S7-1500 but it's not activated by default, at least it wasn't in firmware version 2.8/2.9.
You can check this video from Siemens. It's old but at least you'll find where to look.

PC connection leaves no residual impact on the PLC when it's removed - unless you changed something in the PLC program or configuration.

However modbus tcp program blocks in the PLC needs a unique communication ID. So you can't just start communicating with another device at the same time without program collision.

That why I suggest having the PLC communicating with either the modbus device or the PC (emulating a modbus device). Both with the same IP address, ports and everything but never connected at the same time.

It's not a must per se, but it allows you to remove another unknown factor when troubleshooting.
 
Unfortunately for my organization, I can not uninstall the windows firewall.

However, does this explain why it could not communicate with the Siemens PLC? On TIA, I had 'Disabled access control' and had 'Permit access with PUT/GET communication from remote partner', so, correct me if I'm wrong, but I don't think there's any explicit firewall? Is there a chance that it fails even if the PC is in the loop?

The attachment also includes ICMP from the PC pinging the device from the command line.

Thank you both for your help, I really appreciate it!
Had a look at the ethernet dump and there might be some problems with your code.

You have to:
  • Send a request,
  • Wait for a response
  • If response doesn't show up within a time that is longer than what the modbus device timeout is, you need to try again.
  • If the response comes in, you have to take the data and do whatever you want with it.
  • Restart again.

A lot of devices can't handle concurrent request for data. And it won't usually speed up anything, so don't do it.

And don't run ping or anything else while testing. Just pure modbus tcp and nothing else.

You also need to be able to handle communication breaks in the network, so it restarts again. But that's a later issue.

I also believe there is some firewalling going on that blocks packets or some other kind of network issue, but who knows.

That's why you want to run tests without being on network, even device to device works fine with any normal ethernet cable. Or a simple dumb switch. But you need static IPs for that. And also without any firewalls enabled or any other corporate network AI sniffer on your PC, like crowdstrike.

If you are doing paid work I suggest you find an old laptop or whatever and reinstall windows. Disable everything and try again.
And look at my earlier suggestions.
 

Similar Topics

we use M580 which have an Modbus RTU port correct if iam wrong now should i have to read input data from ab micrologix through read var block and...
0
Replies
2,700
Views
hi friends. i have PLC with 13 inputs , i want to give the status of these inputs to BMS server guy , he want to read the status through modbus...
4
Replies
3,943
Views
Hi everyone, I'm New here I am currently working on a personal/learning project involving industrial communication and experimenting with a...
4
Replies
223
Views
We are using Modbus to communicate with the ABB ACS 380 which talks through an anybus gateway and then translated to Profibus back to my redundant...
5
Replies
231
Views
Hello Experts, can someone help me on how to communicate ACS550 using modbus communication, I want to control it start stop and monitoring of...
3
Replies
349
Views
Top