Ethercat HAL driver

More
29 Apr 2016 17:55 #74070 by Cpk_Rbt
Replied by Cpk_Rbt on topic Ethercat HAL driver
We started tweaking the various configuration files and trying different things, and it seems like the drive didn't like the poll rate it was set at. The appTimePeriod in the EC config .xml is fine at 1ms (1000000), but the thread speed of the lcec.read-all and lcec.write-all functions doesn't like being at 1ms. I set it up to 1.5ms instead and it works great now.
Thanks again everyone for your help!

Please Log in or Create an account to join the conversation.

More
29 Apr 2016 19:05 #74072 by cgc
Replied by cgc on topic Ethercat HAL driver
Please look at the discription of the servo amplifier.
I use Beckhoff AX2003 amplifier and the answere time of this is only 2,5ms.

regards Frank

Please Log in or Create an account to join the conversation.

More
08 May 2016 10:02 #74365 by andypugh
Replied by andypugh on topic Ethercat HAL driver
Could the EtherCAT experts take a look at this forum post?

forum.linuxcnc.org/forum/18-computer/309...-with-linuxcnc#74300

Please Log in or Create an account to join the conversation.

More
12 May 2016 05:44 #74541 by Roger
Replied by Roger on topic Ethercat HAL driver
I'm trying to get a single axis Indradrive servo on Ethercat working and have a little problem - the servo won't rotate!

The config (attached) seems ok in that the axis gui comes up, motors homed and jogged etc. However the motor itself never moves :(
Comms to and from the drive works - the drive mode changes to OP (display on drive shows Ab then AF), I can see the torque change in the gui when force is applied to the shaft.

The servo works correctly in Indraworks and TwinCat.

Wireshark shows the position value is being sent to the drive. I have also sniffed the data from Twincat and there are some differences, I do not know enough about ethercat to determine if these differences are important or not. I can post extracts from those traces tomorrow if it will assist.

Can anyone assist? Sorry I'm new to this so please let me know what extra information I need to post.

Attached are the config files in use.

Regards,
Roger
Attachments:

Please Log in or Create an account to join the conversation.

More
13 May 2016 18:22 - 13 May 2016 18:25 #74621 by roschi
Replied by roschi on topic Ethercat HAL driver
Hi Roger,

two quick points are in my mind according to your files/describition
- in xml file the pdoentry poscommand is of type float --> what is about scaling? --> disable drive (AF -> Ab) rotate the shaft what value is there in halpin lcec.0.3.pos and when yes how much if you rote one time...
- in the config of the drive (done in indraworks) do you have the default main operation mode set to "position control"?
- don't use "speedaddcommand" for initial tests/setup

Hope that helps
Andreas

Perhaps find more config example for IndraDrive here (my little milling machine):
github.com/aschiffler/linuxcnc/tree/master/configs/roschi_cnc
Last edit: 13 May 2016 18:25 by roschi.
The following user(s) said Thank You: Roger, Nico2017

Please Log in or Create an account to join the conversation.

More
13 May 2016 22:58 #74629 by Roger
Replied by Roger on topic Ethercat HAL driver
Thanks Andreas,
I will try adding scaling using your suggestion, thank you. I have tried before but I did not think to use the pos to determine the scaling. The motor has a brake which I will need to release.

I've attached a screenshot showing the Indraworks mode - "Position control lagless encoder 1". I've also tried "Position control encoder 1" with the same result, but have not tried any other modes.

I'll remove the speed command for now.

I will report back on progress, there is some building work happening in our test lab so it may take a few days.

Best regards,
Roger
Attachments:

Please Log in or Create an account to join the conversation.

More
16 May 2016 15:05 - 16 May 2016 15:25 #74746 by arvidb
Replied by arvidb on topic Ethercat HAL driver
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:
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:
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
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:
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:
$ ./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":
~/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:
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:
<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!)
Last edit: 16 May 2016 15:25 by arvidb.

Please Log in or Create an account to join the conversation.

More
27 May 2016 13:33 - 27 May 2016 13:34 #75156 by chuchengbing
Replied by chuchengbing on topic Ethercat HAL driver
Hello everyone:
Now,we attempt to control a 6 DOF robot using LinuxCNC and I encounter a question. I have asked this question in this form and I am very grateful for those who has helped me. But this question is still exist. I know some experts in LinuxCNC and EtherCAT are at here,so I want to post my question at here too.Having said so much,let me state my question.When I closed the DC configuration in my xml file, I got things OK, if not, when I run Linuxcnc and change slaves state to OP, then waiting, you will find that the slave change its state to safeop automaticlly or the pc (ethercat master is on a pc) will be downtime with a CPU Blocked.then I check the kernl log, it shows below:
[ 6284.796454] EtherCAT: Requesting master 0...
[ 6284.796458] EtherCAT: Successfully requested master 0.
[ 6284.798219] EtherCAT 0: Domain0: Logical address 0x00000000, 162 byte, expected working counter 18.
[ 6284.798221] EtherCAT 0: Datagram domain0-0-main: Logical offset 0x00000000, 162 byte, type LRW.
[ 6284.798233] EtherCAT 0: Master thread exited.
[ 6284.798237] EtherCAT 0: Starting EtherCAT-OP thread.
[ 6284.798261] EtherCAT WARNING 0: 1 datagram UNMATCHED!
[ 6290.121896] EtherCAT WARNING 0-0: Slave did not sync after 5000 ms.
[ 6290.129890] EtherCAT 0: Domain 0: Working counter changed to 3/18.
[ 6295.596748] EtherCAT WARNING 0-1: Slave did not sync after 5000 ms.
[ 6295.604745] EtherCAT 0: Domain 0: Working counter changed to 6/18.
[ 6301.079580] EtherCAT WARNING 0-2: Slave did not sync after 5000 ms.
[ 6301.087572] EtherCAT 0: Domain 0: Working counter changed to 9/18.
[ 6306.574377] EtherCAT WARNING 0-3: Slave did not sync after 5000 ms.
[ 6306.582370] EtherCAT 0: Domain 0: Working counter changed to 12/18.
[ 6307.585597] EtherCAT 0: Domain 0: Working counter changed to 15/18.
[ 6312.593723] EtherCAT WARNING 0-5: Slave did not sync after 5000 ms.
[ 6312.601718] EtherCAT 0: Domain 0: Working counter changed to 18/18.
[ 6312.975772] EtherCAT 0: Slave states on main device: OP.
[ 6369.474367] EtherCAT 0: Domain 0: Working counter changed to 16/18.
[ 6369.479352] EtherCAT 0: Slave states on main device: SAFEOP, OP + ERROR.
[ 6369.486319] EtherCAT ERROR 0-0: AL status message 0x0032: "PLL error".
[ 6369.490306] EtherCAT 0-0: Acknowledged state SAFEOP.
[ 6370.475598] EtherCAT 0: Domain 0: 2 working counter changes - now 15/18.
[ 6374.624104] EtherCAT WARNING 0-0: Slave did not sync after 5000 ms.
[ 6374.632099] EtherCAT 0: Domain 0: Working counter changed to 18/18.
[ 6375.138099] EtherCAT 0: Slave states on main device: OP.

I guess the reason is something about the DC configuration and I now really don't know how to set DC correctly.Does someone know this answers? And it is ok if someone tell me how to configure the DC and I will check my configuration again. Thanks everyone.
Last edit: 27 May 2016 13:34 by chuchengbing.

Please Log in or Create an account to join the conversation.

More
27 May 2016 18:07 #75169 by roschi
Replied by roschi on topic Ethercat HAL driver
Hi chuchengbing,

which servo drives did you use?
Maybe you have the same issue with DC config and "notLRW" like here (Yaskawa):
Post 55408

About the DC configuration. Look at the original "XML-File" (the one which will be used in TwinCAT envoirments for your drive) and find the right values there. (May be the quit old Tutorial from 2013 for Rexroth Indradrives give some more help Google Docs )

Regards
Andreas

Please Log in or Create an account to join the conversation.

More
28 May 2016 02:27 - 28 May 2016 03:30 #75176 by chuchengbing
Replied by chuchengbing on topic Ethercat HAL driver
Thanks roschi very much.
The servo drives is not a common one but it is using EtherCAT to communicate and the values which have relationship with DC configuration are really come from the xml file which is post by the manufacturer. I am also pretty sure that have a certain relationship with DC configurtation because I don't go wrong when I close the DC in my xml file. I don't know how to set the DC, expecial the parameter "sync0Shifttime" in xml file,because this parameter in my xml is 0(come from the manufacturer),but i find this is the most different in different person when I refer to other's xml file.Also I do not understand the "notLRW" meaning and how I could find it and how to modify it.
Thanks again for replying, I look at the documents you post carefully and I will post my harvest in the latter.
Last edit: 28 May 2016 03:30 by chuchengbing.

Please Log in or Create an account to join the conversation.

Time to create page: 0.433 seconds
Powered by Kunena Forum