Ethercat HAL driver

More
04 Oct 2016 09:45 #81207 by cgc
Replied by cgc on topic Ethercat HAL driver
Hi Jolli,
is it possible to send the parameters with CoE?

regards Frank

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

More
06 Oct 2016 12:10 - 06 Oct 2016 12:12 #81298 by jolli
Replied by jolli on topic Ethercat HAL driver
Hi,

CoE doesn't seem to be an option for configuration link , only for synchronization.

I had missed an error message while uploading parameters, a problem that has been mentioned a couple times in etherlab-users mailing list. IDN P-0-0150, encoder configuration, is longer than others (228B), and should be sent in two parts. Snooping on TwinCAT, first packet is sent just as SoE packet with FragmentsLeft, and the second one sends rest of data with IDN headers; then, the servo driver acknowledges the transfer. Etherlab-master sends the first part, but second is left out, and when next configuration packet comes the servo driver responds with 7003 Malformed Packet - rightly so.

The mailing list discussions never came to any conclusion on the error, so I'll have to dig on this - any clues?

BR, Jolli
Last edit: 06 Oct 2016 12:12 by jolli.

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

More
15 Oct 2016 21:39 #81673 by jolli
Replied by jolli on topic Ethercat HAL driver
Update regarding IDN writing:

As the first part was sent a-ok with ethercat-tool but second part never
appeared, I tried sending first more than fragment-length of the data, and
then the second part in another call. The first part quits with timeout,
but after second part the write can be confirmed full and successful with
'ethercat soe_read'. (ethercat-tool has been patched to accept hex-ascii)

Following part is for reference for anyone else dealing with this:
Commands, data cut:
ethercat soe_write -t hex_ascii 0 S-0-0150 e000e000070000004861.... ;more than 118 bytes
ethercat soe_write -t hex_ascii 0 S-0-0150 00000000000000000200...  ;final 110 bytes

dmesg, rather intresting value for timeout:
[ 8279.973142] EtherCAT DEBUG 0-0: Scheduling SoE write request.
[ 8279.975524] EtherCAT DEBUG 0-0: Processing SoE request...
[ 8279.975535] EtherCAT DEBUG 0-0: Writing IDN 0x8096 of drive 0 (228 byte).
[ 8279.975544] EtherCAT DEBUG 0-0: SCC write request:
--- 8< data cut 8< ---
[ 8279.983531] EtherCAT ERROR 0-0: Timeout after 17179717 ms while waiting for write response.
[ 8279.983544] EtherCAT ERROR 0-0: Writing IDN 0x8096 failed.
[ 8279.983567] EtherCAT ERROR 0-0: Failed to process SoE request.
[ 8279.983575] EtherCAT DEBUG 0-0: Processing register request...
[ 8279.985273] EtherCAT DEBUG 0-0: Scheduling SoE write request.
[ 8279.987517] EtherCAT DEBUG 0-0: Register request successful.
[ 8279.987537] EtherCAT DEBUG 0-0: Processing SoE request...
[ 8279.987547] EtherCAT DEBUG 0-0: Writing IDN 0x8096 of drive 0 (110 byte).
[ 8279.987565] EtherCAT DEBUG 0-0: SCC write request:
--- 8< data cut 8< ---
[ 8279.999492] EtherCAT DEBUG 0-0: SCC write response:
[ 8279.999499] EtherCAT DEBUG: 04 40 96 80
[ 8279.999512] EtherCAT DEBUG 0-0: Finished SoE request.
[ 8279.999544] EtherCAT DEBUG 0: Finished SoE write request.

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

More
15 Oct 2016 21:46 - 15 Oct 2016 21:51 #81674 by jolli
Replied by jolli on topic Ethercat HAL driver
Moving on:

Although the configuration data is (should be) ok, servos still don't go OP. After configuring with ethercat-tool and starting system (start halrun, load modules, load lcec_conf, start) everything else seems to work according to dmesg (ec_master debuglevel set to 1) but synchronising.. well, it's interesting. I plotted all "EtherCAT DEBUG 0-0: Sync after x ms: y ns" output in following picture:

File Attachment:


Looks like the system doesn't even try to synchronize? From what I see, I guess the servo configuration is reset and DC is simply not running?

dmesg from the run, until sync messages start:
EtherCAT: Requesting master 0...
EtherCAT DEBUG 0: IDLE -> OPERATION.
EtherCAT: Successfully requested master 0.
EtherCAT DEBUG 0: ecrt_master_callbacks(master = 0xf3788000, send_cb = 0xfafcd029, receive_cb = 0xfafcd02e, cb_data = 0xf26de640)
EtherCAT DEBUG 0: ecrt_master_create_domain(master = 0xf3788000)
EtherCAT DEBUG 0: Created domain 0.
EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xf3788000, alias = 0, position = 0, vendor_id = 0x00000002, product_code = 0x14516012)
EtherCAT DEBUG 0: Creating slave configuration for 0:0, 0x00000002/0x14516012.
EtherCAT DEBUG 0 0:0: Attached slave 0.
EtherCAT DEBUG 0 0:0: ecrt_slave_config_dc(sc = 0xf419c000, assign_activate = 0x0730, sync0_cycle = 250000, sync0_shift = 50000, sync1_cycle = 2000000, sync1_shift = 0
EtherCAT DEBUG 0: ecrt_domain_reg_pdo_entry_list(domain = 0xf2ff9fc0, regs = 0xf2e5b0c0)
EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xf3788000, alias = 0, position = 0, vendor_id = 0x00000002, product_code = 0x14516012)
EtherCAT DEBUG 0 0:0: ecrt_slave_config_reg_pdo_entry(sc = 0xf419c000, index = 0x0086, subindex = 0x00, domain = 0xf2ff9fc0, bit_position = 0xfaf811c8)
EtherCAT DEBUG 0: Domain 0: Added 12 bytes, total 12.
EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xf3788000, alias = 0, position = 0, vendor_id = 0x00000002, product_code = 0x14516012)
EtherCAT DEBUG 0 0:0: ecrt_slave_config_reg_pdo_entry(sc = 0xf419c000, index = 0x0024, subindex = 0x00, domain = 0xf2ff9fc0, bit_position = 0xfaf812a8)
EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xf3788000, alias = 0, position = 0, vendor_id = 0x00000002, product_code = 0x14516012)
EtherCAT DEBUG 0 0:0: ecrt_slave_config_reg_pdo_entry(sc = 0xf419c000, index = 0x0086, subindex = 0x00, domain = 0xf2ff9fc0, bit_position = 0xfaf81388)
EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xf3788000, alias = 0, position = 0, vendor_id = 0x00000002, product_code = 0x14516012)
EtherCAT DEBUG 0 0:0: ecrt_slave_config_reg_pdo_entry(sc = 0xf419c000, index = 0x0024, subindex = 0x00, domain = 0xf2ff9fc0, bit_position = 0xfaf81468)
EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xf3788000, alias = 0, position = 0, vendor_id = 0x00000002, product_code = 0x14516012)
EtherCAT DEBUG 0 0:0: ecrt_slave_config_reg_pdo_entry(sc = 0xf419c000, index = 0x0087, subindex = 0x00, domain = 0xf2ff9fc0, bit_position = 0xfaf81548)
EtherCAT DEBUG 0: Domain 0: Added 12 bytes, total 24.
EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xf3788000, alias = 0, position = 0, vendor_id = 0x00000002, product_code = 0x14516012)
EtherCAT DEBUG 0 0:0: ecrt_slave_config_reg_pdo_entry(sc = 0xf419c000, index = 0x0033, subindex = 0x00, domain = 0xf2ff9fc0, bit_position = 0xfaf81628)
EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xf3788000, alias = 0, position = 0, vendor_id = 0x00000002, product_code = 0x14516012)
EtherCAT DEBUG 0 0:0: ecrt_slave_config_reg_pdo_entry(sc = 0xf419c000, index = 0x0087, subindex = 0x00, domain = 0xf2ff9fc0, bit_position = 0xfaf81708)
EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xf3788000, alias = 0, position = 0, vendor_id = 0x00000002, product_code = 0x14516012)
EtherCAT DEBUG 0 0:0: ecrt_slave_config_reg_pdo_entry(sc = 0xf419c000, index = 0x0033, subindex = 0x00, domain = 0xf2ff9fc0, bit_position = 0xfaf817e8)
EtherCAT DEBUG 0: ecrt_master_activate(master = 0xf3788000)
EtherCAT DEBUG 0: Adding datagram pair with expected WC 3.
EtherCAT 0: Domain0: Logical address 0x00000000, 24 byte, expected working counter 3.
EtherCAT 0:   Datagram domain0-0-main: Logical offset 0x00000000, 24 byte, type LRW.
EtherCAT DEBUG 0: Stopping master thread.
EtherCAT DEBUG 0: Master IDLE thread exiting...
EtherCAT 0: Master thread exited.
EtherCAT DEBUG 0: FSM datagram is f3788488.
EtherCAT 0: Starting EtherCAT-OP thread.
EtherCAT DEBUG 0: Operation thread running with fsm interval = 4000 us, max data size=45000
EtherCAT WARNING 0: 248 datagrams UNMATCHED!
EtherCAT DEBUG 0-0: Processing register request...
RTAPI: ERROR: Unexpected realtime delay on task 1
This Message will only display once per session.
Run the Latency Test and resolve before continuing.
EtherCAT DEBUG 0: Datagram f3788520 already queued (skipping).
--- repeated 15 times ---
EtherCAT DEBUG 0: UNMATCHED datagram:
EtherCAT DEBUG: 05 18 01 00 10 09 04 80 00 00 E8 B9 25 04 01 00
--- type repeated 15 times ---
EtherCAT DEBUG 0: Configuration changed (aborting state check).
EtherCAT DEBUG 0-0: Checking system time offset.
EtherCAT DEBUG 0-0: Register request successful.
EtherCAT DEBUG 0-0: DC 32 bit system time offset calculation: system_time=3933703680 (corrected with 4000000), app_time=529501164825473000, diff=454844904
EtherCAT DEBUG 0-0: Setting time offset to 454844904 (was 0)
EtherCAT DEBUG 0: Requesting OP...
EtherCAT DEBUG 0-0: Changing state from PREOP to OP.
EtherCAT DEBUG 0-0: Configuring...
EtherCAT DEBUG 0-0: Now in INIT.
EtherCAT DEBUG 0-0: Clearing FMMU configurations...
EtherCAT DEBUG 0-0: Clearing sync manager configurations...
EtherCAT DEBUG 0-0: Clearing DC assignment...
EtherCAT DEBUG 0-0: Configuring mailbox sync managers...
EtherCAT DEBUG 0-0: SM0: Addr 0x1800, Size 128, Ctrl 0x26, En 1
EtherCAT DEBUG 0-0: SM1: Addr 0x1A00, Size 128, Ctrl 0x22, En 1
EtherCAT DEBUG 0-0: Assigning SII access to PDI.
EtherCAT DEBUG 0-0: Now in PREOP.
EtherCAT DEBUG 0-0: Assigning SII access back to EtherCAT.
EtherCAT DEBUG 0-0: SM2: Addr 0x1000, Size  12, Ctrl 0x24, En 1
EtherCAT DEBUG 0-0: SM3: Addr 0x1100, Size  12, Ctrl 0x22, En 1
EtherCAT DEBUG 0 0:0: FMMU: LogAddr 0x00000000, Size  12, PhysAddr 0x1000, SM2, Dir out
EtherCAT DEBUG 0 0:0: FMMU: LogAddr 0x0000000C, Size  12, PhysAddr 0x1100, SM3, Dir in
EtherCAT DEBUG 0-0: Setting DC cycle times to 250000 / 2000000.
EtherCAT DEBUG 0-0: Checking for synchrony.
EtherCAT DEBUG 0-0: Sync after    0 ms:   48281492 ns
Last edit: 15 Oct 2016 21:51 by jolli.

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

More
08 Nov 2016 01:45 #82576 by Lixiaohui
Replied by Lixiaohui on topic Ethercat HAL driver

hello

I tried several times with the mentioned steps, but I failed to get the whole thing to work, please help me to understand what I am missing. I am a newbie in linuxcnc, and my experience with linux itself is limited . The following are the steps that I made:


Step 0 : you need to install Debian Linuxcnc with RTAI core (I failed to do the following procedure when I tried Linux with
RT Preemption). The following procedure was fully tested with Linux Debian-7.9'-'3.4-9-rtai-686-pae' linuxcnc.

First Part: Intallation of Eathercatlab Hal Component

1st Download ethercat master from IgH from here:
www.etherlab.org/download/ethercat/ethercat-1.5.2.tar.bz2

2nd Open a shellTerminal, and go to the folder that contains the ethercat master, and Untar the file

3rd download debian folder from sittner from here:
github.com/sittner/ec-debianize/archive/master.zip

4th Unzip the file "ec-debianize-master.zip"

5th copy debian folder (the was produced in 4th step) to /ethercat-1.5.2/ (that was produced 2nd step)

6th now in the shell terminal, use the following instructions:
cd ethercat-1.5.2
cd debian
./configure -a
cd ..
sudo apt-get update
dpkg-checkbuilddeps
(I was missing dpatch package)
dpkg-buildpackage
wait until it finishes building. use command "cd .." in the shell to go to the parent directory.
You will find two files : etherlabmaster-dev_1.5.2+hg4b0b90_i386.deb , etherlabmaster_1.5.2+hg4b0b90_i386.deb

7th sudo dpkg -i etherlabmaster_1.5.2+hg4b0b90_i386.deb

8th edit the file : "/etc/default/ethercat"

9th sudo update-ethercat-config

10th sudo dpkg -i etherlabmaster-dev_1.5.2+hg4b0b90_i386.deb

11th restart the machine to get the driver loaded at start. After that you can execute # ethercat master in terminal



Second Part : Installation of linuxcnc with lcec Hal Driver

1st Download sittner linuxcnc modification with lcec inside:
# git clone github.com/sittner/linuxcnc-ethercat.git linuxcnc-ethercat
# cd linuxcnc-ethercat

2nd # make

3rd # sudo make install

4th cd linuxcnc-ethercat/src

5th Build

6th make

7th sudo make install

8th . Copy the built binary to the ethercat directory : sudo cp lcec_conf /usr/bin/

9th restart


after all of this I get the following error when I run the example CDP17_x:


Debug file information:
Error: could not insert module /usr/realtime-3.4-9-rtai-686-pae/modules/linuxcnc/lcec.ko: Invalid parameters
./cpd17_x.hal:2: exit value: 1
./cpd17_x.hal:2: insmod for lcec failed, returned -1
See the output of 'dmesg' for more information.
4645
PID TTY STAT TIME COMMAND
Stopping realtime threads
Unloading hal components

how can I resolve this??


I have encountered the same problem with you, so whether you have resolved this or not?

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

More
08 Nov 2016 11:43 #82582 by Lixiaohui
Replied by Lixiaohui on topic Ethercat HAL driver
Maybe you have to confirm that you have connected the master and corresponding slave in the XML file.

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

More
09 Nov 2016 06:24 #82602 by cgc
Replied by cgc on topic Ethercat HAL driver
Hi,
what is your hardware?

regards Frank

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

More
02 Dec 2016 15:36 - 02 Dec 2016 20:13 #83580 by jerryCNC
Replied by jerryCNC on topic Ethercat HAL driver
Hi, Jolli:

I am studying AX5000 drive too, but fall far behind than you. When you wrote:
"...As linuxcnc-ethercat doesn't support SoE init configuration, I've tried to upload the data with a script using "ethercat soe_write" or by plugging ethercat cable to a machine running TwinCAT in config/freerun state. ..."

For so-called "ethercat soe_write", I guess you are calling "ecrt_master_write_idn()" from "lcec_write_master()", right?
Could you please provide the complete file for using "ethercat soe_write"?

Thanks
Jerry
Last edit: 02 Dec 2016 20:13 by jerryCNC.

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

More
08 Feb 2017 16:43 - 08 Feb 2017 16:46 #87582 by LinuxBen
Replied by LinuxBen on topic Ethercat HAL driver
Hello
I'm new to LinuxCNC and at the foot of steep learning curve as it seems.

My Beckhoff Devices/Modules:
- EK1101 Bus coupler, unsupported (the same as EK1100 which is supported, but the EK1101 has a selectable address)
- BK1250 K-Bus Translator, unsupported, enables to use of "old" K-Bus Devices on the EtherCat bus. Probably no own functionality but it maps any number of K-Bus-Devices.
- KL1104, 4 Inputs
- KL2114, 4 Outputs
- 4 pieces of KL2531, Stepper Drivers

What worked on Linux:
- LinuxCNC 2.7 wheezy installed.
- EtherCat Hal driver installed : wiki.linuxcnc.org/cgi-bin/wiki.pl?EtherCatDriver
- I can see the connected devices
user@phywe:~/linuxcnc/configs/phywe$ ethercat slaves
0 0:0 PREOP + EK1101 EtherCAT-Koppler (2A E-Bus, ID-Switch)
1 0:1 PREOP + BK1250 Koppler zwischen E-Bus- und K-Bus-Klemmen

What worked on Windows:
- Visual Studio install
- Twincat 3
- I can connect the Windows Box to the Beckhoff device and see the nodes of the devices.

So far so good.
But as you maybe know, the Beckhoff devices from my setup are not supported by the ethercat driver. So I assume I have to use generic type in XML configuration.
Questions:
1. If the EtherCatDriver does not support the Beckhoff Modules I have, then I still can use them by creating a "generic type" XML file for them?
2. I struggled to find a way to extract the "sdo" and "syncmaster" stuff. Where can I do it? I only found the option "Export XML Description" under the "TwinCat" Tab in Visual Studio. Please see the attached files.
3. If I will be able to compile that XML file, what is the way to test it? Is it ok to load the XML with
halrun
and then
halcmd: loadusr -W lcec_conf /home/user/linuxcnc/configs/phywe/ethercat-conf.xml
and some more commands? I'm still investigating this...sorry

Unfortunately I don't have any of the already implemented devices found on the web, so I cannot compare XML outputs.
If somebody has a pro-tip, you are welcome!
Ben
Attachments:
Last edit: 08 Feb 2017 16:46 by LinuxBen. Reason: Attachments are in the middle of the text, sorry for this.

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

More
08 Feb 2017 16:58 - 08 Feb 2017 16:59 #87586 by sirop
Replied by sirop on topic Ethercat HAL driver

Questions:
1. If the EtherCatDriver does not support the Beckhoff Modules I have, then I still can use them by creating a "generic type" XML file for them?
2. I struggled to find a way to extract the "sdo" and "syncmaster" stuff. Where can I do it? I only found the option "Export XML Description" under the "TwinCat" Tab in Visual Studio. Please see the attached files.
3. If I will be able to compile that XML file, what is the way to test it? Is it ok to load the XML with
halrun
and then
halcmd: loadusr -W lcec_conf /home/user/linuxcnc/configs/phywe/ethercat-conf.xml
and some more commands? I'm still investigating this...sorry

Unfortunately I don't have any of the already implemented devices found on the web, so I cannot compare XML outputs.
If somebody has a pro-tip, you are welcome!
Ben


1. Yes, you can.

2. linuxcnc-ethercat uses the so called raw SDO. It is a toil. So rather preconfigure your slaves with a bash scripts consisting of
ethercat download -PNumber -tType Index Subindex Value
See, for instance, github.com/sirop/linuxcnc-ethercat/blob/...pley/setPDO_FAULT.sh .

What do you mean by "syncmaster" stuff? A Hex value for DC configuration? This can be read out from your ESI xml file.

3. Yes, that's right.
Last edit: 08 Feb 2017 16:59 by sirop. Reason: typo
The following user(s) said Thank You: Nico2017

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

Time to create page: 0.192 seconds
Powered by Kunena Forum