EtherCAT driver as simply positioner

  • tuxcnc
  • Away
  • Premium Member
  • Premium Member
More
16 Feb 2026 18:52 #343063 by tuxcnc
EtherCAT driver as simply positioner was created by tuxcnc
Hi.
I need configure closed loop EtherCAT driver as simply positioner (tools magazine).
There is no problem to use this as rotary axis, but i don't want waste resources.
I need only internally homing and go to some position. 
Theoretically I need only some bash scripts with "halcmd setp somepin" running as custom M-codes, but this doesn't work.
My driver not responds for any controlwords.
I must do something wrong, because this same driver works properly as axis.
Can somebody help me ?

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

More
16 Feb 2026 19:36 #343065 by Hakan
Replied by Hakan on topic EtherCAT driver as simply positioner
I think you want to use PP (Profile Position) mode.
It's a cia402 op-mode, with some  luck your drive supports it.
You need to set Profile Velocity and Profile Accelerations, from that
the drive will move to the position you set with for example halcmd setp pin position

dbraun1981's cia402 component doesn't support pp mode but you can easily add it.
WIthout any detail, these are the steps.
Set controlword to 6, 7, 15 (op-enabled)
Set op-mode to 1 (pp)
Set pp accelerations and velocity
Set pp position
wait (optional check target_reached)
Set new pp position
wait ...
and so on.
The following user(s) said Thank You: tuxcnc

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

  • tuxcnc
  • Away
  • Premium Member
  • Premium Member
More
16 Feb 2026 21:28 #343072 by tuxcnc
Replied by tuxcnc on topic EtherCAT driver as simply positioner

Set controlword to 6, 7, 15 (op-enabled)
 

It is it.
Now works.
(Not usable yet, but homing and moves).
XML config file:
    <slave idx="0" type="generic" vid="0000ffff" pid="00000001" configPdos="true">
      <!-- 
        Distributed Clock Configuration
        assignActivate: Activation time for DC in ms
        sync0Cycle: Sync0 cycle multiplier (*1 = 1 ms)
        sync0Shift: Phase shift for Sync0 event
      -->
      <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
      <sdoConfig idx="6098" subIdx="00"><sdoDataRaw data ="13 00"/></sdoConfig>  <!-- Home mode 19 (use HOME-switch input)-->
      <!-- 
        Sync Manager for Output (Commands sent to drive)
        idx: Sync Manager index (2 is standard for outputs)
        dir: Direction (out = from master to slave)
      -->
      <syncManager idx="2" dir="out">
        <!-- 
          Process Data Object (PDO) for Output
          idx: PDO index (1600h is standard for TxPDO)
        -->
        <pdo idx="1600">
          <pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="controlword" halType="u32"/>
          <pdoEntry idx="6060" subIdx="00" bitLen="8" halPin="opmode" halType="s32"/>
          <pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="target-position" halType="s32"/>
          <pdoEntry idx="60FF" subIdx="00" bitLen="32" halPin="target-speed" halType="s32"/>
        </pdo>
      </syncManager>

      <!-- 
        Sync Manager for Input (Status received from drive)
        idx: Sync Manager index (3 is standard for inputs)
        dir: Direction (in = from slave to master)
      -->
      <syncManager idx="3" dir="in">
        <!-- 
          Process Data Object (PDO) for Input
          idx: PDO index (1A00h is standard for RxPDO)
        -->
        <pdo idx="1a00">
          <pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="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="606C" subIdx="00" bitLen="32" halPin="actual-velocity" halType="s32"/>
          <pdoEntry idx="6077" subIdx="00" bitLen="16" halPin="actual-torque" halType="s32"/>
          <!-- Digtial_inputs (cia402 compatible) -->
          <pdoEntry idx="60FD" subIdx="0" bitLen="32" halType="complex">
            <complexEntry bitLen="1" halPin="CW-limit" halType="bit"/>
            <complexEntry bitLen="1" halPin="CCW-limit" halType="bit"/>
            <complexEntry bitLen="1" halPin="HOME-switch" halType="bit"/>
            <complexEntry bitLen="23"/>
            <complexEntry bitLen="1" halPin="IN-4" halType="bit"/>
          </pdoEntry>

        </pdo>
      </syncManager>
    </slave>
Script:
#!/bin/bash
halcmd setp lcec.0.0.opmode 6
halcmd setp lcec.0.0.controlword 6
halcmd setp lcec.0.0.controlword 7
halcmd setp lcec.0.0.controlword 15
halcmd setp lcec.0.0.controlword 31
sleep 2
halcmd setp lcec.0.0.opmode 8
halcmd setp lcec.0.0.controlword 6
halcmd setp lcec.0.0.controlword 7
halcmd setp lcec.0.0.controlword 15
halcmd setp lcec.0.0.target-speed 1
halcmd setp lcec.0.0.target-position 4000
exit 0
And HAL only for testing:
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

addf lcec.read-all            servo-thread
addf motion-command-handler   servo-thread
addf motion-controller        servo-thread
addf lcec.write-all           servo-thread

setp iocontrol.0.emc-enable-in 1
No speed and acceleration control, it is to do...

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

Time to create page: 0.064 seconds
Powered by Kunena Forum