How to use LinuxCNC to control slave

More
18 Jul 2019 01:37 #139751 by cheng
@Grotius

I overestimated my ability. I wasted a day modifying c code. I feel very depressed.
I want to continue reading c code today.


Cheng

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

More
18 Jul 2019 08:28 #139765 by cheng
@Grotius
I analyzed the running error.Even if my slave model is not included in lcec_conf, it should be loaded with the lcec_conf before error occurs. But now the problem began. So my guess is that this code is not being executed, or that the.ko file is missing it.
At noon. I follow this url to add user-space drivers.wiki.linuxcnc.org/cgi-bin/wiki.pl?MakefileDeMystified.
After I edit the code and running "./configure"The following error occurred
checking for rtai_shm... not found
checking for rtai_sem... not found
checking for rtai_math... /usr/realtime-3.4-9-rtai-686-pae/modules/rtai_math.ko
checking for rtai... not found
checking for rt_mem_mgr... not found
checking for rtai_sched... /usr/realtime-3.4-9-rtai-686-pae/modules/rtai_sched.ko
checking for rtai_libm... not found
checking for rtl... not found
checking for mbuff... not found
checking for rtl_time... not found
checking for rtl_sched... not found
checking for rtl_posixio... not found
checking for rtl_fifo... not found
checking for ANSI C header files... (cached) yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for semtimedop... yes
checking for sincos function... yes
checking for __sincos... no
checking for tcl... tclConfig.sh not found, trying tcl.h and libs.
		  If it doesn't work try running ./configure --with-tclConfig=<path to tclConfig.sh>
checking tcl.h usability... no
checking tcl.h presence... no
checking for tcl.h... no
checking for library containing Tcl_Init... no
configure: error: tcl lib not found

The linuxcnc prompts me to lack tcl lib.so i running "find / -name tcl.h".But could not find。
enen the c source was download github.com/aschiffler/linuxcnc.Is it wrong for me to download?
Have you ever seen tcl.h?

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

More
18 Jul 2019 09:53 - 18 Jul 2019 09:54 #139769 by cheng
@Grotius
I solved the problem of missing tcl.h. But I have encountered new problems again.
mg123@debian:/mnt/hgfs/LinuxCNC/linuxcnc-master/src$ make
Reading 1/123 dependency files
Done reading dependencies
make: Entering directory `/mnt/hgfs/LinuxCNC/linuxcnc-master/src'
copying shared configs
ln -sf liblinuxcncini.so.0 ../lib/liblinuxcncini.so
ln: failed to create symbolic link `../lib/liblinuxcncini.so': Operation not supported
make: *** [../lib/liblinuxcncini.so] Error 1
make: Leaving directory `/mnt/hgfs/LinuxCNC/linuxcnc-master/src'
mg123@debian:/mnt/hgfs/LinuxCNC/linuxcnc-master/src$ ln -sf liblinuxcncini.so.0 ../lib/liblinuxcncini.so
ln: failed to create symbolic link `../lib/liblinuxcncini.so': Operation not supported
mg123@debian:/mnt/hgfs/LinuxCNC/linuxcnc-master/src$ sudo ln -sf liblinuxcncini.so.0 ../lib/liblinuxcncini.so
ln: failed to create symbolic link `../lib/liblinuxcncini.so': Operation not supported


I suspect that it is a problem with the path. So I changed to an absolute path.but still error
mg123@debian:/mnt/hgfs/LinuxCNC/linuxcnc-master/lib$ sudo ln -sf liblinuxcncini.so.0 /mnt/hgfs/LinuxCNC/linuxcnc-master/lib/liblinuxcncini.so
ln: failed to create symbolic link `/mnt/hgfs/LinuxCNC/linuxcnc-master/lib/liblinuxcncini.so': Operation not supported
mg123@debian:/mnt/hgfs/LinuxCNC/linuxcnc-master/lib$ sudo ln -n liblinuxcncini.so.0 /mnt/hgfs/LinuxCNC/linuxcnc-master/lib/liblinuxcncini.so
ln: failed to create hard link `/mnt/hgfs/LinuxCNC/linuxcnc-master/lib/liblinuxcncini.so' => `liblinuxcncini.so.0': Operation not permitted


Today is a day to solve mistakes and new mistakes.

by Cheng
Last edit: 18 Jul 2019 09:54 by cheng.

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

More
18 Jul 2019 11:11 #139780 by Dinuka_Shehan
Find me Dinuka Shehan on facebook

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

More
19 Jul 2019 00:42 #139846 by cheng
I don't know which one is you. I guess it is the last one.
Attachments:

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

More
19 Jul 2019 00:48 - 19 Jul 2019 00:49 #139848 by Grotius
@Cheng,

I overestimated my ability. I wasted a day modifying c code. I feel very depressed.
I want to continue reading c code today.

Haha. Did you compile something in the mean time?

For .ko files you can test them with insmod
Put them into your kernel.

If you are so far. You can put your ethercat src directory on wetransfer.
I will test it for compiling and error's. But post it only if you are one week stuck...

I want to get the maximum out of your talent. :woohoo:
Last edit: 19 Jul 2019 00:49 by Grotius.

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

More
19 Jul 2019 03:12 #139850 by cheng

@Cheng,

I overestimated my ability. I wasted a day modifying c code. I feel very depressed.
I want to continue reading c code today.

Haha. Did you compile something in the mean time?

For .ko files you can test them with insmod
Put them into your kernel.

If you are so far. You can put your ethercat src directory on wetransfer.
I will test it for compiling and error's. But post it only if you are one week stuck...

I want to get the maximum out of your talent. :woohoo:


I modified the code yesterday and found that the compilation did not pass. I thought about my initial purpose. I want to use the LinuxCNC to control the motor. I have used the command line you gave last time and read the CANOpen protocol to successfully control the motor through EtherCAT. Now it is necessary to use LinuxCNC to control my slave. Since the slave is not Beckhoff, I need to write the HAl, ini and xml files myself.

According to your suggestion, I found a HAl, xml written by someone else about estun. But it can't run, I now wonder if I have problems during the LinuxCN installation. The last time I modified the code was really annoying. I replaced the method today to reinstall LinuxCNC

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

More
20 Jul 2019 16:55 - 20 Jul 2019 16:56 #139979 by Dinuka_Shehan
Attachments:
Last edit: 20 Jul 2019 16:56 by Dinuka_Shehan. Reason: Photo added

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

More
01 Aug 2019 07:05 - 01 Aug 2019 07:13 #141076 by cheng
Now I have a very magical thing. I running
linuxcnc cpd17_x.ini
error
Machine configuration file is 'cpd17_x.ini'
Starting LinuxCNC...
.
emc/iotask/ioControl.cc 768: can't load tool table.
Found file(REL): ./cpd17_x.hal
HAL: ERROR: function 'not.0' not found
./cpd17_x.hal:12: addf failed
Shutting down and cleaning up LinuxCNC...
LinuxCNC terminated with an error.  You can find more information in the log:
    /home/mg123/linuxcnc_debug.txt
and
    /home/mg123/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal

after dmesg
[20949.806250] EtherCAT WARNING 0: 32 datagrams UNMATCHED!
[20949.813227] EtherCAT 0: 1 slave(s) responding on main device.
[20949.813236] EtherCAT 0: Slave states on main device: INIT.
[20949.814369] EtherCAT 0: Scanning bus.
[20950.536177] EtherCAT ERROR 0-0: SDO upload 0x0000:00 aborted.
[20950.536181] EtherCAT ERROR 0-0: SDO abort message 0x06020000: "This object does not exist in the object directory".
[20950.536183] EtherCAT ERROR 0-0: Failed to read number of mapped PDO entries.
[20950.536185] EtherCAT ERROR 0-0: Failed to read mapped PDO entries for PDO 0x0000.
[20950.597113] EtherCAT ERROR 0-0: SDO upload 0x0000:00 aborted.
[20950.597166] EtherCAT ERROR 0-0: SDO abort message 0x06020000: "This object does not exist in the object directory".
[20950.597170] EtherCAT ERROR 0-0: Failed to read number of mapped PDO entries.
[20950.597172] EtherCAT ERROR 0-0: Failed to read mapped PDO entries for PDO 0x0000.
[20950.597201] EtherCAT 0: Bus scanning completed in 784 ms.
[20950.597224] EtherCAT 0: Using slave 0 as DC reference clock.
[20950.600753] EtherCAT 0: Slave states on main device: PREOP.
[21013.776371] I-pipe: head domain RTAI registered.
[21013.776383] RTAI[hal]: compiled with gcc version 4.7.2 (Debian 4.7.2-5) .
[21013.776396] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
[21013.776403] SYSINFO: CPUs 1, LINUX APIC IRQ 2312, TIM_FREQ 4124422, CLK_FREQ 2294709000, CPU_FREQ 2294709000
[21013.776410] RTAI_APIC_TIMER_IPI: RTAI DEFINED 2314, VECTOR 2314; LINUX_APIC_TIMER_IPI: RTAI DEFINED 2312, VECTOR 2312
[21013.776418] TIMER NAME: lapic; VARIOUSLY FOUND APIC FREQs: 4124422, 4124422, 2231250
[21013.804542] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[21013.804598] , <uses LINUX SYSCALLs>, kstacks pool size = 524288 bytes.
[21013.804608] RTAI[sched]: hard timer type/freq = APIC/4124422(Hz); default timing: oneshot; linear timed lists.
[21013.804616] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 2294709000 hz.
[21013.804621] RTAI[sched]: timer setup = 999 ns, resched latency = 2944 ns.
[21013.833950] RTAI[math]: loaded.
[21014.137145] EtherCAT: Requesting master 0...
[21014.137152] EtherCAT: Successfully requested master 0.
[21014.137575] EtherCAT 0: Domain0: Logical address 0x00000000, 35 byte, expected working counter 3.
[21014.137580] EtherCAT 0:   Datagram domain0-0-main: Logical offset 0x00000000, 35 byte, type LRW.
[21014.137630] EtherCAT 0: Master thread exited.
[21014.137635] EtherCAT 0: Starting EtherCAT-OP thread.
[21014.174298] EtherCAT WARNING 0: 1 datagram TIMED OUT!
[21014.174306] EtherCAT WARNING 0: 21 datagrams UNMATCHED!
[21014.898039] EtherCAT 0: Master thread exited.
[21014.898053] EtherCAT 0: Starting EtherCAT-IDLE thread.
[21014.898072] EtherCAT 0: Releasing master...
[21014.898074] EtherCAT 0: Released.
[21017.301925] RTAI[math]: unloaded.
[21017.309045] SCHED releases registered named ALIEN PEDV$D
[21017.319204] RTAI[malloc]: unloaded.
[21017.416513] RTAI[sched]: unloaded (forced hard/soft/hard transitions: traps 0, syscalls 0).
[21017.423447] I-pipe: head domain RTAI unregistered.
[21017.423481] RTAI[hal]: unmounted.
[21061.871264] I-pipe: head domain RTAI registered.
[21061.871276] RTAI[hal]: compiled with gcc version 4.7.2 (Debian 4.7.2-5) .
[21061.871289] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
[21061.871297] SYSINFO: CPUs 1, LINUX APIC IRQ 2312, TIM_FREQ 4124422, CLK_FREQ 2294709000, CPU_FREQ 2294709000
[21061.871303] RTAI_APIC_TIMER_IPI: RTAI DEFINED 2314, VECTOR 2314; LINUX_APIC_TIMER_IPI: RTAI DEFINED 2312, VECTOR 2312
[21061.871312] TIMER NAME: lapic; VARIOUSLY FOUND APIC FREQs: 4124422, 4124422, 3055750
[21061.888378] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[21061.888412] , <uses LINUX SYSCALLs>, kstacks pool size = 524288 bytes.
[21061.888418] RTAI[sched]: hard timer type/freq = APIC/4124422(Hz); default timing: oneshot; linear timed lists.
[21061.888422] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 2294709000 hz.
[21061.888426] RTAI[sched]: timer setup = 999 ns, resched latency = 2944 ns.
[21061.906760] RTAI[math]: loaded.
[21062.155678] EtherCAT: Requesting master 0...
[21062.155683] EtherCAT: Successfully requested master 0.
[21062.155939] EtherCAT 0: Domain0: Logical address 0x00000000, 35 byte, expected working counter 3.
[21062.155942] EtherCAT 0:   Datagram domain0-0-main: Logical offset 0x00000000, 35 byte, type LRW.
[21062.155977] EtherCAT 0: Master thread exited.
[21062.155981] EtherCAT 0: Starting EtherCAT-OP thread.
[21062.452016] EtherCAT 0: Master thread exited.
[21062.452027] EtherCAT 0: Starting EtherCAT-IDLE thread.
[21062.452042] EtherCAT 0: Releasing master...
[21062.452044] EtherCAT 0: Released.
[21064.778294] RTAI[math]: unloaded.
[21064.787680] SCHED releases registered named ALIEN PEDV$D
[21064.800484] RTAI[malloc]: unloaded.
[21064.897990] RTAI[sched]: unloaded (forced hard/soft/hard transitions: traps 0, syscalls 0).
[21064.905120] I-pipe: head domain RTAI unregistered.
[21064.905151] RTAI[hal]: unmounted.
[21184.172274] I-pipe: head domain RTAI registered.
[21184.172287] RTAI[hal]: compiled with gcc version 4.7.2 (Debian 4.7.2-5) .
[21184.172300] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
[21184.172308] SYSINFO: CPUs 1, LINUX APIC IRQ 2312, TIM_FREQ 4124422, CLK_FREQ 2294709000, CPU_FREQ 2294709000
[21184.172314] RTAI_APIC_TIMER_IPI: RTAI DEFINED 2314, VECTOR 2314; LINUX_APIC_TIMER_IPI: RTAI DEFINED 2312, VECTOR 2312
[21184.172323] TIMER NAME: lapic; VARIOUSLY FOUND APIC FREQs: 4124422, 4124422, 4002750
[21184.202492] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[21184.202547] , <uses LINUX SYSCALLs>, kstacks pool size = 524288 bytes.
[21184.202557] RTAI[sched]: hard timer type/freq = APIC/4124422(Hz); default timing: oneshot; linear timed lists.
[21184.202565] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 2294709000 hz.
[21184.202570] RTAI[sched]: timer setup = 999 ns, resched latency = 2944 ns.
[21184.233890] RTAI[math]: loaded.
[21184.560343] EtherCAT: Requesting master 0...
[21184.560354] EtherCAT: Successfully requested master 0.
[21184.561643] EtherCAT 0: Domain0: Logical address 0x00000000, 35 byte, expected working counter 3.
[21184.561651] EtherCAT 0:   Datagram domain0-0-main: Logical offset 0x00000000, 35 byte, type LRW.
[21184.561717] EtherCAT 0: Master thread exited.
[21184.561724] EtherCAT 0: Starting EtherCAT-OP thread.
[21185.573821] EtherCAT 0: Master thread exited.
[21185.573855] EtherCAT 0: Starting EtherCAT-IDLE thread.
[21185.573910] EtherCAT 0: Releasing master...
[21185.573916] EtherCAT 0: Released.
[21188.068064] RTAI[math]: unloaded.
[21188.076617] SCHED releases registered named ALIEN PEDV$D
[21188.089183] RTAI[malloc]: unloaded.
[21188.186342] RTAI[sched]: unloaded (forced hard/soft/hard transitions: traps 0, syscalls 0).
[21188.190202] I-pipe: head domain RTAI unregistered.
[21188.190222] RTAI[hal]: unmounted.

eee
Maybe dmesg has too much information, it is recommended to look from the back.
I hope someone told me what to do with it.
thanks
Last edit: 01 Aug 2019 07:13 by cheng.

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

More
01 Aug 2019 19:42 - 01 Aug 2019 20:07 #141136 by Grotius
Hi Cheng,

How is life in your beautifull city?

Relating to your post :

Machine configuration file is 'cpd17_x.ini'
Starting LinuxCNC...
.
emc/iotask/ioControl.cc 768: can't load tool table. If you add a tool.tbl file and a ini connection you are fertig with this one.
Found file(REL): ./cpd17_x.hal
HAL: ERROR: function 'not.0' not found You have a action to a "not" function somewhere in hal or your component's...
the "not" can be a little line statement somewhere that say's... I will not do this if you do that... So it looks like a if-else function.
www.linuxcnc.org/docs/devel/html/hal/basic-hal.html#_not
the bit inverter function is not found.
./cpd17_x.hal:12: addf failed Here it relates the "not" (bit inverter function) to cpd17_x.hal, line 12...
Shutting down and cleaning up LinuxCNC... Goodbye linuxcnc
LinuxCNC terminated with an error. You can find more information in the log:
/home/mg123/linuxcnc_debug.txt
and
/home/mg123/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal

You are going good !
Last edit: 01 Aug 2019 20:07 by Grotius.

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

Time to create page: 0.324 seconds
Powered by Kunena Forum