Ethercat HAL driver
25 Apr 2016 20:40 #73871
by Cpk_Rbt
Replied by Cpk_Rbt on topic Ethercat HAL driver
Just getting started using the HAL driver and the Etherlab EtherCAT Master with a Kollmorgen AKD drive. I've got communications between the EtherCAT Master and drive, then moved on to a basic .hal configuration to test comms. I think I must have something wrong, because the computer freezes up when I try to run the .hal file with
Attached is the ethercat config .xml for my drive.
My test.hal file consists of:
If anyone has any insight into what I'm doing wrong with this setup, I'd really appreciate it.
Thanks!
halrun -I test.hal
Attached is the ethercat config .xml for my drive.
My test.hal file consists of:
loadusr -W lcec_conf ethercat_config_n.xml
loadrt lcec
loadrt trivkins
loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=1
addf lcec.read-all servo-thread
addf lcec.write-all servo-thread
start
If anyone has any insight into what I'm doing wrong with this setup, I'd really appreciate it.
Thanks!
Please Log in or Create an account to join the conversation.
25 Apr 2016 20:43 #73872
by andypugh
Replied by andypugh on topic Ethercat HAL driver
It might be instructive to type the HAL commands one at a time. (just type halrun then start typing commands)
To watch what the computer is doing open another terminal window and type
To watch what the computer is doing open another terminal window and type
sudo tail -f /var/log/kernel.log
The following user(s) said Thank You: Cpk_Rbt
Please Log in or Create an account to join the conversation.
26 Apr 2016 05:53 #73885
by cgc
Replied by cgc on topic Ethercat HAL driver
<master idx="0" appTimePeriod="24770000" refClockSyncCycles="1">
"24770000", this is a very long time period, ~25ms
the servo period is more faster, servo_period_nsec=1000000, ~1ms
"24770000", this is a very long time period, ~25ms
the servo period is more faster, servo_period_nsec=1000000, ~1ms
The following user(s) said Thank You: Cpk_Rbt
Please Log in or Create an account to join the conversation.
26 Apr 2016 13:48 - 26 Apr 2016 14:01 #73903
by Cpk_Rbt
Replied by Cpk_Rbt on topic Ethercat HAL driver
cgc,
I changed the ~25ms period to match the servo period at 1ms. It still hung up after running for a few minutes, so I changed them both to 25ms instead.
Andy,
I tried typing the HAL commands into the terminal one by one and tried to look at the kernel.log. It came back "file not found" but I am able to see some information using dmesg instead.
From dmesg output:
Edit: I changed the periods back to 1ms and it did not display the "did not sync after 5000ms" message, but it did freeze the computer almost immediately.
I changed the ~25ms period to match the servo period at 1ms. It still hung up after running for a few minutes, so I changed them both to 25ms instead.
Andy,
I tried typing the HAL commands into the terminal one by one and tried to look at the kernel.log. It came back "file not found" but I am able to see some information using dmesg instead.
From dmesg output:
EtherCAT WARNING 0-0: Slave did not sync after 5028 ms.
Edit: I changed the periods back to 1ms and it did not display the "did not sync after 5000ms" message, but it did freeze the computer almost immediately.
Last edit: 26 Apr 2016 14:01 by Cpk_Rbt.
Please Log in or Create an account to join the conversation.
26 Apr 2016 14:05 #73905
by wazjebk
Replied by wazjebk on topic Ethercat HAL driver
Hi,
I had the same problem and than I changed the driver in ethercat configuration for my network card chip and after that I had no more problems.
Best regards.
I had the same problem and than I changed the driver in ethercat configuration for my network card chip and after that I had no more problems.
Best regards.
The following user(s) said Thank You: Cpk_Rbt
Please Log in or Create an account to join the conversation.
26 Apr 2016 14:25 - 26 Apr 2016 19:55 #73912
by Cpk_Rbt
Replied by Cpk_Rbt on topic Ethercat HAL driver
wazjebk,
Thanks for the tip!
It looks like my network card is a Realtek RTL8111/8168B. I didn't see a driver option for that in the EtherCAT master, so I picked the r8169 driver.
In case anyone else has this problem in the future, I achieved the best results by re-installing the ethercat master using some flags on the configure step:
Thanks for the tip!
It looks like my network card is a Realtek RTL8111/8168B. I didn't see a driver option for that in the EtherCAT master, so I picked the r8169 driver.
In case anyone else has this problem in the future, I achieved the best results by re-installing the ethercat master using some flags on the configure step:
./configure --enable-r8169 --disable-generic --disable-e100 --disable-e1000 --disable-8139too
Last edit: 26 Apr 2016 19:55 by Cpk_Rbt.
Please Log in or Create an account to join the conversation.
26 Apr 2016 20:28 - 26 Apr 2016 20:32 #73936
by Cpk_Rbt
Replied by Cpk_Rbt on topic Ethercat HAL driver
Communications are now working between the master, HAL driver, and drive. Thanks everyone for the help!
HAL script:
When I run the above script, I can run show pin lcec at the halcmd and it shows the current value of the motor position. Sometimes the value is 0, but if I run the command again it will update to the actual position.
The values next to lcec.read-all.time and lcec.write-all.time change every time I run show pin lcec, but the motor position never does.
If I quit and restart the hal script, it will update the position again (just the once) and then no more.
Checking dmesg shows the following:
The "Slave did not sync after 5000ms" has me thinking that the watchdog timeout is not configured correctly. I have the divider at 0 and intervals at 1000, which I don't think is right, but I don't know what to put there instead. I tried changing the divider to 2498 based on a different configuration guide, but then get spam in dmesg about "Failed to set watchdog divider"
Thank you for reading through the wall of text! If you have any thoughts at this point, I would really appreciate it.
HAL script:
Warning: Spoiler!
loadusr -W lcec_conf ethercat_config_n.xml
loadrt lcec
loadrt trivkins
loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=1
addf lcec.read-all servo-thread
addf lcec.write-all servo-thread
start
loadrt lcec
loadrt trivkins
loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=1
addf lcec.read-all servo-thread
addf lcec.write-all servo-thread
start
When I run the above script, I can run show pin lcec at the halcmd and it shows the current value of the motor position. Sometimes the value is 0, but if I run the command again it will update to the actual position.
The values next to lcec.read-all.time and lcec.write-all.time change every time I run show pin lcec, but the motor position never does.
If I quit and restart the hal script, it will update the position again (just the once) and then no more.
Checking dmesg shows the following:
Warning: Spoiler!
[ 9766.176591] I-pipe: head domain RTAI registered.
[ 9766.176612] RTAI[hal]: compiled with gcc version 4.7.2 (Debian 4.7.2-5) .
[ 9766.176999] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
[ 9766.177010] SYSINFO: CPUs 2, LINUX APIC IRQ 2312, TIM_FREQ 8333188, CLK_FREQ 1599883000, CPU_FREQ 1599883000
[ 9766.177019] RTAI_APIC_TIMER_IPI: RTAI DEFINED 2314, VECTOR 2314; LINUX_APIC_TIMER_IPI: RTAI DEFINED 2312, VECTOR 2312
[ 9766.177029] TIMER NAME: lapic; VARIOUSLY FOUND APIC FREQs: 8333188, 8333188, 8209250
[ 9766.197663] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[ 9766.197774] , <uses LINUX SYSCALLs>, kstacks pool size = 524288 bytes.
[ 9766.197788] RTAI[sched]: hard timer type/freq = APIC/8333188(Hz); default timing: oneshot; linear timed lists.
[ 9766.197798] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 1599883000 hz.
[ 9766.197805] RTAI[sched]: timer setup = 999 ns, resched latency = 2943 ns.
[ 9766.217638] RTAI[math]: loaded.
[ 9766.376310] EtherCAT: Requesting master 0...
[ 9766.376326] EtherCAT: Successfully requested master 0.
[ 9766.376685] EtherCAT 0: Domain0: Logical address 0x00000000, 12 byte, expected working counter 3.
[ 9766.376695] EtherCAT 0: Datagram domain0-0-main: Logical offset 0x00000000, 12 byte, type LRW.
[ 9766.376753] EtherCAT 0: Master thread exited.
[ 9766.376769] EtherCAT 0: Starting EtherCAT-OP thread.
[ 9771.490315] EtherCAT WARNING 0-0: Slave did not sync after 5000 ms.
[ 9771.501319] EtherCAT 0: Domain 0: Working counter changed to 2/3.
[ 9771.516337] EtherCAT 0: Slave states on main device: OP.
[ 9772.505173] EtherCAT 0: Domain 0: Working counter changed to 3/3.
[ 9766.176612] RTAI[hal]: compiled with gcc version 4.7.2 (Debian 4.7.2-5) .
[ 9766.176999] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
[ 9766.177010] SYSINFO: CPUs 2, LINUX APIC IRQ 2312, TIM_FREQ 8333188, CLK_FREQ 1599883000, CPU_FREQ 1599883000
[ 9766.177019] RTAI_APIC_TIMER_IPI: RTAI DEFINED 2314, VECTOR 2314; LINUX_APIC_TIMER_IPI: RTAI DEFINED 2312, VECTOR 2312
[ 9766.177029] TIMER NAME: lapic; VARIOUSLY FOUND APIC FREQs: 8333188, 8333188, 8209250
[ 9766.197663] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[ 9766.197774] , <uses LINUX SYSCALLs>, kstacks pool size = 524288 bytes.
[ 9766.197788] RTAI[sched]: hard timer type/freq = APIC/8333188(Hz); default timing: oneshot; linear timed lists.
[ 9766.197798] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 1599883000 hz.
[ 9766.197805] RTAI[sched]: timer setup = 999 ns, resched latency = 2943 ns.
[ 9766.217638] RTAI[math]: loaded.
[ 9766.376310] EtherCAT: Requesting master 0...
[ 9766.376326] EtherCAT: Successfully requested master 0.
[ 9766.376685] EtherCAT 0: Domain0: Logical address 0x00000000, 12 byte, expected working counter 3.
[ 9766.376695] EtherCAT 0: Datagram domain0-0-main: Logical offset 0x00000000, 12 byte, type LRW.
[ 9766.376753] EtherCAT 0: Master thread exited.
[ 9766.376769] EtherCAT 0: Starting EtherCAT-OP thread.
[ 9771.490315] EtherCAT WARNING 0-0: Slave did not sync after 5000 ms.
[ 9771.501319] EtherCAT 0: Domain 0: Working counter changed to 2/3.
[ 9771.516337] EtherCAT 0: Slave states on main device: OP.
[ 9772.505173] EtherCAT 0: Domain 0: Working counter changed to 3/3.
The "Slave did not sync after 5000ms" has me thinking that the watchdog timeout is not configured correctly. I have the divider at 0 and intervals at 1000, which I don't think is right, but I don't know what to put there instead. I tried changing the divider to 2498 based on a different configuration guide, but then get spam in dmesg about "Failed to set watchdog divider"
Thank you for reading through the wall of text! If you have any thoughts at this point, I would really appreciate it.
Last edit: 26 Apr 2016 20:32 by Cpk_Rbt.
Please Log in or Create an account to join the conversation.
27 Apr 2016 06:40 #73942
by cgc
Replied by cgc on topic Ethercat HAL driver
please disable this line for test:
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
regards Frank
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
regards Frank
Please Log in or Create an account to join the conversation.
28 Apr 2016 03:35 #73981
by Doyle
Replied by Doyle on topic Ethercat HAL driver
Hi,
I'd be grateful for any help as I'm now completely stuck. I have 3 Indradrive Cs running through an EK1100 and get the following terminal error when trying to run my ini file:
Found file(REL): ./test4.hal
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
USRMOT: ERROR: command timeout
waiting for s.axes
USRMOT: ERROR: command timeout
waiting for s.axes
USRMOT: ERROR: command timeout
USRMOT: ERROR: command timeout
A configuration error is preventing LinuxCNC from starting.
More information may be available when running from a terminal.
Shutting down and cleaning up LinuxCNC...
USRMOT: ERROR: command timeout
USRMOT: ERROR: command timeout
/usr/bin/linuxcnc: line 496: 22899 Killed $EMCTASK -ini "$INIFILE"
I have followed the tutorial as closely as possible but have probably gone wrong somewhere. I can see the drives in ethercat slave:
0 0:0 PREOP + EK1100 EtherCAT-Koppler (2A E-Bus)
1 0:1 PREOP + EL1008 8K. Dig. Eingang 24V, 3ms
2 0:2 PREOP + EL2008 8K. Dig. Ausgang 24V, 0.5A
3 4:0 PREOP + 0x00000024:0x00242804
4 3:0 PREOP + 0x00000024:0x00242804
5 1:0 PREOP + 0x00000024:0x00242804
linuxcnc_debug.txt has a whole load of these:
PID TTY STAT TIME COMMAND
22602 pts/0 S+ 0:00 milltask -ini /home/david/linuxcnc/configs/david/test4.ini
PID TTY STAT TIME COMMAND
22602 pts/0 S+ 0:00 milltask -ini /home/david/linuxcnc/configs/david/test4.ini
and linuxcnc_print.txt has:
RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/bin
LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/usr/realtime-3.4-9-rtai-686-pae/modules/linuxcnc
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.5
INIFILE=/home/david/linuxcnc/configs/david/test4.ini
PARAMETER_FILE=linuxcnc.var
TASK=milltask
HALUI=halui
DISPLAY=axis
Starting LinuxCNC server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting LinuxCNC IO program: io
Starting HAL User Interface program: halui
Starting TASK program: milltask
Starting DISPLAY program: axis
Killing task linuxcncsvr, PID=22557
Killing task milltask, PID=22602
Timeout, trying kill -9
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments
The latency check shows this is probably not an ideal machine - servo jitter of around 15,000 when idle and 150,000 when (in particular) watching a Youtube video but it should at least load I think....
Many thanks,
David
I'd be grateful for any help as I'm now completely stuck. I have 3 Indradrive Cs running through an EK1100 and get the following terminal error when trying to run my ini file:
Found file(REL): ./test4.hal
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
USRMOT: ERROR: command timeout
waiting for s.axes
USRMOT: ERROR: command timeout
waiting for s.axes
USRMOT: ERROR: command timeout
USRMOT: ERROR: command timeout
A configuration error is preventing LinuxCNC from starting.
More information may be available when running from a terminal.
Shutting down and cleaning up LinuxCNC...
USRMOT: ERROR: command timeout
USRMOT: ERROR: command timeout
/usr/bin/linuxcnc: line 496: 22899 Killed $EMCTASK -ini "$INIFILE"
I have followed the tutorial as closely as possible but have probably gone wrong somewhere. I can see the drives in ethercat slave:
0 0:0 PREOP + EK1100 EtherCAT-Koppler (2A E-Bus)
1 0:1 PREOP + EL1008 8K. Dig. Eingang 24V, 3ms
2 0:2 PREOP + EL2008 8K. Dig. Ausgang 24V, 0.5A
3 4:0 PREOP + 0x00000024:0x00242804
4 3:0 PREOP + 0x00000024:0x00242804
5 1:0 PREOP + 0x00000024:0x00242804
linuxcnc_debug.txt has a whole load of these:
PID TTY STAT TIME COMMAND
22602 pts/0 S+ 0:00 milltask -ini /home/david/linuxcnc/configs/david/test4.ini
PID TTY STAT TIME COMMAND
22602 pts/0 S+ 0:00 milltask -ini /home/david/linuxcnc/configs/david/test4.ini
and linuxcnc_print.txt has:
RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/bin
LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/usr/realtime-3.4-9-rtai-686-pae/modules/linuxcnc
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.5
INIFILE=/home/david/linuxcnc/configs/david/test4.ini
PARAMETER_FILE=linuxcnc.var
TASK=milltask
HALUI=halui
DISPLAY=axis
Starting LinuxCNC server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting LinuxCNC IO program: io
Starting HAL User Interface program: halui
Starting TASK program: milltask
Starting DISPLAY program: axis
Killing task linuxcncsvr, PID=22557
Killing task milltask, PID=22602
Timeout, trying kill -9
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments
The latency check shows this is probably not an ideal machine - servo jitter of around 15,000 when idle and 150,000 when (in particular) watching a Youtube video but it should at least load I think....
Many thanks,
David
Please Log in or Create an account to join the conversation.
28 Apr 2016 14:08 - 28 Apr 2016 14:11 #74004
by Cpk_Rbt
Replied by Cpk_Rbt on topic Ethercat HAL driver
Frank,
Thanks for the suggestion!
This is the new output from dmesg after disabling the dcConf line of the config:
Then on shutdown of the HAL component, there is a datagram skipped warning:
Thanks for the suggestion!
This is the new output from dmesg after disabling the dcConf line of the config:
Warning: Spoiler!
[160612.811920] I-pipe: head domain RTAI registered.
[160612.811936] RTAI[hal]: compiled with gcc version 4.7.2 (Debian 4.7.2-5) .
[160612.812077] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
[160612.812090] SYSINFO: CPUs 2, LINUX APIC IRQ 2312, TIM_FREQ 8333188, CLK_FREQ 1599883000, CPU_FREQ 1599883000
[160612.812101] RTAI_APIC_TIMER_IPI: RTAI DEFINED 2314, VECTOR 2314; LINUX_APIC_TIMER_IPI: RTAI DEFINED 2312, VECTOR 2312
[160612.812113] TIMER NAME: lapic; VARIOUSLY FOUND APIC FREQs: 8333188, 8333188, 8248250
[160612.832710] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[160612.832819] , <uses LINUX SYSCALLs>, kstacks pool size = 524288 bytes.
[160612.832832] RTAI[sched]: hard timer type/freq = APIC/8333188(Hz); default timing: oneshot; linear timed lists.
[160612.832842] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 1599883000 hz.
[160612.832849] RTAI[sched]: timer setup = 999 ns, resched latency = 2943 ns.
[160612.856924] RTAI[math]: loaded.
[160613.020555] EtherCAT: Requesting master 0...
[160613.020572] EtherCAT: Successfully requested master 0.
[160613.020640] EtherCAT 0: Domain0: Logical address 0x00000000, 12 byte, expected working counter 3.
[160613.020650] EtherCAT 0: Datagram domain0-0-main: Logical offset 0x00000000, 12 byte, type LRW.
[160613.020727] EtherCAT 0: Master thread exited.
[160613.020742] EtherCAT 0: Starting EtherCAT-OP thread.
[160613.147968] EtherCAT 0: Domain 0: Working counter changed to 2/3.
[160613.164990] EtherCAT 0: Slave states on main device: OP.
[160614.149824] EtherCAT 0: Domain 0: Working counter changed to 3/3.
[160612.811936] RTAI[hal]: compiled with gcc version 4.7.2 (Debian 4.7.2-5) .
[160612.812077] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
[160612.812090] SYSINFO: CPUs 2, LINUX APIC IRQ 2312, TIM_FREQ 8333188, CLK_FREQ 1599883000, CPU_FREQ 1599883000
[160612.812101] RTAI_APIC_TIMER_IPI: RTAI DEFINED 2314, VECTOR 2314; LINUX_APIC_TIMER_IPI: RTAI DEFINED 2312, VECTOR 2312
[160612.812113] TIMER NAME: lapic; VARIOUSLY FOUND APIC FREQs: 8333188, 8333188, 8248250
[160612.832710] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[160612.832819] , <uses LINUX SYSCALLs>, kstacks pool size = 524288 bytes.
[160612.832832] RTAI[sched]: hard timer type/freq = APIC/8333188(Hz); default timing: oneshot; linear timed lists.
[160612.832842] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 1599883000 hz.
[160612.832849] RTAI[sched]: timer setup = 999 ns, resched latency = 2943 ns.
[160612.856924] RTAI[math]: loaded.
[160613.020555] EtherCAT: Requesting master 0...
[160613.020572] EtherCAT: Successfully requested master 0.
[160613.020640] EtherCAT 0: Domain0: Logical address 0x00000000, 12 byte, expected working counter 3.
[160613.020650] EtherCAT 0: Datagram domain0-0-main: Logical offset 0x00000000, 12 byte, type LRW.
[160613.020727] EtherCAT 0: Master thread exited.
[160613.020742] EtherCAT 0: Starting EtherCAT-OP thread.
[160613.147968] EtherCAT 0: Domain 0: Working counter changed to 2/3.
[160613.164990] EtherCAT 0: Slave states on main device: OP.
[160614.149824] EtherCAT 0: Domain 0: Working counter changed to 3/3.
Then on shutdown of the HAL component, there is a datagram skipped warning:
EtherCAT WARNING: Datagram def48420 (master-fsm) was SKIPPED 1 time.
Last edit: 28 Apr 2016 14:11 by Cpk_Rbt.
Please Log in or Create an account to join the conversation.
Time to create page: 0.236 seconds