Hello Levent,I had some attempts to get java flavor of ADS driver working with TC2 devices. I can not confirm that with real hardware, but some of workarounds [1] I attempted also involved pre-populating symbol table with primitive types for TC2. The TC3 devices declare them, the TC2 omit them. I used for a bit an ancient CX9001 which worked with this code, but I didn't really dive into complex types it could offer. Also, I noticed that some old TC2 I/O modules been hanging connection with even an attempt to retrieve symbol table. From brief look into your code I think you got it covered pretty well. If you look for a TC3 compatible device, you can actually do most trivial connection test with TC/BSD hosted within VM. I used it to test lookup logic. Please follow first Jakob Sagatowski blog [3]. This makes secure connection, I described how to disable firewall [4], in order to have plain connection.
Good luck with further work!
Best regards, Łukasz[1] https://github.com/ConnectorIO/connectorio-addons/blob/master/bundles/org.connectorio.addons.binding.amsads/src/main/java/org/connectorio/addons/binding/amsads/internal/symbol/reader/TwinCat2SymbolReader2.java#L163L197 [2] https://github.com/ConnectorIO/connectorio-addons/blob/master/bundles/org.connectorio.addons.binding.amsads/src/main/java/org/connectorio/addons/binding/amsads/internal/symbol/reader/TwinCat2SymbolReader2.java#L66L71
[3] https://alltwincat.com/2021/12/13/tc-bsd-in-a-virtual-machine/ [4] https://dywicki.pl/2023/10/twincat-bsd-with-insecure-ads-connection/ On 11/24/26 14:45, Levent Sağıroğlu wrote:
Hi Sebastian, thanks - that is the right question to ask, and it is the one I was most careful about. On protocol compatibility: so far everything I have seen says the wire protocol is the same. The model generated from ads.mspec parses the symbol table, the data type table and the upload-info of a TwinCAT 2.11 controller without a single change to the spec. What differs is not the format but the content and the conventions around it: - the device names primitive types the way TcAdsDef.h does (INT16, UINT32) rather than the IEC names TwinCAT 3 reports (INT, UDINT) - it stores symbol and member names upper case, while the program declares them in mixed case, so a lookup that is exact fails - it answers the online-version read with an error result code and an empty payload instead of a version, and the driver parses the payload without looking at the result code, which is the EOF that ends the connection before anything else is tried So nothing below the driver changes: no .mspec change, no regenerated code, nothing outside plc4go/internal/ads. That also answers your second point - plc4j, plc4c, plc4py and plc4net are not touched by any of this, and cannot be, since the spec they are generated from is untouched. On not breaking TwinCAT 3, the honest answer first: I do not have a TwinCAT 3 device, so I cannot test that myself. What I can say is how each change is shaped so TwinCAT 3 keeps its current path: - name lookup tries the exact name first and only falls back to a case-insensitive match when that fails, so a TwinCAT 3 device, whose names already match exactly, never reaches the fallback - a primitive type is synthesised only when the name is absent from the uploaded data type table; TwinCAT 3 uploads those entries, so the table wins and the synthesis is dead code there - the online-version handling only changes what happens when the device answers with an error result, which today is not checked at all That is reasoning, not a measurement, and I would rather have the measurement. If someone on the list has a TwinCAT 3 device and can run the third PR against it, I would be glad of it - and I am happy to prepare whatever makes that easy to do. The first PR is up: https://github.com/apache/plc4x/pull/2889 - a browse query without a dot panics the driver. One condition, with a test. Nothing in it distinguishes TwinCAT versions; the query never reaches the device. Thanks, Levent Sebastian Rühl via dev <[email protected]>, 24 Kas 2026 Sal, 10:49 tarihinde şunu yazdı:Hi Levent, welcome to the list. One thing that jumps to my mind: We should carefully check if TwinCat 2 and TwinCat 3 are protocol compatible. So as long as your changes don't break TwinCat3 is should be fine but we should check that. Luckly the spec is open and there should be Documentation by Beckhoff which could help us judge such things. Also keep in mind: the X stands for any language so that means a change must not break any of the languages. Sebastian On 2026-11-23 23:10 UTC Levent Sağıroğlu wrote:Hi everyone, I'm Levent (LeventSA on GitHub) from NetYazilim in Turkey.I'vebeen writing software for over thirty years, and the part I enjoy mosthasalways been getting a computer to talk to a piece of hardware and making something useful out of it. I'm building a data collection system for a factory, reading its Beckhoff controllers with plc4go. What drew me to PLC4X is how much it covers from one design: more than a dozen protocols behind a single API, five language bindings, one .mspecperprotocol to generate them from. We read Siemens and Modbus in the same plant, so that one API is why I chose plc4go - and the model generated from ads.mspec parsed the TwinCAT 2 tables unchanged, so nothing below touches the spec. The ADS driver assumes TwinCAT 3 and cannot connect to a TwinCAT 2device atall. That is #1424, open since February 2024, and the three symptoms reported there are all accounted for in what I have: INT16 where the driverexpectsINT, symbol names that only match in upper case, and a nil pointerpanic. Ihave it working against three TwinCAT 2.11 controllers, from a CX9020with38 symbols to a plant PC with over 170,000 readable tags, and would like to contribute that back. Introducing it here first, as the contributingguideasks. It is not one change but three, so I would send three small PRs against develop, smallest first, each with its own measurements: - a browse query with no dot in it panics the driver (a one characterfix)- a reply larger than the peek buffer is classified as a fatal transport error, which kills the connection on any device with a large symboltable- TwinCAT 2 support itself, in plc4go/internal/ads only, with no .mspec change and no regenerated code There is a fourth change behind the tag count above: a browse of "*"liststhe symbols a device reports and "**" expands them into readable tags.Thatone is a feature rather than a fix, so I'd rather offer it separatelyoncethe three above are settled. Unless someone objects, I'll open the first one later this week and letitbe reviewed before sending the next. I can follow these through, and the controllers are in a running plant I have access to. #1424 says TwinCAT 2 has gone uncovered mostly for lack ofsuch adevice, so if anything else in the ADS driver needs checking against real TwinCAT 2 hardware, I'm happy to run it. One note on process, as the contributing guide requires. English is notmyfirst language and I learned it mostly from reading technicaldocumentation,so I used Claude as an assistant here, for the language and for parts ofthework, as I will also disclose in each PR. The design decisions, the measurements on real hardware and the validation against a reference tool are mine, and I have reviewed every line I am proposing. Plain, direct review comments are welcome. Indirect phrasing is harder for me to readcorrectly,so please just say what needs to change. Thanks, Levent
