Ethercat HAL driver

More
27 Oct 2018 00:35 - 27 Oct 2018 03:32 #119494 by Grotius
Replied by Grotius on topic Ethercat HAL driver
Hi,

I have a general question about the Ethercat.comp file used with Linuxcnc.
Here is a sample of 2 found ethercat.comp file's

Version 1. wiki.linuxcnc.org/cgi-bin/wiki.pl?Contri...EtherCAT_Digital_I_O
Version 2. wiki.linuxcnc.org/cgi-bin/wiki.pl?Etherlab

Version 1:
Warning: Spoiler!


Version 2:
Warning: Spoiler!


If you want to compile the ethercat.comp file with latest version of linuxcnc it will not compile.
It has to do with librarie's, and much more. Okey a lot to solve in the component code.

Find out the error code's yourself : sudo halcompile --install ethercat.comp

My idea is to start working on a new ethercat.comp file.
If we get one good ehercat.comp file, that would also a very good Ethercat start option for today's linuxcnc user's i think.
A example : integrating ethercat in a custom made linuxcnc version is now a bit of a problem. In my opinion that is not documented before.

Here is my start of the new component, it compiles without issues :
Warning: Spoiler!
Last edit: 27 Oct 2018 03:32 by Grotius.

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

More
28 Oct 2018 19:26 - 06 Nov 2018 22:43 #119562 by Nico2017
Replied by Nico2017 on topic Ethercat HAL driver
Hi @Grotius,
it does actually help.
The /dev/Ethercat0 was already there but with some restrained permission so after a sudo chmod a+rwx Ethercat0, the linuxcnc 2.7 and linuxcnc 2.8 were able to carry on.The only issue is I have to do that everytime I log in as the permission seems not to be saved for some reason. Any idea about how I could make the permission permanent?

Edit: to make the /dev/EtherCAT0 usage permanent just do sudo adduser $USER ethercat, and/or sudo adduser root ethercat then you have to reboot (see post askubuntu.com/questions/373096/how-do-i-...ssions-for-dev-ttys0 for a similar case.)

However it did show another error for linuxcnc 2.8, which I believe is link to an error seen on the make of the linuxcnc-ethercat.

Using the linuxcnc-ethercat last commit:
commit b02252a79d11f1c9dd5884bac1a53743b3818d39
Merge: 22bcaa9 333dec5
Author: Sascha Ittner <This email address is being protected from spambots. You need JavaScript enabled to view it.>
Date: Fri Aug 17 16:37:32 2018 +0200

Merge pull request #60 from sittner/add-fsoe-support

Add fsoe support

I obtain
LINUXCNC - 2.8.0~pre1
Machine configuration directory is '/home/laminator/linuxcnc/configs/LAMGUI'
Machine configuration file is 'lam.ini'
Starting LinuxCNC...
Found file(REL): ./lam-v1.hal
Note: Using POSIX realtime
lcec: dlopen: /usr/lib/linuxcnc/modules/lcec.so: undefined symbol: rtapi_mutex_get
./lam-v1.hal:2: waitpid failed /usr/bin/rtapi_app lcec
./lam-v1.hal:2: /usr/bin/rtapi_app exited without becoming ready
./lam-v1.hal:2: 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:
/home/laminator/linuxcnc_debug.txt
and
/home/laminator/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal

Using the linuxcnc-ethercat commit:
commit 7b1e4bb0bb0b5886486b98fc2511b2333402ad0d
Author: Sascha Ittner <This email address is being protected from spambots. You need JavaScript enabled to view it.>
Date: Sat Mar 10 10:03:44 2018 +0100

use linuxcnc's Makefile.modinc to build RT component

I obtain:

LINUXCNC - 2.8.0~pre1
Machine configuration directory is '/home/laminator/linuxcnc/configs/LAMGUI'
Machine configuration file is 'lam.ini'
Starting LinuxCNC...
Found file(REL): ./lam-v1.hal
Note: Using POSIX realtime
lcec: dlopen: /usr/lib/linuxcnc/modules/lcec.so: undefined symbol: ecrt_slave_config_sdo
./lam-v1.hal:2: waitpid failed /usr/bin/rtapi_app lcec
./lam-v1.hal:2: /usr/bin/rtapi_app exited without becoming ready
./lam-v1.hal:2: 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:
/home/laminator/linuxcnc_debug.txt
and
/home/laminator/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal

I believe this is related to the last post on github.com/sittner/linuxcnc-ethercat/issues/57 > and github.com/sittner/linuxcnc-ethercat/issues/61

Any idea how to avoid this error?

Thanks a lot for the help,
Nicolas
Last edit: 06 Nov 2018 22:43 by Nico2017. Reason: More precise answer

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

More
28 Oct 2018 20:18 - 28 Oct 2018 20:30 #119566 by Grotius
Replied by Grotius on topic Ethercat HAL driver
Okey guy's,

I have some news. Struggling with include files in hal.
Done some test's. I needed the "/opt/etherlab/include/ecrt.h" to work with linuxcnc hal. In hal we can couple a lot of stuff.
Nothing happened and linuxcnc refused to load dlopen .....
So i start from zero with a sucesfull test to that directory, to print some info.
Next thing will be integrating a bigger file.

in postgui.hal
loadrt ethercat
addf ethercat servo-thread

ethercat component, ethercat.comp :
(compiled in terminal by : sudo halcompile --install ethercat.comp)
component ethercat"ethercat";

description 
"""

Test Component

""";

author "Grotius CNC Machines, started Oktober 2018";

license "GPL";

option singleton yes;

//Input hal connection :
pin in bit Testpin_in            "Enable this component";

//Output hal connection :
pin out bit Testpin_out          "Connect to user gui led";



function _;

;;

#include <stdio.h>
#include "/opt/etherlab/include/external_file.h"

typedef enum { INIT, SELECT} state_T;
state_T state = INIT;


FUNCTION(_) {  

    switch(state){

         case INIT:
          
         state = SELECT;           
         break;

    case SELECT:
    
        // do something with the include file
        
        function_print();

        break;

    }     

}

The external_file.h is located in directory : /opt/etherlab/include/external_file.h

The file below is : external_file.h (it is a short file, only containing a function with a print message, for fun, function is in fact : () )
Inside the function we say only print some info :
#include<stdio.h>

	int function_print()
	{
	
		printf("external file print");
	    return 0;
	}

Output in linuxcnc terminal :


So i think this is a first start to use Ethercat to Linuxcnc hal for me.
Attachments:
Last edit: 28 Oct 2018 20:30 by Grotius.

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

More
07 Nov 2018 00:36 #120133 by gbcwbz
Replied by gbcwbz on topic Ethercat HAL driver
Hi Nicolas,

Please refer to IgH Master 1.5.2 Documentation Chapter 9.5

The device nodes will be created with mode 0660 and group root by default. If “nor-
mal” users shall have reading access, a udev rule file (for example /etc/udev/rules.d/99-
EtherCAT.rules) has to be created with the following contents:

KERNEL ==" EtherCAT [0 -9]*" , MODE ="0664"


Then you can use that device as non-root user.

Regards
Bryan
The following user(s) said Thank You: Nico2017

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

More
09 Nov 2018 17:44 #120339 by chimeno
Replied by chimeno on topic Ethercat HAL driver

@ Chimeno

edit the file "lcec_el40x4.h" add the PID number yourself, from where you get it, then the terminal executes this command "ethercat slave -v" will leave the "product code" that is, you also have to add the module to the following files, "Kbuild, lcec_conf.h, lcec_conf.c, lcec_main.c, I think that is everything, if you have more questions ask me, I will try to help you.
regards
Chimeno


I've followed these instructions, ran make, make install, reboot but I only get two out of four channels coming up. Any idea? Bad terminal?

Kind regards,
Dan


Hello dan,
I've been very busy with projects, now I have some free time, have you gotten it to work?

regards
Chimeno

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

More
12 Nov 2018 01:54 #120473 by sqmathlete
Replied by sqmathlete on topic Ethercat HAL driver
@chimeno

Unfortunately no, I ended up ordering an EL4102 from ebay since I knew it was already supported and I only need one channel anyways. Worked perfect.

If you have any suggestions I'll go back and try again though. Would be nice to expand the library of supported devices.

Kind regards
Dan

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

More
12 Nov 2018 21:11 #120509 by chimeno
Replied by chimeno on topic Ethercat HAL driver

@chimeno

Unfortunately no, I ended up ordering an EL4102 from ebay since I knew it was already supported and I only need one channel anyways. Worked perfect.

If you have any suggestions I'll go back and try again though. Would be nice to expand the library of supported devices.

Kind regards
Dan


Hello dan,
I will revise the files that I have made of the previous project, I will do a little cleaning of them and I will post them here, if it is a good idea to expand the library!

Regards, Chimeno

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

More
12 Nov 2018 21:23 - 12 Nov 2018 21:30 #120510 by Grotius
Replied by Grotius on topic Ethercat HAL driver
Hi,

I think tomorrow i recieve the beckhoff ethercat module.

I will try to merge the ethercat into a current linuxcnc version with already the
external offset branche and reverse run branche included. This i have done 6 month's ago, with succes after a learning periode.

My strategy is first make it run with the current linuxcnc ethercat github version on a separate
hard disk. I am working normally on 64 bit debian stretch. So that is the goal to reach.

After this is succeeded, i will try to find the importand code differences between both versions and merge it finaly into the current linuxcnc version. I cross my finger's coming weeks. If we do that in Github, we can see the code differences quite ease. I think
maybe it will succeed at once. But when not compiling, we can do it again. And finaly it will succeed i hope so.

I have some expience with previous merged version's. Even the master programmer's have problem's to merge the reverse run from Rob Ellenberg. I did it in 3 attemp's. So i have good hope that it will succeed.
But when i begin this, it can be i have to solve difficult problem's.
Last edit: 12 Nov 2018 21:30 by Grotius.

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

More
12 Nov 2018 21:37 #120511 by chimeno
Replied by chimeno on topic Ethercat HAL driver

Hi,

I think tomorrow i recieve the beckhoff ethercat module.

I will try to merge the ethercat into a current linuxcnc version with already the
external offset branche and reverse run branche included. This i have done 6 month's ago, with succes after a learning periode.

My strategy is first make it run with the current linuxcnc ethercat github version on a separate
hard disk. I am working normally on 64 bit debian stretch. So that is the goal to reach.

After this is succeeded, i will try to find the importand code differences between both versions and merge it finaly into the current linuxcnc version. I cross my finger's coming weeks. If we do that in Github, we can see the code differences quite ease. I think
maybe it will succeed at once. But when not compiling, we can do it again. And finaly it will succeed i hope so.

I have some expience with previous merged version's. Even the master programmer's have problem's to merge the reverse run from Rob Ellenberg. I did it in 3 attemp's. So i have good hope that it will succeed.
But when i begin this, it can be i have to solve difficult problem's.


Hello Grotius,
It's great, I've been using the 2.7 branch, now I want to try the master branch, I think it's great what you're doing with linuxcnc, I hope I can help you as much as I can, even though I'm not a born programmer.
Regards, Chimeno

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

More
12 Nov 2018 21:51 - 12 Nov 2018 21:57 #120515 by Grotius
Replied by Grotius on topic Ethercat HAL driver
@Chimeno ,

Me too no born programmer. If i was the founder of programming language, it was looking more easyer.
Bit's and byte's are zero and one's in machine language. Why not implementing more characters? Then we could do much more.
I think that will come if arteficial intellegence will design a new machine language. And that all is done in second's.

I have an idea. Tomorrow i wil open a new ethercat github channel with the linuxcnc version i own, the version with the advantage's.
It's a new github user space. I will provide the password's over here. Then every ethercat fan can try to merge it by his own.
I will make a text file how you could copy/clone the orginal one into your test version... And how merging works.
Maybe that is a good idea. Many of you are capable to merge this for sure.

Here comes the data to enter the github channel : forum.linuxcnc.org/cb-profile/pluginclas...gs&func=show&id=1276
Last edit: 12 Nov 2018 21:57 by Grotius.

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

Time to create page: 0.240 seconds
Powered by Kunena Forum