Beckhoff ethercat 64 with bit linuxcnc, How to install.

23 Feb 2024 18:30 #294099 by scottlaird
FWIW, the EL3068 should already be working in I have one in my test suite. I *think* all of the EL30xx and EL31xx devices should work, but I haven't actually looked for stragglers.

As for the EL5102 vs EL5101, a quick glance suggests that they're not actually all that close, register-wise:


That's unfortunate, as it means that we can't easily repurpose the EL5101 driver for the EL5102, unlike (say) the EL3xxx devices, most of which can share a driver (except, weirdly, for the EL31x2).

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

23 Feb 2024 20:24 #294112 by johntrevick
thanks for the reply. I'm going to work this weekend on upgrading to the latest linuxcnc version, not that it will help with this issue. My hope the two modules would be similar didn't work out. Buying two 5101 would be rather expensive.

I suppose I will have to learn a lot more about creating a file from scratch. I can't say I'm too confident but I'll give it a shot.
The following user(s) said Thank You: rodw

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

23 Feb 2024 22:36 #294131 by scottlaird
It's probably not *that* hard to get this working with a couple cheats :-).

I started to write them up here (first: remove the sync setup entirely, it's not really needed for most Beckhoff hardware and it makes things look more complex than they need to be), but decided that it'd probably be less work to just write a quick, untested el5102 driver as an example. Then you can work with that as a start for debugging.

Give me a couple hours to finish something else and I'll throw something together.
The following user(s) said Thank You: johntrevick

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

24 Feb 2024 00:54 #294153 by scottlaird
Okay, threw something together quickly. It compiles cleanly, and nothing seems *glaringly* wrong, but I don't have the hardware to test it and it's been a long day already :-). I'm not going to guarantee that it works at all, but hopefully when it fails it provides useful debugging data and doesn't just crash.

It should be tagged as v1.17.0, and packages are building and should be available in a couple minutes. You're probably better off downloading from and compiling yourself, if you're up to debugging and fixing a few bugs.

At a minimum, this defines ~10 control bits and ~13 status bits, but only exposes about half of them as HAL pins. Odds are we don't care about all of them, but it'd be nice if someone was willing to think about it a bit and then add the remaining useful pins (plus code in the read/write functions, should be pretty straightforward) *or* just delete the unused ones.

The hardware also supports a second latch value; we're mapping that but not exporting it to HAL. Pretty much the same logic applies there as above.

Let me know how it goes.

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

24 Feb 2024 05:23 #294175 by bob8020
The EL3068 is working just fine here with an install from current .iso. Using it to measure vacuum with a 0-10v vacuum sensor and we halt motion if vacuum not sufficient.

Set scale to 10 and val reads 0-10v, into lincurve to get inches of mercury.

I've never used TwinCat... just linuxcnc :)

As it has 8 inputs would be a good choice if you want some manual knobs to turn, just feed 0-10v from a few pots and hook up the pins in hal.
The following user(s) said Thank You: scottlaird

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

24 Feb 2024 22:43 - 24 Feb 2024 22:47 #294273 by johntrevick
First off - thank you, thank you for your help.

Sorry for the delay answering - I thought I'd "save time" by making sure I was up to date by doing a fresh install and going to a rpi 5.   Only to find out that realVNC no longer works under bookworm and I couldn't get tigerVNC running.

quick note here:  the device has moved from my last posts from index 7 to 8 as I added another el1008 card in front of it.

If I have el5101 in the my config linuxcnc starts up and ethercat appears to be working for all devices except of course the el5102.

When I put el5102 in the ethercat-conf.xml it fails to start.
Here is the error:

LINUXCNC - 2.9.2
Machine configuration directory is '/home/cnc/linuxcnc/configs/wedm'
Machine configuration file is 'wedm.ini'
Starting LinuxCNC...
linuxcnc TPMOD=tpmod HOMEMOD=homemod EMCMOT=motmod
Note: Using POSIX realtime
Found file(REL): ./wedm_cmds.hal
Failed to register PDO entry: No such file or directory
LCEC: master 0 PDO entry registration failed
LCEC: failure, clearing config
LCEC: exiting
LCEC: returning -EINVAL
lcec: rtapi_app_main: Invalid argument (-22)
./wedm_cmds.hal:8: waitpid failed /usr/bin/rtapi_app lcec
./wedm_cmds.hal:8: /usr/bin/rtapi_app exited without becoming ready
./wedm_cmds.hal:8: insmod for lcec failed, returned -1
Shutting down and cleaning up LinuxCNC...
Note: Using POSIX realtime
LinuxCNC terminated with an error.  You can find more information in the log:
as well as in the output of the shell command 'dmesg' and in the terminal

In dmesg I get the following:

[ 1800.725115] EtherCAT 0: Starting EtherCAT-OP thread.
[ 1801.977068] EtherCAT ERROR 0-11: Failed to read mapped PDO entry.
[ 1801.977076] EtherCAT WARNING 0-11: Failed to read PDO entries for PDO 0x1600.
[ 1802.055062] EtherCAT WARNING 0-11: Failed to map PDO entry 0x60FF:00 (32 bit) to position 4.
[ 1802.055070] EtherCAT WARNING 0-11: Currently mapped PDO entries: 0x0000:00/0 0x0000:00/0 0x0000:00/0 0x0000:00/0. Entries to map: 0x6040:00/16 0x6060:00/8 0x607A:00/32 0x60FF:00/32
[ 1802.055086] EtherCAT WARNING 0-11: Failed to configure mapping of PDO 0x1600.
[ 1802.086095] EtherCAT WARNING 0-11: Failed to set number of assigned PDOs of SM2.
[ 1802.086117] EtherCAT WARNING 0-11: Currently assigned PDOs: (none). PDOs to assign: 0x1600
[ 1802.086130] EtherCAT WARNING 0-11: PDO configuration failed.
[ 1802.093055] EtherCAT ERROR 0-11: Failed to set SAFEOP state, slave refused state change (PREOP + ERROR).
[ 1802.094050] EtherCAT ERROR 0-11: AL status message 0x001E: "Invalid input configuration".
[ 1802.099055] EtherCAT 0-11: Acknowledged state PREOP.
[ 1802.103786] EtherCAT 0: Slave states on main device: PREOP, OP.
[ 1802.591778] EtherCAT WARNING: Datagram 000000003afefe45 (master-fsm) was SKIPPED 1 time.
[ 1802.727777] EtherCAT WARNING 0: 1 datagram UNMATCHED!
[ 1854.035335] EtherCAT 0: Master thread exited.
[ 1854.035432] EtherCAT 0: Starting EtherCAT-IDLE thread.
[ 1854.035505] EtherCAT 0: Releasing master...
[ 1854.035507] EtherCAT 0: Released.
[ 1854.091942] EtherCAT ERROR 0-9: AL status message 0x001B: "Sync manager watchdog".
[ 1854.092208] EtherCAT 0-9: Acknowledged state SAFEOP.
[ 1854.247696] EtherCAT 0: Slave states on main device: PREOP.
[ 1868.594153] EtherCAT: Requesting master 0...
[ 1868.594166] EtherCAT: Successfully requested master 0.
[ 1868.720697] EtherCAT ERROR 0 0:8: PDO entry 0x6000:13 is not mapped.
[ 1868.720909] EtherCAT 0: Releasing master...
[ 1868.721003] EtherCAT 0: Released.

The el3068 is working.  I have four potentiometers reading scale 0-10 and two with scale 0-11.   
And before you say "These go to eleven" the machine is from 1980 and Spinal Tap movie is from 1984.  
Last edit: 24 Feb 2024 22:47 by johntrevick.

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

24 Feb 2024 23:21 #294280 by scottlaird
Okay, interesting. So device #8 is the EL5102, and #10 and #11 are "DVS_ETHCAT_v1.004", right?

The error in dmesg is griping about slave #11, not slave #8, and the objects that it's griping about (0x6040:00, 0x6060:00, 0x607a:00, and 0x60ff:00) are what I'd expect to see with a CiA 402 servo or stepper drive.

If you comment out #11 in your XML, what happens?

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

24 Feb 2024 23:22 #294281 by scottlaird
Ahh, now I notice -- there's also a gripe for #8, about 0x6000:13, which is the frequency reading. Let me see what's up with that...

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

24 Feb 2024 23:34 #294284 by johntrevick
yes, 10 and 11 are cheap Chinese ethercat servo drives.
I haven't done much with them yet other than getting them to move.
I have a file DVS_ETHCAT_V1.12.xml config information from the vendor but I'm not sure what to do with it.

A little bit more information on the machine - the ethercat servo drives go through a 30:1 gear reduction and a 2:1 belt reduction to a ballscrew (0.100" per revolution)

Each ballscrew has a directly mounted encoder (5000 ppr) which is what I'm trying to hook up to the EL5102. The gear reducer has some backlash in it.

This is the way the machine was originally constructed. I'm not sure how I'll handle the encoder feedback vs drive feedback to linuxcnc but first I have to get all the bits working. I know I've seen similar done with motor encoders closing the loop to the drive and separate encoders or linear scales closing the loop to linuxcnc for position. Anyway, that's a problem for future me.

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

24 Feb 2024 23:38 #294285 by scottlaird
Got it. I'm currently alternating between poking at the EL5102 driver, writing generic CiA 402 stepper/servo control code, and playing with autogenerating XML files, so hopefully some or all of that will come in handy for you in the near future :-).

I just checked in a partial fix for the EL5102, it should show up as v1.17.1 shortly. For now, it just disables the 'frequency' and 'period' data. It shouldn't be that hard to fix, but it's probably not *terribly* useful for most people, and it'd be good to know that it's working without them first.

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

Time to create page: 0.144 seconds
Powered by Kunena Forum