Ethercat HAL driver

More
19 Apr 2021 12:09 - 21 Apr 2021 09:06 #206378 by Stormholt
Replied by Stormholt on topic Ethercat HAL driver
Hello again db1981 :lol:

I would love to have a virtual com port for the device, but i think either way i would make it work with my device

Edit:
On windows i can see that twincat has a Virtual Com port application.
How would one achieve similar application with linuxcnc ethercat ?
Last edit: 21 Apr 2021 09:06 by Stormholt.

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

More
21 Apr 2021 12:17 #206636 by Zydra
Replied by Zydra on topic Ethercat HAL driver
Driver for EL6021 would be nice for controlling servos over Beckhoff Ethercat.
I think it's not critical if its implemented with rx and tx buffers or with linux virtual com port.
Maybe with buffers its easier to handle inside hal files by having read/write interface similar to pins.

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

More
21 Apr 2021 14:54 - 22 Apr 2021 10:07 #206656 by Stormholt
Replied by Stormholt on topic Ethercat HAL driver
I am not sure where to share stuff like this, but i tried my hand at writing a driver for EL3004 analog input 4 channels, 12 bits, single ended, +/-10V

This my first encounter with writing a driver, so let me know how it might be improved.
Attachments:
Last edit: 22 Apr 2021 10:07 by Stormholt.

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

More
22 Apr 2021 13:33 - 22 Apr 2021 13:40 #206793 by Grotius
Replied by Grotius on topic Ethercat HAL driver
Hi Stormhold,

I checked your code..

There is something i noticed at compile time. If the project is loaded in Qt, you can see if everything is ok.
In this case something was not found.


Solved with :;)


Did you mention this before during halcompile?

Ok qt halcompile project attached, your driver is attached, it works without update status i suggest.. B)
github.com/grotius-cnc/Linux-Embedded/re...ile-qt-el3004.tar.gz

To open the project, in qt load the file : qt-test.creator , then check the howto-pictures in the archive.
Attachments:
Last edit: 22 Apr 2021 13:40 by Grotius.
The following user(s) said Thank You: Stormholt

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

More
22 Apr 2021 14:56 #206800 by Stormholt
Replied by Stormholt on topic Ethercat HAL driver
How very embarrassing... a misspelling :blush: :sick: a new file is attached

I don't quite understand the 'how to pictures', am i supposed to write a test.c file? or was there supposed to be one in the tarball?

I have no experience with qt creator, but it seems nice to know :lol:
Attachments:

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

More
22 Apr 2021 18:27 - 22 Apr 2021 18:35 #206826 by Grotius
Replied by Grotius on topic Ethercat HAL driver
Hi Stormhold,

The howto pictures are a example how to set some things in qt. They belong to a previous example wich contains a test.c file :
github.com/grotius-cnc/Linux-Embedded/re...halcompile-qt.tar.gz

If you can load above example in qt, you know how to load your archive in qt.
Above example show's how to compile a single component with halcompiler in a .so file.

Your driver now compiles okey. Updated archive :
github.com/grotius-cnc/Linux-Embedded/re...ile-qt-el3004.tar.gz

For the lcec driver, qt uses a linuxcnc-ethercat makefile. This seemed to be the quickest option.
But you have to take a look in
config.mk and configure.mk, set the correct path's over there.

If you have a skynet install with linuxcnc in the /opt/linuxcnc/ folder, you are already configured. B)

If you have some question's, no problem.
Last edit: 22 Apr 2021 18:35 by Grotius.
The following user(s) said Thank You: Stormholt

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

More
26 Apr 2021 16:09 #207135 by JKAVS
Replied by JKAVS on topic Ethercat HAL driver
I just received Delta ASDA B3 servo kit. To my understanding I need the XML file for the generic driver to get it working. There was discussion on some older messages that the XML file should be possible to generate automatically from the file provided by the device manufacturer. At that time such a tool didn't exist. Is this still the case or is there a tool like that?

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

More
26 Apr 2021 23:39 #207186 by Grotius
Replied by Grotius on topic Ethercat HAL driver
Hi,

I think this tool don't exist for linux-ethercat.

So far i know people use Twincat to retrieve data like xml files. Ethercat cstruct is also usefull.
At the moment i don't have the data to write such a tool. This input data has to come from experienced servo users.

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

More
27 Apr 2021 06:59 - 27 Apr 2021 08:13 #207200 by Hakan
Replied by Hakan on topic Ethercat HAL driver
I just went through the process of setting up my first ethercat motion driver, a stepper driver, but for all relevant parts this is the same as setting up a servo driver.
The delta servo driver is a CiA 402 device. "CanOpen over Ethernet"

Go to github.com/dbraun1981/hal-cia402 , download and install the cia402 component, get the example files and put that in your hal file.

CiA402 is standardized so the object numbers 6040 and so on are all ok.

You do need to have the right "vid" and "pid". You can get that by hooking up the servo drivers to the ethercat bus and enter the command
ethercat slaves -v
find the numbers for "Vendor ID" and "Product ID" and put that in in the vid and pid fields.
Now it should work.

So you want to change settings of the driver? You can't do that with the pdoEntry way, you need to use the
<sdoConfig idx="60C2" subIdx="1"><sdoDataRaw data="01"/></sdoConfig>
And remember that the bytes are little endian ordered.

You need the manual to know what object number to change and which value to set. In this manual downloadcenter.deltaww.com/downloadCente...5&DocPath=1&hl=en-US this is in chapter 11 CanOpen (here is where that canopen/cia comes in)


Or manually using the ethercat command
ethercat pdos                                   # List all PDOS
ethercat sdos                                   # List all SDOS
ethercat upload -p 0 -t int16 6040 0                      # Upload(read) value of 6040.0
ethercat download -p 0 -t int16 2020 0 13              # Download (write) number 13 to 2020.0 (imaginary number, but you get the point)


And no, I didn't use TwinCat
Last edit: 27 Apr 2021 08:13 by Hakan. Reason: link to right manual

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

More
11 May 2021 11:16 - 11 May 2021 11:20 #208535 by Nico2017
Replied by Nico2017 on topic Ethercat HAL driver
Hi all,
I have lately been facing a really strange case. I have a CNC set up with 4 IndraDrive in velocity command. I had to replace one of the drive and follow my standard procedure for installing a new one which is:
  • switch drives to Ethernet communication and reboot the drives
  • pushing the parameter file through Indraworks (engineering tool over IP for the drives) to the newly installed drive
  • switch drive to EtherCAT and reboot the drives
  • Get TwinCAT to establish an EtherCAT communication loop with all drives (scan for devices, ...) It seems that those drives somehow always require to be communicating under TwinCAT at least once to get the EtherCAT eventually working
  • unfotunatly my default EtherCAT slave description for TwinCAT for those drive is in pos command so it overrides the pdos from vel cmd configuration to pos command
  • so after TwinCAT I had to reswitch to Ethernet (reboot the drive), push again the parameters files through Indraworks for all my drives, then switch the drive to EtherCAT and reboot
  • so far the drive have always been working after this process

Supprisingly, without changing anything to my linuxcnc files (ini, hal, ethercat xml for the lcec), it seems that:
  • the EtherCAT is still working, I can get all feedback values (torque, pos, error,...), power them on and reset their reference
  • all the drives, including the ones I have not changed, do not move anymore (their motor do not move anymore). Their brake is released when the drive is enabled. There is a vel cmd being send correctly, the drive is powered and enable, no error message but it just does not react. I checked all the status words and control words set up through linuxcnc and everything is identical to one other identical machine currently working. Because the drives are not moving, I eventually hit the following error level defined in the .ini file

I was wondering if anyone had experienced something similar and if so could give me some hints or directions to look at.
Thank you for your help.

Nicolas
Last edit: 11 May 2021 11:20 by Nico2017. Reason: More precise description

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

Time to create page: 0.208 seconds
Powered by Kunena Forum