Hi, I am trying to use linuxcnc with ethercat these days but meet some difficulties:
The first one is failed to 'home'...
Here are the steps I follow to setup linuxcnc:
1. Download ethercat-1.5.2 from Igh
2. untar the tarball of ethercat
# tar xvfj ethercat-1.5.2.tar.bz2
3. About linuxcnc-add-hal-ethercat, there are two source in git, one is from s*** and the other is a***, I download linuxcnc-add-hal-ethercat from axxxx in git as the debian folder is not under /ethercat/master in s*** version.
4. use debian folder in linuxcnc-add-hal-ethercat and ethercat to generate ethercat_1.5.2-1_i386.deb and ethercat-dev_1.5.2-1_i386.deb via dpkg:
4.1 copy the debian directory to your build directory.
# cp -av <path-of-LinuxCNC-add-hal-ethercat>/src/hal/drivers/ethercat /master/debian ethercat-1.5.2 <- Here the debian folder is not really got from a*** source but using the "ec-debianize-master"
4.2 build the packages
# cd ethercat-1.5.2
# cd debian
# ./configure -a
# cd ..
# dpkg-checkbuilddeps (and install missing deps:libtools,dpatch)
# dpkg-buildpackage
5. Install the first deb, modify the MAC and DEVICE in /etc/default /ethercat , and update the config
6. Install the second deb and reboot
7. compile linuxcnc-a-h-e follow:
7.0 add 5101 line to source code
7.1 cd ./linuxcnc-a-h-e/src
7.2 ./configure
7.3 sudo make
7.4 sudo make install
7.5 sudo make setuid
7.6 source script/rip-environment
According to the instruction, "Then do a reboot or load the ec*-modules manually (see /etc/modules), the master should now be functional." after step 5 BUT the modules are not loaded after reboot sometimes or are loaded but no /opt/etherlab/bin/ethercat exist in different trys. Since ethercat works not well so the debs are removed and source code of ethercat has been re-compiled follow:
1 ./autogen.sh
2 ./configure (no "--enable-run-in-place")
3 make clean
make
sudo make setuid
4 back to the upper path and 'source scripts/rip-environment'
5 The version of linuxcnc is 2.6.0~pre
Then the ethercat is able to start and slave status can be checked.
Everything seems to be OK until I press the home button...Nothing happens
HAL config is used to find the problem: Once the home button is pressed, the corresponding axis.N.homing will be true but the vel-cmd will not change and the real axis does not move.
After tried many ways, the problem seems to stay at "HOME_SEARCH_VEL" and "HOME_LATCH_VEL" in INI file:
If both are set to zero, home button is useful but the current position will be set as HOME.
If one is set to zero but the other not, error will be sent to say that the value should be non-zero.
If both are set to non-zero, nothing happens except the status of axis.N.homing changes from false to true and axis.N.home-state changes from 0 to 7.
And if I set both to zero, manualy move those axis to a certain position, and set the current position to be HOME, the machine runs perfect in MDI, JOG or NC mode.
I guess maybe some part of the code is wrong as it was still developing in git but I've no idea what to do...
So, what should I do to solve the problem ?
And where can I get the complete version but not developing version of linuxcnc-add-hal-ethercat?
As to the problem above, I tried another version of linux-add-hal-ethercat in which the emc was still named as "emcec" on another PC.
The steps are the same as those above except the debian folder used in 4.1 is obtained from the folder under corresponding linuxcnc.
Ethercat works well by checking the master and slaves by command lines.
Emcec can be started by 'halrun' and ethercatConf.xml can be loaded by emcec_conf.
BUT, a fatal error jumped out when I type 'loadrt emcec' as below:
'
halcmd: loadrt emcec
insmod: error inserting '/home/nim/new/linuxcnc-add-hal-ethercat/rtlib/emcec.ko': -1 Unknown symbol in module
<stdin>

: exit value: 1
<stdin>

: insmod failed, returned -1
See the output of 'dmesg' for more information.
'
Then I make clean and make again but only many few *.ko can be generated so errors like helper_modules can not be found in /bin will jump out in during make.
Then I install the debs again to compile the linuxcnc again but the error shows up all the same even though no error shows during make.
More info is obtained via 'dmesg' of which maybe useful are attatched and some key sentences are listed below:
[18617.447960] RTAI[hal]:

.8.1> mounted over IPIPE-NOTHREADS 2.6-03.
[18617.447962] RTAI[hal]: compiled with gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) .
[18617.447982] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
[18617.447984] PIPELINE layers:
[18617.447986] f8d64e20 9ac15d93 RTAI 200
[18617.447987] c085cb20 0 Linux 100
[18617.461417] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[18617.461543] RTAI[sched]: IMMEDIATE, MP, USER/KERNEL SPACE: <with RTAI OWN KTASKs>, kstacks pool size = 524288 bytes.
[18617.461546] RTAI[sched]: hard timer type/freq = APIC/20883354(Hz); default timing: periodic; linear timed lists.
[18617.461549] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 2999805000 hz.
[18617.461550] RTAI[sched]: timer setup = 999 ns, resched latency = 2944 ns.
[21739.424304] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[21739.424362] RTAI[sched]: IMMEDIATE, MP, USER/KERNEL SPACE: <with RTAI OWN KTASKs>, kstacks pool size = 524288 bytes.
[21739.424366] RTAI[sched]: hard timer type/freq = APIC/20883354(Hz); default timing: periodic; linear timed lists.
[21739.424368] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 2999805000 hz.
[21739.424370] RTAI[sched]: timer setup = 999 ns, resched latency = 2944 ns.
[21739.424416] RTAI[usi]: enabled.
[21739.447954] RTAI[math]: loaded.
[21762.205786] emcec: Unknown symbol ecrt_sdo_request_timeout
[21762.205847] emcec: Unknown symbol ecrt_request_master
[21762.205953] emcec: Unknown symbol ecrt_release_master
[21762.206013] emcec: Unknown symbol ecrt_master_activate
[21762.206126] emcec: Unknown symbol ecrt_sdo_request_read
[21762.206330] emcec: Unknown symbol ecrt_domain_size
[21762.206390] emcec: Unknown symbol ecrt_master_deactivate
[21762.206451] emcec: Unknown symbol ecrt_slave_config_create_sdo_request
[21762.206656] emcec: Unknown symbol ecrt_master_sync_reference_clock
[21762.206716] emcec: Unknown symbol ecrt_slave_config_pdos
[21762.206776] emcec: Unknown symbol ecrt_domain_data
[21762.206836] emcec: Unknown symbol ecrt_sdo_request_data
more sentences like above fills the whole screen...
As to the weird problems, what should I do to solve them ?
Thanks for your attention and happy new year.