Category: EtherCAT
hi Hakan,
Thanks for the recommendation to move to cia402 - the drive runs and i can at least move the motor! I feel like I might have taken some weird workarounds trying to chase linuxcnc compile errors, so I probably need to touch on whether these are "acceptable" - perhaps you can comment on the below?
ethercat-conf_n.xml:
<masters>
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="1000">
<slave idx="0" type="generic" vid="00000A88" pid="0a880013" configPdos="true">
<!-- Joint 0 -->
<syncManager idx="0" dir="out"> </syncManager>
<syncManager idx="1" dir="out"> </syncManager>
<syncManager idx="2" dir="out">
<pdo idx="1600">
<pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="cia-controlword" halType="u32"/>
<pdoEntry idx="607a" subIdx="00" bitLen="32" halPin="target-position" halType="s32"/>
<pdoEntry idx="60b8" subIdx="00" bitLen="16" halPin="touchprobefunction0" halType="bit"/>
</pdo>
<pdo idx="1601">
<pdoEntry idx="6081" subIdx="00" bitLen="32" halPin="profile-velocity" halType="u32"/>
<pdoEntry idx="6083" subIdx="00" bitLen="32" halPin="target-accel" halType="u32"/>
<pdoEntry idx="6084" subIdx="00" bitLen="32" halPin="target-decel" halType="u32"/>
<pdoEntry idx="6060" subIdx="00" bitLen="8" halPin="opmode" halType="s32"/>
</pdo>
<pdo idx="1602">
<pdoEntry idx="60ff" subIdx="00" bitLen="32" halPin="target-velocity" halType="s32"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1a00">
<pdoEntry idx="603f" subIdx="00" bitLen="16" halPin="errorcode" halType="bit"/>
<pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="cia-statusword" halType="u32"/>
<pdoEntry idx="6061" subIdx="00" bitLen="8" halPin="opmode-display" halType="s32"/>
<pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="actual-position" halType="s32"/>
<pdoEntry idx="60b9" subIdx="00" bitLen="16" halPin="touchprobestat" halType="bit"/>
<pdoEntry idx="60ba" subIdx="00" bitLen="32" halPin="touchprobe1pos" halType="s32"/>
<pdoEntry idx="60fd" subIdx="00" bitLen="32" halPin="digitalinputs" halType="s32"/>
</pdo>
<pdo idx="1a01">
<pdoEntry idx="606c" subIdx="00" bitLen="32" halPin="actual-velocity" halType="s32"/>
</pdo>
</syncManager>
<dcConf assignActivate="300" sync0Cycle="1000000"/>
</slave>
</master>
</masters>
and ethercat.hal:
loadusr -W lcec_conf ethercat-conf_n.xml
loadrt lcec
loadrt cia402 count=1
loadrt pid names=x-pid
##########################################
addf lcec.read-all servo-thread
addf cia402.0.read-all servo-thread
#addf motion-command-handler servo-thread
#addf motion-controller servo-thread
addf x-pid.do-pid-calcs servo-thread
addf cia402.0.write-all servo-thread
addf lcec.write-all servo-thread
#######################################
#net emc-enable => iocontrol.0.emc-enable-in
#sets emc-enable 1
setp cia402.0.csp-mode 1
setp cia402.0.pos-scale 3600000000
#from servo 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
#from cia402 to servo
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 Xpos => cia402.0.pos-cmd
#net x-pos-fb => joint.0.motor-pos-fb <= cia402.0.pos-fb
#from motion to cia
net x-enable <= joint.0.amp-enable-out => cia402.0.enable
#net x-pos-cmd <= joint.0.motor-pos-cmd => cia402.0.pos-cmd
#from cia to motion
#net x-amp-fault => joint.0.amp-fault-in <= cia402.0.drv-fault
#net x-pos-fb => joint.0.motor-pos-fb <= cia402.0.pos-fb
#homing
net x-home-index <= joint.0.index-enable => cia402.0.home
note with the above: I had to comment out quite a few lines to avoid having to go "deeper" into ini files to remove errors from occuring... one such example was with the cia402.0.motor-pos-fb and cmd, I had errors stating that they were already linked to Xpos - so I just "reassigned" them. basically any line in the above that is commented out is just due to an error. definitely also need to uncomment the fault reporting...
next step for me is to set up a physical axis where I can test homing and rotation distance of a ball screw etc. and get an IO board working