Ethercat HAL driver

More
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
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!
Attachments:

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

More
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
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.

More
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
The following user(s) said Thank You: Cpk_Rbt

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

More
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:
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.

More
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.
The following user(s) said Thank You: Cpk_Rbt

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

More
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:
./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.

More
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:
Warning: Spoiler!


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!


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.

More
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

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

More
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
Attachments:

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

More
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:
Warning: Spoiler!

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.283 seconds
Powered by Kunena Forum