I'm having trouble with my Omron G5 R88D-KN15F-ECT servo drive. Whatever I do i just get Error 90 ("Communications setting error") on transition from PRE-OP to OP.
It's always a good idea to write a comprehensive forum post when facing a difficult problem. While writing this I realised why I got Error 90 with aschiffler's linuxcnc - I used someone else's vid and pid values in the xml file! I'll still post this though as it's a good description of all the things that can go wrong.
Also, I still wonder why TwinCAT refuses to work with my servo drive.
First I tried using just Etherlab's ethercat command just like narogon describes
here
, and got the same error (not suprisingly). I then tried to write my own user program based on the example in ethercat-1.5.2/examples/user/, but always got the same Error 90 on activation of the master (with no errors returned from the ecrt_* functions and nothing turning up in /var/log/messages). Well, fair enough, since I'm not really sure what I'm doing anyway.
Next thing to try was TwinCAT. I'm using an old Windows XP install that I dual-boot to on the same computer as my linuxcnc install. I downloaded TwinCAT version 2.11 from Beckhoff and believe I selected "Software level NC PTP" or something like it on installation (not sure about this one?). I have the Omron xml file for the servo drive (file version 1.04) and copied that into the C:\TwinCAT\Io\EtherCAT\ folder, restarted the computer and started TwinCAT System Manager (is this the "TwinCAT Configurator" that's mentioned earlier in this thread?). I right-clicked on "I/O Devices" in the tree pane and selected "Scan Devices...". My EtherCAT card was found ("Device 2 (EtherCAT) (Realtek PCIe GBE Family Co)"). I answered Yes to "Scan for Boxes" and it detected my KN15F-ECT drive. I opted to "Append linked axis to NC-Configuration" when asked. I said no to "Activate Free Run" since I know this causes an error from earlier tries. When I click "Set/Reset TwinCAT to Run mode" I get these errors:
Code:
Hint TwinCAT System (10000) 2016-05-16 15:02:29 0 ms Starting COM Server TcEventLogger !
Error (65535) 2016-05-16 15:02:28 960 ms 'Drive 1 (R88D-KN15F-ECT ' (1001): state change aborted (requested 'SAFEOP', back to 'PREOP').
Error (65535) 2016-05-16 15:02:28 960 ms 'Drive 1 (R88D-KN15F-ECT ' (1001): 'PREOP to SAFEOP' failed! Error: 'check device state for SAFEOP'. AL Status '0x0012' read and '0x0004' expected. AL Status Code '0x0028 - Synchron not supported'
Error (65535) 2016-05-16 15:02:28 920 ms 'Drive 1 (R88D-KN15F-ECT ' (1001) 'PS': CoE ('InitDown' 0x1600:00) - SDO Abort ('Data type does not match, length of service parameter does not match', 0x06070010): 'download pdo 0x1600 entries'.
Error (65535) 2016-05-16 15:02:28 912 ms 'Drive 1 (R88D-KN15F-ECT ' (1001) 'PS': CoE ('InitDown' 0x1a00:00) - SDO Abort ('Data type does not match, length of service parameter does not match', 0x06070010): 'download pdo 0x1A00 entries'.
Hint TwinCAT System (10000) 2016-05-16 15:02:28 140 ms TCRTIME Server started: TCRTIME.
Hint TwinCAT System (10000) 2016-05-16 15:02:28 140 ms TCPLC Server started: TCPLC.
Hint TwinCAT System (10000) 2016-05-16 15:02:28 140 ms TCNC Server started: TCNC.
Hint TwinCAT System (10000) 2016-05-16 15:02:28 140 ms TCIO Server started: TCIO.
Hint TwinCAT System (10000) 2016-05-16 15:02:28 125 ms TCIOECAT Server started: TCIOECAT.
Hint TwinCAT System (10000) 2016-05-16 15:02:28 125 ms TCIOETH Server started: TCIOETH.
Hint TwinCAT System (10000) 2016-05-16 15:02:28 93 ms Initializing COM Server TcEventLogger !
Hint TwinCAT System (10000) 2016-05-16 15:02:28 93 ms Loading configuration of COM server TcEventLogger !
Hint TwinCAT System (10000) 2016-05-16 15:02:27 312 ms Shutting down COM Server TcEventLogger !
Hint TwinCAT System (10000) 2016-05-16 15:02:27 125 ms Saving configuration of COM server TcEventLogger !
Hint TwinCAT System (10000) 2016-05-16 15:02:27 78 ms TwinCAT System Restart initiated from AmsNetId: <IP>.1.1 port 32777.
TwinCAT also does not seem to be able to reset the FAULT state of the drive; when navigating to the Diag Message History tab and clicking Ack. Messages I get:
Code:
Error (65535) 2016-05-16 15:05:26 912 ms 'Drive 1 (R88D-KN15F-ECT ' (1001): CoE ('InitDown' 0x10f3:03) - SDO Abort ('Sub-index does not exist.', 0x06090011).
Also Update Diag History gives
Code:
Error (65535) 2016-05-16 15:04:11 752 ms 'Drive 1 (R88D-KN15F-ECT ' (1001): CoE ('InitUp' 0x10f3:04) - SDO Abort ('Sub-index does not exist.', 0x06090011).
Error (65535) 2016-05-16 15:04:11 742 ms 'Drive 1 (R88D-KN15F-ECT ' (1001): CoE ('InitUp' 0x10f3:03) - SDO Abort ('Sub-index does not exist.', 0x06090011).
(I can reset the FAULT state from Linux by setting and resetting the Fault reset bit in the controlword though, so this seems to be a problem in TwinCAT.)
OK, so no luck with TwinCAT. Next thing was to try the EtherCAT HAL driver. I had already installed the
IgH EtherCAT master
version 1.5.2 into /opt, and used that install to build the
aschiffler
version of LinuxCNC. I edited the configure.in script to also look for ecrt.h in /opt/etherlab/include first:
Code:
diff --git a/src/configure.in b/src/configure.in
index 5c264fd..98b423b 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -998,7 +998,7 @@ if test -e "$RTDIR/include/ecrt.h"; then
CONFIG_LCEC=m
else
# try to find ethercat include file somwhere else
- for i in /usr/include/ecrt.h /usr/local/include/ecrt.h; do
+ for i in /usr/include/ecrt.h /usr/local/include/ecrt.h /opt/etherlab/include/ecrt.h; do
if test -e $i; then
CONFIG_LCEC=m
# hack to avoid adding /usr/include to the module build include path
Then built the aschiffler linuxcnc:
Code:
$ ./autogen.sh
$ LDFLAGS=-L/opt/etherlab/lib CPPFLAGS=-I/opt/etherlab/include ./configure --without-libmodbus
$ make
$ sudo make setuid
I ran ". scripts/rip-environment" - this is imperative of course and needs to be done everytime a new shell is opened since it selects the newly built ethercat-capable linuxcnc for use instead of the system one; you can check that you have done this in your current shell by running "which halrun":
Code:
~/linuxcnc-aschiffler$ which halrun
/usr/bin/halrun
~/linuxcnc-aschiffler$ . scripts/rip-environment
~/linuxcnc-aschiffler$ which halrun
/home/arvidb/linuxcnc-aschiffler/scripts/halrun
And then started halrun and ran these commands:
Code:
halcmd: loadrt threads name1=master period1=1000000
halcmd: loadusr -W lcec_conf r88d-258th.xml
halcmd: loadrt lcec
halcmd: addf lcec.read-all master
halcmd: addf lcec.write-all master
halcmd: start
My r88d-258th.xml file looks like this:
Code:
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="1">
<slave idx="0" type="generic" vid="00000083" pid="0000000d" configPdos="true">
<syncManager idx="0" dir="out">
</syncManager>
<syncManager idx="1" dir="in">
</syncManager>
<syncManager idx="2" dir="out">
<pdo idx="1701">
<pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="drivecontrol" halType="bit"/>
<pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="poscommand" halType="S32"/>
<pdoEntry idx="60B8" subIdx="00" bitLen="16" halPin="touchprobefunction" halType="bit"/>
<pdoEntry idx="60FE" subIdx="01" bitLen="32" halPin="physoutputs" halType="bit"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1b01">
<pdoEntry idx="603F" subIdx="00" bitLen="16" halPin="errcode" halType="bit"/>
<pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="drivestatus" halType="bit"/>
<pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="pos" halType="S32"/>
<pdoEntry idx="6077" subIdx="00" bitLen="16" halPin="torque" halType="S32"/>
<pdoEntry idx="60F4" subIdx="00" bitLen="32" halPin="followingerror" halType="S32"/>
<pdoEntry idx="60B9" subIdx="00" bitLen="16" halPin="touchprobestatus" halType="bit"/>
<pdoEntry idx="60BA" subIdx="00" bitLen="32" halPin="touchpos1" halType="S32"/>
<pdoEntry idx="60BC" subIdx="00" bitLen="32" halPin="touchpos2" halType="S32"/>
<pdoEntry idx="60FD" subIdx="00" bitLen="32" halPin="diginputs" halType="bit"/>
</pdo>
</syncManager>
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
<watchdog divider="2498" intervals="1000"/>
<sdoConfig idx="6060" subIdx="00">
<sdoDataRaw data="8"/>
</sdoConfig>
</slave>
</master>
... but immediately get Error 90 after executing "start"
(This was due to wrong vid and pid in the xml file. I've changed them to the correct values in this post though, and it works now!)