sittner / linuxcnc-ethercat

LinuxCNC EtherCAT HAL driver
GNU General Public License v2.0
207 stars 137 forks source link

supporting separate LRD/LWR commands instead of an LRW command #121

Open fdarling opened 1 year ago

fdarling commented 1 year ago

How hard would it be to modify the EtherCAT driver to support forcing separate LRD/LWR commands to be used rather than the combined LRW command? Is this something I could hire someone to work on?

I am trying to use a Yaskawa SGD7S EtherCAT drive with LinuxCNC, and I realized that it is not currently possible due to Yaskawa supporting Logical Read (LRD) and Logical Write (LWR), but not the combo Logical Read Write (LRW) command. This is specified here:

Yaskawa_EtherCAT_Support_Excerpt

from this document: RV-Y4P05Q Beginning EtherCAT Master Development with Yaskawa Drive.pdf

This is pretty crazy to me, since the Chinese JMC JASD series servo drives work with LinuxCNC, you'd think Yaskawa would be more compatible!

I posted about this on the LinuxCNC forums:

Ethercat protocol not responding - Page 3 - LinuxCNC


You can see how Beckhoff's TwinCAT software has an option "Use LRD/LWR instead of LRW":

Use_LRD_LRW_instead_of_LRW_Screenshot

shown here: https://infosys.beckhoff.com/english.php?content=../content/1033/tcsystemmanager/1092577035.html&id=1077609697012163927

and here: https://infosys.beckhoff.com/english.php?content=../content/1033/ethercatsystem/2469132171.html

Or in this case, "Use LRW instead of LWR/LRD":

Use_LRW_instead_of_LWR_LRD_Option

shown here: Schneider Electric Configuration of the EtherCAT Master

and here: Schneider Electric CODESYS Online Help - Tab 'EtherCAT Master - General'

fdarling commented 1 year ago

After a lot of research and experimentation with mostly broken example code, I managed to interface with a Yaskawa EtherCAT servo drive from a standalone C program using EtherLab.org's "EtherCAT Master" library. This is the same library that the LinuxCNC EtherCAT driver uses, and I was able to apply what I learned to modify that linuxcnc-ethercat driver to have separate read/write domains, and therefore work with Yaskawa EtherCAT.

To get it to work in the short term I disabled compiling the non-generic drivers, as well as disabled some FSoE (Functional Safety over EtherCAT) related code because it was unclear which process data domain it needed to interact with. Once I update the per-device drivers to use the new dual-domain API and fix the FSoE support, I can submit a pull request to get my changes mainlined.

I'll keep you guys posted...