Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem connecting to Beckhoff PLC #24

Closed
Sulomus opened this issue Dec 19, 2022 · 7 comments
Closed

Problem connecting to Beckhoff PLC #24

Sulomus opened this issue Dec 19, 2022 · 7 comments

Comments

@Sulomus
Copy link

Sulomus commented Dec 19, 2022

First of all I would like to thank you for this library! The examples and documentation is amazing!

Unfortunately I was not able to connect to my Beckhoff PLC. My task is to connect and take data from the PLC - I did not install it nor program it - so I don't know all the internal configuration etc. but I will try to explain our system as best as I can.

What am I using?

  1. Beckhoff PLC
  • type: CP-4D57D0
  • IP address: 172.21.9.60
  • AmsNetID: 5.77.87.208.1.1 OR 158.196.119.70.3.1 (see why I say OR down below)
  • ADS port: 851 OR 27907 (see why I say OR down below)
  1. Linux PC with Node-RED
  • IP address: 172.21.9.50
  • NodeRED verison: 3.0.2
  • contrib-ads-client version: 1.4.0

I enabled ADS and create symbols on the Beckhoff PLC as follow:
image

Why did I say AmsNET ID is 5.77.87.208.1.1 or 158.196.119.70.3.1?

  • I can see the AmsNET ID in two different places showing two different addresses.
  • And I don't know which one is correct
  • But I have tried both and both don't work.

One I can find here:
Screenshot_14

And second one I can see here:
Screenshot_8

The same applies for the PORTS 851 OR 27907

  • again I can see two diffrent ports in two diffrent places.
    Here:
    Screenshot_11

And here:
Screenshot_12

This is the error I am getting:
Screenshot_9

I do not understand why is it trying to connect to the local IP 127.0.0.1?
Shall I also configure something on my Linux PC?

I have tried every combination of AmsNetID and PORTS and none of the worked resulting in same error message (expect for the IP and PORT).

I will appreciate any help!
With regards,
Jakub Szlaur

@Sulomus
Copy link
Author

Sulomus commented Dec 19, 2022

  • Linux PC and Beckhoff PLC can see each other through ping command issued from the Linux PC:

image

@jisotalo
Copy link
Owner

jisotalo commented Dec 19, 2022

Hello, thanks for the feedback!

The AmsNetId 5.77.xxx and port 851 are correct ones. The others would be if you wanted to connect directly to the I/O EtherCAT device.

As you are using Linux PC without any TwinCAT router, you need to create the route manually. As default the library is trying to connect to local router which would pass the messages to the PLC (and that's how it done with router).

See the following:
https://github.com/jisotalo/ads-client/#setup-3---connecting-from-any-nodejs-supported-system-to-the-plc
jisotalo/ads-client#51 (comment)

@Sulomus
Copy link
Author

Sulomus commented Dec 19, 2022

Hello, thanks for the feedback!

The AmsNetId 5.77.xxx and port 851 are correct ones. The others would be if you wanted to connect directly to the I/O EtherCAT device.

As you are using Linux PC without any TwinCAT router, you need to create the route manually. As default the library is trying to connect to local router which would pass the messages to the PLC (and that's how it done with router).

See the following: https://github.com/jisotalo/ads-client/#setup-3---connecting-from-any-nodejs-supported-system-to-the-plc jisotalo/ads-client#51 (comment)

Thank you very much! Will try ASAP.

@Sulomus
Copy link
Author

Sulomus commented Dec 21, 2022

Hello,
I have added StaticRoute via Visual Studio TwinCAT3 like this:
image

Then I changed the configuration of the notification node as follows:
image
image

Now when I run the code I get this error:
image

In Beckhoff docs there is not much more info:
image

Do I need to do something else?

@jisotalo
Copy link
Owner

jisotalo commented Dec 21, 2022

I have a feeling that you have done something wrong with the route.

For example, when googling this error I found this comment. Make sure you don't have this unidirectional checked.
Beckhoff/ADS#148 (comment)

I have never created a route from XAE so I'm not sure if it's correct. Please try as in links I posted earlier.

@Sulomus
Copy link
Author

Sulomus commented Dec 30, 2022

Man you are amazing!
Managed to make it work without the unidirectional checked!

@Sulomus Sulomus closed this as completed Dec 30, 2022
@jisotalo
Copy link
Owner

Awesome! Thanks for reporting that you got it working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants