Ethercat HAL driver

More
26 Jun 2013 22:01 #36084 by willrat
Replied by willrat on topic Ethercat HAL driver
I'm no expert but I've got it working with an EK1100 on both e1000 and r8169 network cards with a variety of slave modules. Here what I would do...

I'm not using the etherlab control as outlined by sascha. I just use the etherlab (1.5.2) package control scripts from the command line.
My config file is in /etc/ethercat.conf as per etherlab default but the modified version outlined on the wiki places it elsewhere... so you might have a problem there.

You should try to get the etherlab part running first -- so going to the etherlab mailing list may also be a good start.

First you can check that the module is the correct module it should be
sudo ethercatctl stop

check your 'normal' driver is e100 not e1000 or e1000e
lsmod | grep -i e100
if e100 is not listed then that might the problem

sudo ethercatctl start

note any errors; check dmesg for errors

then check the module is loaded
sudo lssmod | grep -i ec
you should have
ec_master
ec_e100

any module listed with a ec_ prefix is an ethercat module;

If that looks OK then run the ethercat command with -v to print more info.
Check dmesg after running
ethercat -v master
The following user(s) said Thank You: ccdodo

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

More
04 Jul 2013 13:14 #36297 by ccdodo
Replied by ccdodo on topic Ethercat HAL driver
Thanks very much for your answer! I de-installed the package 'ethercat_1.5.2-1_i386.deb', and then reinstalled the ethercat master by using etherlab source code. Finally , it works.
I just follow the etherlab's doc:

$ ./configure
$ make
$ make modules

# make install
# make modules install
# depmod

cd /opt/etherlab
cp etc/sysconfig/ethercat /etc/sysconfig/
ln -s etc/init.d/ethercat /etc/init.d/

then customize the sysconfig file /etc/sysconfig/ethercat
start the master
/etc/init.d/ethercat start

and I can find the master and slaves.
$ sudo /opt/etherlab/bin/ethercat -v master
Master0
Phase: Idle
Active: no
Slaves: 4
Ethernet devices:
Main: e0:05:c5:eb:5a:7f (attached)
Link: UP
Tx frames: 35480
Rx frames: 35479
Lost frames: 0
Tx bytes: 2148072
Tx errors: 0
Tx frame rate [1/s]: 250 780 458
Tx rate [KByte/s]: 14.6 46.1 27.1
Loss rate [1/s]: 0 0 0
Frame loss [%]: 0.0 0.0 0.0

Backup: None.
Distributed clocks:
Reference clock: Slave 0
Application time: 0
2000-01-01 00:00:00.000000000





sudo /opt/etherlab/bin/ethercat -v slave
=== Master 0, Slave 0 ===
State: PREOP
Flag: +
Identity:
Vendor Id: 0x00000002
Product code: 0x044c2c52
Revision number: 0x00110000
Serial number: 0x00000000
DL information:
FMMU bit operation: no
Distributed clocks: yes, 64 bit
DC system time transmission delay: 0 ns
Port Type Link Loop Signal NextSlave RxTime [ns] Diff [ns] NextDc [ns]
0 MII up open yes - 3877337170 0 0
1 EBUS up open yes 1 3877338060 890 145
2 MII down closed no - - - -
3 N/A down closed no - - - -
General:
Group: SystemBk
Image name:
Order number: EK1100
Device name: EK1100 EtherCAT-Koppler (2A E-Bus)
Flags:
Enable SafeOp: no
Enable notLRW: no
Current consumption: -2000 mA
=== Master 0, Slave 1 ===
State: PREOP
Flag: +
Identity:
Vendor Id: 0x00000002
Product code: 0x07d83052
Revision number: 0x00100000
Serial number: 0x00000000
DL information:
FMMU bit operation: no
Distributed clocks: yes, 64 bit
DC system time transmission delay: 145 ns
Port Type Link Loop Signal NextSlave RxTime [ns] Diff [ns] NextDc [ns]
0 EBUS up open yes 0 3816389530 0 145
1 EBUS up open yes 2 3816390130 600 145
2 N/A down closed no - - - -
3 N/C down closed no - - - -
General:
Group: DigOut
Image name:
Order number: EL2008
Device name: EL2008 8K. Dig. Ausgang 24V, 0.5A
Flags:
Enable SafeOp: no
Enable notLRW: no
Current consumption: 110 mA
=== Master 0, Slave 2 ===
State: PREOP
Flag: +
Identity:
Vendor Id: 0x00000002
Product code: 0x03f03052
Revision number: 0x00100000
Serial number: 0x00000000
DL information:
FMMU bit operation: no
Distributed clocks: yes, 64 bit
DC system time transmission delay: 290 ns
Port Type Link Loop Signal NextSlave RxTime [ns] Diff [ns] NextDc [ns]
0 EBUS up open yes 1 2666310340 0 145
1 EBUS up open yes 3 2666310650 310 155
2 N/A down closed no - - - -
3 N/C down closed no - - - -
General:
Group: DigIn
Image name: TERM_DI
Order number: EL1008
Device name: EL1008 8K. Dig. Eingang 24V, 3ms
Flags:
Enable SafeOp: no
Enable notLRW: no
Current consumption: 90 mA
=== Master 0, Slave 3 ===
State: PREOP
Flag: +
Identity:
Vendor Id: 0x00000002
Product code: 0x09d93052
Revision number: 0x03fb0000
Serial number: 0x00000000
DL information:
FMMU bit operation: no
Distributed clocks: yes, 64 bit
DC system time transmission delay: 445 ns
Port Type Link Loop Signal NextSlave RxTime [ns] Diff [ns] NextDc [ns]
0 EBUS up open yes 2 3745942530 0 155
1 EBUS down closed no - - - -
2 N/A down closed no - - - -
3 N/C down closed no - - - -
Mailboxes:
Bootstrap RX: 0x1000/244, TX: 0x10f4/244
Standard RX: 0x1200/54, TX: 0x1280/54
Supported protocols: CoE, FoE
General:
Group: DigOut
Image name:
Order number: EL2521
Device name: EL2521 1K. Pulse Train Ausgang
CoE details:
Enable SDO: yes
Enable SDO Info: yes
Enable PDO Assign: yes
Enable PDO Configuration: no
Enable Upload at startup: no
Enable SDO complete access: yes
Flags:
Enable SafeOp: no
Enable notLRW: no
Current consumption: 280 mA
The following user(s) said Thank You: 8vracer

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

More
08 Aug 2013 03:00 #37489 by sascha
Replied by sascha on topic Ethercat HAL driver
This sould also work with the ethercat deb. I've just modified the way of loading modules and configuration to be a little bit more "debian like", but the doc is not complete.

If using the deb after changing the conf in /etc/default/ethercat just do a "sudo update-ethercat-config". This will activate the new configuration.

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

More
17 Oct 2013 04:09 #39986 by Oscmol
Replied by Oscmol on topic Ethercat HAL driver
Hi

I have some questions about this HAL driver for the ethercat.
I did see that it says that it supports distributed clocks is this also for the servo drives?
Would it work to connect 5 servodrives over ethercat and interpolate them or this driver is not made for that kind of tasks?

We are using ethercat drives at my work, so i have good knowledge about this bt not with this HAL driver and Linux CNC.

Is there any one using servos like i wonder and have good result or its better to go for the old style with analog and pulse signals?


Best regards
Oscar

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

More
17 Oct 2013 14:08 #39994 by nursum
Replied by nursum on topic Ethercat HAL driver
Hello Oscar,

I plan to fit my milling machine with Ethercat controlled drives (actually +/- 10V). All hardware is still here but the time is the problem!
Do you have scills about the mapping of the SDO and PDO objects with Ethercat and here especialy with the drives? You have to go very deep in the CAN over Ethercat protocol.....

Ingo (Germany)

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

More
18 Oct 2013 01:08 #40025 by sascha
Replied by sascha on topic Ethercat HAL driver
Hi Oscar,

it supports DC for any device that supports DCs. Please find here an example for a machine with stoeber servo inverters:
<masters>
  <master idx="0" appTimePeriod="1000000" refClockSyncCycles="1000">
    <slave idx="0" type="EK1100"/>
    <slave idx="1" type="EL1008"/>
    <slave idx="2" type="EL1008"/>
    <slave idx="3" type="EL1008"/>
    <slave idx="4" type="EL2008"/>
    <slave idx="5" type="EL5101"/>
    <slave idx="6" type="EL9510"/>
    <slave idx="7" type="EL3162"/>
    <slave idx="8" type="EK1100"/>
    <slave idx="9" type="EL1008"/>
    <slave idx="10" type="EL1008"/>
    <slave idx="11" type="EL1008"/>
    <slave idx="12" type="EL1008"/>
    <slave idx="13" type="EL1008"/>
    <slave idx="14" type="EL2008"/>
    <slave idx="15" type="EL5152"/>
    <slave idx="16" type="EL2008"/>
    <slave idx="17" type="EL2008"/>
    <slave idx="18" type="StMDS5k">
      <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="-25000"/>
      <watchdog divider="2498" intervals="5000"/>
    </slave>
    <slave idx="19" type="StMDS5k">
      <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="-25000"/>
      <watchdog divider="2498" intervals="5000"/>
    </slave>
    <slave idx="20" type="StMDS5k">
      <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="-25000"/>
      <watchdog divider="2498" intervals="5000"/>
    </slave>
    <slave idx="21" type="StMDS5k">
      <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="-25000"/>
      <watchdog divider="2498" intervals="5000"/>
    </slave>
    <slave idx="22" type="StMDS5k">
      <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="-25000"/>
      <watchdog divider="2498" intervals="5000"/>
    </slave>
    <slave idx="23" type="StMDS5k">
      <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="-25000"/>
      <watchdog divider="2498" intervals="5000"/>
    </slave>
  </master>
</masters>

First you need too tell the master to sync its clock to the slaves:
  <master idx="0" appTimePeriod="1000000" refClockSyncCycles="1000">
where appTimePeriod has to match the servo period (in ns) and refClockSyncCycles tells how many servo periods to skip between the actual syncs (This sould not be too low to smooth the jitter).

Then you can configure the sync for each device:
      <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="-25000"/>
assignActivate is the hex code from the device's device description xml, sync0Cycle "*1" means to sync on every cycle and sync0Shift is the sync offset (in ns) to reduce the impact of jitter.

What kind of inverter do you plan to use? You can use the generic driver to interface that device (please see one of my earlier posts for an example), but real fun will appear if you build an native driver module for a particular inverter that do all the dirty work like scaling, reading SDOs on initialization and exporting pins with the domain specific data types. The lcec_stmds5k.c or lcec_el7342.c might be good starting points for that (stmds5k is the stoeber inverter and el7342 a dc motor driver with encoder fedback).

Regards
Sascha

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

More
21 Oct 2013 02:18 - 21 Oct 2013 02:21 #40100 by roschi
Replied by roschi on topic Ethercat HAL driver
Hello Oscar,

I used the "generic" EtherCat driver from Sascha Ittner for Bosch Rexroth Indradrives.
I've added a parameter to the XML file in the generic slave entry which does a simple scaling (meens also adjusting some code from Sascha Ittner). Nothing else was changed in the generic driver. All other settings can be made directly in the drive.

See Post

or
video from setup on youtube
Last edit: 21 Oct 2013 02:21 by roschi.

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

More
21 Oct 2013 17:25 #40121 by Coyote
Replied by Coyote on topic Ethercat HAL driver
Good work from Sascha is yet giving results.
I would ask some few things:
1. Sascha did a driver that has also a generic that you can modify and save for use with new hardware. This is comlicated for somebody that has no experience in doing that (like me). Is it possible that someday, somebody will write a parser from configuration XML files to EMC2? On Beckhoff site you can dowload the entire product line with XML conf files, except AX5xxx servos. It wouldn't be simpler to copy directory (or xml files from other hw makers) to emc2 directory and simply selecting them - I know that isn't easy and what we do have now is quite good, but...

2. I downloaded servo AX5xxx conf files in XML format, all I have seen is that servo drives series 5000 from Beckhoff use Sercos over Ethercat (SoE), will be possible in future to implemet also SoE devices?

3. Is it possible to have a quick tutorial how to make a driver from Sascha's generic one, if you get an XML file with PDOs ?


Anyway thank you for the contribution (Sascha, Etherlab) you already did, it changed emc2 from hobby to professional.

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

More
21 Oct 2013 17:53 #40122 by andypugh
Replied by andypugh on topic Ethercat HAL driver

Coyote wrote: 1. Sascha did a driver that has also a generic that you can modify and save for use with new hardware. This is comlicated for somebody that has no experience in doing that (like me). Is it possible that someday, somebody will write a parser from configuration XML files to EMC2?


We aren't allowed to use the four characters "EMC2" any more, we have had to rebrand everything as "LinuxCNC".

Anyway, as far as I can see, the config files for the LinuxCNC Ethercat driver are XML files. It may be that the ones you can download will just work.

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

More
22 Oct 2013 01:59 #40141 by roschi
Replied by roschi on topic Ethercat HAL driver

Coyote wrote: 1. Sascha did a driver that has also a generic that you can modify and save for use with new hardware. This is comlicated for somebody that has no experience in doing that (like me). Is it possible that someday, somebody will write a parser from configuration XML files to EMC2? On Beckhoff site you can dowload the entire product line with XML conf files, except AX5xxx servos. It wouldn't be simpler to copy directory (or xml files from other hw makers) to emc2 directory and simply selecting them - I know that isn't easy and what we do have now is quite good, but...
.

I think we are not that far away from that. See the tutorial.

Coyote wrote: 2. I downloaded servo AX5xxx conf files in XML format, all I have seen is that servo drives series 5000 from Beckhoff use Sercos over Ethercat (SoE), will be possible in future to implemet also SoE devices?


The configuration of drives with SoE is not (yet) possible with the HAL-Driver for EtherCAT. Therefore you have to build a state machine within the init phase of the HAL-driver itself. That’s because some of the IDN’s can only be written in Bus-INIT Phase and some should be written to the drive in the Bus-PreOP Phase. (The tool EtherCAT Configurator from Beckhoff, free download does this). Because you have to do this only once, from my point of view there is no great need to implement in the HAL-Driver SoE support in a general way for different Bus-Phases. It is 'nice to have'.

Coyote wrote: 3. Is it possible to have a quick tutorial how to make a driver from Sascha's generic one, if you get an XML file with PDOs ?


I have written a little tutorial that work for the IndraDrive Cs from Bosch Rexroth. If you plan to do the scaling in the HAL-Setup you can use the generic driver as it is without programming. (Just position command, position feedback and enable inverter) I think it should work also for Beckhoff, AMK, LTI drives because the Content of the XML files from manufacturer is standarized

Tutorial on Google Docs
Please feel free to comment directly in the document or correct my english.

Best Regards Andreas

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

Time to create page: 0.105 seconds
Powered by Kunena Forum