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

Connection to TC-BDS fails with Error 1827 #136

Closed
tillmanott opened this issue Mar 18, 2021 · 7 comments
Closed

Connection to TC-BDS fails with Error 1827 #136

tillmanott opened this issue Mar 18, 2021 · 7 comments

Comments

@tillmanott
Copy link

tillmanott commented Mar 18, 2021

Hello,

my attempt to use the ADS-lib to connect to Twincat on a CX with TC-BSD fails with error 1827. The readStateExample() and a custom implementation of the library were executed:
grafik

The route between TC-BSD and the Ubuntu machine running the ADS-lib was created. IP address conflicts do not exist. All Ip-addresses were assigned statically in the Class C area within a subnet:
Edit: The IP addresses are reversed in the diagram. Workstation: 192.168.215.137; ubuntu VM: 192.168.215.138
grafik

In TC-BSD, TCP port 48898 was whitelisted in pf.conf and both the firewall and the overall system were restarted.
The following entry was added to pf.conf:

#Allow ADS TCP connections 
pass in quick proto tcp to port 48898

Disabling the firewall completely did not work either.

I have attached a Wireshark dump, maybe it helps.
ws_export_adsconnection.zip

Greetings

@pbruenn
Copy link
Member

pbruenn commented Mar 18, 2021

What's different to #128 ?
Your wireshark dump shows "GvlVisu.tstVisuStruct"I expect this to be from your test version. How does the wireshark look like, when you do the readStateExample?

@pbruenn
Copy link
Member

pbruenn commented Mar 18, 2021

Oh and the addresses in the diagram doesn't match your wireshark dump. In the dump 192.168.215.138 tries to access "GvlVisu.tstVisuStruct", which is your workstation, not the VM

@tillmanott
Copy link
Author

tillmanott commented Mar 22, 2021

What's different to #128 ?
The difference is the operating system of the TwinCat PLC system (in this case TC-BSD). For the windows version of TwinCat everything is working now. The Error in #128 resulted in the previously used link-local-address area. It was resolved by putting everything in a private network (192.168.215.x). Since everything is working fine with the same code and the windows version I assume theres some difference when connectiong to TC-BSD.

Wireshark dump
Seems like i attatched the wrong dump. This one should show the readStateExample. The resulting Error 1827 also occur when I use my own code.

ws_export_error1827.zip
_Just recognized that the PLC wasn't in run when i recorded the last wireshark. The result stays the same:
ws_export_error1827_2.zip

Here's how the example is looking currently:

static void runExample(std::ostream& out)
{
    //AmsAddr der PLC. Ermittelt über rechtsklick auf Tray-Icon->Info
    static const AmsNetId remoteNetId { 5, 58, 182, 254, 1, 1 }; //AMS net id of the Beckhoff CX
    //Ip-Adresse der PLC
    static const char remoteIpV4[] = "192.168.215.81"; //ipv4 address of the Beckhoff CX

    //static const AmsNetId remoteNetId { 192,168,232,1,1,1 };
    //static const char remoteIpV4[] = "DERAE-CN217";

    // uncomment and adjust if automatic AmsNetId deduction is not working as expected
    //AdsSetLocalAddress({192, 168, 0, 1, 1, 1});
    AdsSetLocalAddress({192,168,215,138,1,1}); //AMS net id of thhe ubuntu vm (on which the example is running on)
    AdsDevice route {remoteIpV4, remoteNetId, AMSPORT_R0_PLC_TC3};
    //notificationExample(out, route);
    //notificationByNameExample(out, route);
    //readExample(out, route);
    //readByNameExample(out, route);
    //readWriteExample(out, route);
    //readWriteArrayExample(out, route);
    readStateExample(out, route);
}

@pbruenn
Copy link
Member

pbruenn commented Mar 22, 2021

In your diagram 192.168.215.138 is the workstation not the the Ubuntu VM. Are you sure your routing setting on the BSD machine is matching?

@pbruenn pbruenn closed this as completed Mar 22, 2021
@pbruenn pbruenn reopened this Mar 22, 2021
@tillmanott
Copy link
Author

tillmanott commented Mar 22, 2021

Oh, I made a mistake there. The IP addresses are reversed in the diagram.
Workstation: 192.168.215.137
ubuntu VM: 192.168.215.138

@pbruenn
Copy link
Member

pbruenn commented Mar 22, 2021

The most interesting part of your edit is that you had the PLC in CONFIG mode. That means you should have received ErrorCode 0x6 and not 0x723.
Sorry, but I have absolutely no idea what's going wrong there.

@pbruenn
Copy link
Member

pbruenn commented Jul 19, 2021

@tillmanott did you see #148. The problem there was they configured their route as "unidirectional". Could it be your issue, too?

@pbruenn pbruenn closed this as completed Jan 11, 2023
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