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

add_route_to_plc fails under Linux when using Windows Compact Embedded (CE7) #432

Open
vrees opened this issue Nov 20, 2024 · 3 comments
Open

Comments

@vrees
Copy link

vrees commented Nov 20, 2024

I want to connect to my Beckhoff PLC, CX5110, running TwinCAT 3.1, build 4024.62 via ADS protocol under Linux. While trying to add_route_to_plc an error occurred in the pyads lib:

main_py

ErrorMessage:
`
Connected to pydev debugger (build 242.23339.11)
Traceback (most recent call last):

File "/home/vrees/.local/share/JetBrains/IntelliJIdea2024.2/python-ce/helpers/pydev/pydevd.py", line 1570, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/home/vrees/.local/share/JetBrains/IntelliJIdea2024.2/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)

File "/home/vrees/work/git-repos/heatpump2influxdb/main.py", line 15, in
pyads.add_route_to_plc(CLIENT_NETID, CLIENT_IP, PLC_IP, PLC_USERNAME, PLC_PASSWORD,route_name=ROUTE_NAME)

File "/home/vrees/work/git-repos/heatpump2influxdb/venv/lib/python3.11/site-packages/pyads/ads.py", line 200, in add_route_to_plc
return adsAddRouteToPLC(
^^^^^^^^^^^^^^^^^
File "/home/vrees/work/git-repos/heatpump2influxdb/venv/lib/python3.11/site-packages/pyads/pyads_ex.py", line 169, in wrapper
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/home/vrees/work/git-repos/heatpump2influxdb/venv/lib/python3.11/site-packages/pyads/pyads_ex.py", line 375, in adsAddRouteToPLC
raise RuntimeError(f"Unexpected response from PLC: {data!r}")

RuntimeError: Unexpected response from PLC: b"\x03f\x14q\x00\x00\x00\x00\x06\x00\x00\x80\x05|\xca\xe0\x01\x01\x10'\x01\x00\x00\x00\x01\x00\x04\x00\x04\x07\x00\x00"
python-BaseException
`

The debug output shows, that the PLC answers with reasonable data. But the check if the received password is correct, fails as the expected data does not match the true or false condition. It looks like that the parsed data is somehow wrong interpreted.
I double checked username and password as it is still the default password.

debug

@chrisbeardy
Copy link
Collaborator

hmmmm not seen this error before! It looks like the plc is sending a repsonse that we are not expecting, because the password should either be correct or not. I wonder if Beckhoff have changed the expected response, I've not tested myself with 4024.62, thats quite a new one. You don't have the ability to try another runtime?

@vrees
Copy link
Author

vrees commented Nov 21, 2024

The CX5110 uses a Windows CE7 Operating System. Changing the Runtime is quite complex as it uses SD cards for the installation. And I was happy to get it running so far. I would be very reluctant to change that.
Any other ideas?

@chrisbeardy
Copy link
Collaborator

ah, this is not the first time we have had issues with CE7 (#188 and #232 and #257) , I suspect there may be some overlap here. Maybe caused by something related to sizes on the platform (e.g. https://stackoverflow.com/questions/384502/what-is-the-bit-size-of-long-on-64-bit-windows#384672). This may be an internal problem we need to address to make sure we can read password on all platforms. I don't have a CE platform to test with, so this may take some time to resolve. Please feel free to look into this problem yourself to see if you can find a solution and we can merge it in.

@chrisbeardy chrisbeardy changed the title add_route_to_plc fails under Linux add_route_to_plc fails under Linux when using Windows Compact Embedded (CE7) Nov 27, 2024
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