- Posts: 40
- Thank you received: 1
General Questions about using ethercat
1 year 7 months ago #324383
by Tntmold
Replied by Tntmold on topic General Questions about using ethercat
Thank you for helping, I used the dbraun1981 example hal file to modify mine, but I don't think I quite have it. The example seemed to have 3 axis for part of it and then only define x axis at the end, so I attempted to modify both areas, but I now get the following when I try to start linuxcnc:
phil@SodickA:~/linuxcnc/configs/sim.axis$ linuxcnc lathe.ini
LINUXCNC - 2.9.3
Machine configuration directory is '/home/phil/linuxcnc/configs/sim.axis'
Machine configuration file is 'lathe.ini'
Starting LinuxCNC...
libnml/buffer/shmem.cc 320: Shared memory buffers toolCmd and toolCmd may conflict. (key=1004(0x3EC))
libnml/buffer/shmem.cc 320: Shared memory buffers toolSts and toolSts may conflict. (key=1005(0x3ED))
libnml/buffer/shmem.cc 320: Shared memory buffers emcError and emcError may conflict. (key=1003(0x3EB))
linuxcnc TPMOD=tpmod HOMEMOD=homemod EMCMOT=motmod
Note: Using POSIX realtime
Found file(LIB): /usr/share/linuxcnc/hallib/basic_sim.tcl
setup_kins: cmd=loadrt trivkins coordinates=xz
Found file(REL): ./ethercat.hal
trivkins: already exists
./ethercat.hal:11: waitpid failed /usr/bin/rtapi_app trivkins
./ethercat.hal:11: /usr/bin/rtapi_app exited without becoming ready
./ethercat.hal:11: insmod for trivkins 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/phil/linuxcnc_debug.txt
and
/home/phil/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal
Here is my HAL file:
###########################################################
#
# CIA 402 example snippet Hal
#
###########################################################
###########################################################
# Setup
###########################################################
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
loadrt cia402 count=2
loadrt pid names=x-pid,z-pid
###########################################################
# Functions servo-thread
###########################################################
addf lcec.read-all servo-thread
addf cia402.0.read-all servo-thread
addf cia402.1.read-all servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf x-pid.do-pid-calcs servo-thread
addf z-pid.do-pid-calcs servo-thread
addf cia402.0.write-all servo-thread
addf cia402.1.write-all servo-thread
addf lcec.write-all servo-thread
#########################################
#nets
#########################################
net emc-enable => iocontrol.0.emc-enable-in
sets emc-enable 1
#config
setp cia402.0.csp-mode 1
setp cia402.0.pos-scale 3600
setp cia402.1.csp-mode 1
setp cia402.1.pos-scale 3600
#from servo(ethercat) to cia402
net x-statusword lcec.0.0.cia-statusword => cia402.0.statusword
net x-opmode-display lcec.0.0.opmode-display => cia402.0.opmode-display
net x-drv-act-pos lcec.0.0.actual-position => cia402.0.drv-actual-position
net x-drv-act-velo lcec.0.0.actual-velocity => cia402.0.drv-actual-velocity
net z-statusword lcec.1.0.cia-statusword => cia402.1.statusword
net z-opmode-display lcec.1.0.opmode-display => cia402.1.opmode-display
net z-drv-act-pos lcec.1.0.actual-position => cia402.1.drv-actual-position
net z-drv-act-velo lcec.1.0.actual-velocity => cia402.1.drv-actual-velocity
#from cia402 to servo(ethercat)
net x-controlword cia402.0.controlword => lcec.0.0.cia-controlword
net x-modes-of-operation cia402.0.opmode => lcec.0.0.opmode
net x-drv-target-pos cia402.0.drv-target-position => lcec.0.0.target-position
net x-drv-target-velo cia402.0.drv-target-velocity => lcec.0.0.target-velocity
net z-controlword cia402.1.controlword => lcec.1.0.cia-controlword
net z-modes-of-operation cia402.1.opmode => lcec.1.0.opmode
net z-drv-target-pos cia402.1.drv-target-position => lcec.1.0.target-position
net z-drv-target-velo cia402.1.drv-target-velocity => lcec.1.0.target-velocity
#from motion to cia
net x-enable <= joint.0.amp-enable-out => cia402.0.enable
net x-amp-fault => joint.0.amp-fault-in <= cia402.0.drv-fault
net x-pos-cmd <= joint.0.motor-pos-cmd => cia402.0.pos-cmd
net x-pos-fb => joint.0.motor-pos-fb <= cia402.0.pos-fb
net z-enable <= joint.1.amp-enable-out => cia402.1.enable
net z-amp-fault => joint.1.amp-fault-in <= cia402.1.drv-fault
net z-pos-cmd <= joint.1.motor-pos-cmd => cia402.1.pos-cmd
net z-pos-fb => joint.1.motor-pos-fb <= cia402.1.pos-fb
#homing
net x-home-index <= joint.0.index-enable => cia402.0.home
net z-home-index <= joint.1.index-enable => cia402.1.home
phil@SodickA:~/linuxcnc/configs/sim.axis$ linuxcnc lathe.ini
LINUXCNC - 2.9.3
Machine configuration directory is '/home/phil/linuxcnc/configs/sim.axis'
Machine configuration file is 'lathe.ini'
Starting LinuxCNC...
libnml/buffer/shmem.cc 320: Shared memory buffers toolCmd and toolCmd may conflict. (key=1004(0x3EC))
libnml/buffer/shmem.cc 320: Shared memory buffers toolSts and toolSts may conflict. (key=1005(0x3ED))
libnml/buffer/shmem.cc 320: Shared memory buffers emcError and emcError may conflict. (key=1003(0x3EB))
linuxcnc TPMOD=tpmod HOMEMOD=homemod EMCMOT=motmod
Note: Using POSIX realtime
Found file(LIB): /usr/share/linuxcnc/hallib/basic_sim.tcl
setup_kins: cmd=loadrt trivkins coordinates=xz
Found file(REL): ./ethercat.hal
trivkins: already exists
./ethercat.hal:11: waitpid failed /usr/bin/rtapi_app trivkins
./ethercat.hal:11: /usr/bin/rtapi_app exited without becoming ready
./ethercat.hal:11: insmod for trivkins 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/phil/linuxcnc_debug.txt
and
/home/phil/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal
Here is my HAL file:
###########################################################
#
# CIA 402 example snippet Hal
#
###########################################################
###########################################################
# Setup
###########################################################
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
loadrt cia402 count=2
loadrt pid names=x-pid,z-pid
###########################################################
# Functions servo-thread
###########################################################
addf lcec.read-all servo-thread
addf cia402.0.read-all servo-thread
addf cia402.1.read-all servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf x-pid.do-pid-calcs servo-thread
addf z-pid.do-pid-calcs servo-thread
addf cia402.0.write-all servo-thread
addf cia402.1.write-all servo-thread
addf lcec.write-all servo-thread
#########################################
#nets
#########################################
net emc-enable => iocontrol.0.emc-enable-in
sets emc-enable 1
#config
setp cia402.0.csp-mode 1
setp cia402.0.pos-scale 3600
setp cia402.1.csp-mode 1
setp cia402.1.pos-scale 3600
#from servo(ethercat) to cia402
net x-statusword lcec.0.0.cia-statusword => cia402.0.statusword
net x-opmode-display lcec.0.0.opmode-display => cia402.0.opmode-display
net x-drv-act-pos lcec.0.0.actual-position => cia402.0.drv-actual-position
net x-drv-act-velo lcec.0.0.actual-velocity => cia402.0.drv-actual-velocity
net z-statusword lcec.1.0.cia-statusword => cia402.1.statusword
net z-opmode-display lcec.1.0.opmode-display => cia402.1.opmode-display
net z-drv-act-pos lcec.1.0.actual-position => cia402.1.drv-actual-position
net z-drv-act-velo lcec.1.0.actual-velocity => cia402.1.drv-actual-velocity
#from cia402 to servo(ethercat)
net x-controlword cia402.0.controlword => lcec.0.0.cia-controlword
net x-modes-of-operation cia402.0.opmode => lcec.0.0.opmode
net x-drv-target-pos cia402.0.drv-target-position => lcec.0.0.target-position
net x-drv-target-velo cia402.0.drv-target-velocity => lcec.0.0.target-velocity
net z-controlword cia402.1.controlword => lcec.1.0.cia-controlword
net z-modes-of-operation cia402.1.opmode => lcec.1.0.opmode
net z-drv-target-pos cia402.1.drv-target-position => lcec.1.0.target-position
net z-drv-target-velo cia402.1.drv-target-velocity => lcec.1.0.target-velocity
#from motion to cia
net x-enable <= joint.0.amp-enable-out => cia402.0.enable
net x-amp-fault => joint.0.amp-fault-in <= cia402.0.drv-fault
net x-pos-cmd <= joint.0.motor-pos-cmd => cia402.0.pos-cmd
net x-pos-fb => joint.0.motor-pos-fb <= cia402.0.pos-fb
net z-enable <= joint.1.amp-enable-out => cia402.1.enable
net z-amp-fault => joint.1.amp-fault-in <= cia402.1.drv-fault
net z-pos-cmd <= joint.1.motor-pos-cmd => cia402.1.pos-cmd
net z-pos-fb => joint.1.motor-pos-fb <= cia402.1.pos-fb
#homing
net x-home-index <= joint.0.index-enable => cia402.0.home
net z-home-index <= joint.1.index-enable => cia402.1.home
Please Log in or Create an account to join the conversation.
1 year 7 months ago #324399
by Hakan
Replied by Hakan on topic General Questions about using ethercat
From this here
It looks like you are including basic_sim.tcl. You got to remove that inclusion.
It's in the .ini file, comment out that line, the line looks something like HALFILE=LIB:basic_sim.tcl
Code:
Note: Using POSIX realtime
Found file(LIB): /usr/share/linuxcnc/hallib/basic_sim.tcl
setup_kins: cmd=loadrt trivkins coordinates=xz
Found file(REL): ./ethercat.hal
trivkins: already exists
./ethercat.hal:11: waitpid failed
It's in the .ini file, comment out that line, the line looks something like HALFILE=LIB:basic_sim.tcl
Please Log in or Create an account to join the conversation.
1 year 6 months ago #327235
by Tntmold
Replied by Tntmold on topic General Questions about using ethercat
That worked but now I get a new error:
./ethercat.hal:50: Pin 'lcec.0.0.cia-statusword' does not exist
this occurs at the following line:
net x-statusword lcec.0.0.cia-statusword => cia402.0.statusword
I clearly have an error here but I don't know where to look to correct the problem
./ethercat.hal:50: Pin 'lcec.0.0.cia-statusword' does not exist
this occurs at the following line:
net x-statusword lcec.0.0.cia-statusword => cia402.0.statusword
I clearly have an error here but I don't know where to look to correct the problem
Please Log in or Create an account to join the conversation.
- Soccer Kid
- Offline
- Junior Member
-
Less
More
- Posts: 34
- Thank you received: 7
1 year 6 months ago #327257
by Soccer Kid
Replied by Soccer Kid on topic General Questions about using ethercat
Please check your ethercat.xml file to see if it contains this pin. Similar to...... <pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="cia-controlword" halType="u32"/>
Please Log in or Create an account to join the conversation.
1 year 6 months ago #327272
by Hakan
Replied by Hakan on topic General Questions about using ethercat
A common error is to not have the right vid and pid in the ethercat-conf.xml file.
Double-check that the vendor id and product code from the output of
matches the vid and pid fields in ethercat-conf.xml.
Check that for all slaves (0,1,2,etc)
If that didn't help please attach the ethercat-conf.xml file, the hal file and the output of "ethercat slaves -v"
Double-check that the vendor id and product code from the output of
Code:
ethercat slaves -p 0 -v
Check that for all slaves (0,1,2,etc)
If that didn't help please attach the ethercat-conf.xml file, the hal file and the output of "ethercat slaves -v"
Please Log in or Create an account to join the conversation.
1 year 6 months ago #327458
by Tntmold
Replied by Tntmold on topic General Questions about using ethercat
In the file ethercat.hal I have:
net x-statusword lcec.0.0.cia-statusword => cia402.0.statusword
in the file ethercat-conf.xml I have:
<masters>
<master idx="0">
<slave idx="0" type="generic" vid="0x00000a79" pid="0x00002000" name="D1">
<!--OL3-E57H-->
<syncManager idx="0" dir="out">
<pdo idx="1a01">
<!--TxPDO 2-->
<pdoEntry idx="603f" subIdx="00" bitLen="16" halPin="errorcode" halType="BLANK"/>
<pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="statusword" halType="BLANK"/>
<pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="position-actual-value" halType="BLANK"/>
<pdoEntry idx="60fd" subIdx="00" bitLen="32" halPin="digital-inputs" halType="BLANK"/>
<pdoEntry idx="6061" subIdx="00" bitLen="8" halPin="modes-of-operation-display" halType="BLANK"/>
</pdo>
...
where am I going wrong?
net x-statusword lcec.0.0.cia-statusword => cia402.0.statusword
in the file ethercat-conf.xml I have:
<masters>
<master idx="0">
<slave idx="0" type="generic" vid="0x00000a79" pid="0x00002000" name="D1">
<!--OL3-E57H-->
<syncManager idx="0" dir="out">
<pdo idx="1a01">
<!--TxPDO 2-->
<pdoEntry idx="603f" subIdx="00" bitLen="16" halPin="errorcode" halType="BLANK"/>
<pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="statusword" halType="BLANK"/>
<pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="position-actual-value" halType="BLANK"/>
<pdoEntry idx="60fd" subIdx="00" bitLen="32" halPin="digital-inputs" halType="BLANK"/>
<pdoEntry idx="6061" subIdx="00" bitLen="8" halPin="modes-of-operation-display" halType="BLANK"/>
</pdo>
...
where am I going wrong?
Please Log in or Create an account to join the conversation.
Time to create page: 0.352 seconds