EtherCAT driver as simply positioner
- tuxcnc
- Offline
- Premium Member
-
Less
More
- Posts: 141
- Thank you received: 12
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 ?
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.
- Hakan
- Offline
- Platinum Member
-
Less
More
- Posts: 1260
- Thank you received: 441
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.
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
- Offline
- Premium Member
-
Less
More
- Posts: 141
- Thank you received: 12
16 Feb 2026 21:28 #343072
by tuxcnc
Now works.
(Not usable yet, but homing and moves).
XML config file:Script:And HAL only for testing:No speed and acceleration control, it is to do...
Replied by tuxcnc on topic EtherCAT driver as simply positioner
It is it.Set controlword to 6, 7, 15 (op-enabled)
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>#!/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 0loadrt [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 1Please Log in or Create an account to join the conversation.
- tuxcnc
- Offline
- Premium Member
-
Less
More
- Posts: 141
- Thank you received: 12
17 Feb 2026 00:06 #343075
by tuxcnc
Replied by tuxcnc on topic EtherCAT driver as simply positioner
I can't use PP mode, but I found solution for CSP mode:
#!/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 value must be greater than maximum homing time
sleep 5
halcmd setp lcec.0.0.target-position 0
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
for i in {1000..100000..1000}
do
halcmd setp lcec.0.0.target-position $i
sleep 0.01
done
exit 0
Please Log in or Create an account to join the conversation.
- Hakan
- Offline
- Platinum Member
-
Less
More
- Posts: 1260
- Thank you received: 441
17 Feb 2026 07:37 #343084
by Hakan
Replied by Hakan on topic EtherCAT driver as simply positioner
Attachments:
Please Log in or Create an account to join the conversation.
- tuxcnc
- Offline
- Premium Member
-
Less
More
- Posts: 141
- Thank you received: 12
17 Feb 2026 11:20 #343090
by tuxcnc
I tried use configurations from other manufactures, but no luck.
Replied by tuxcnc on topic EtherCAT driver as simply positioner
It has, I suppose, but I have only brief manual in chinese and can't configure driver properly.So the drive didn't have Profile Position?
I tried use configurations from other manufactures, but no luck.
Please Log in or Create an account to join the conversation.
- tuxcnc
- Offline
- Premium Member
-
Less
More
- Posts: 141
- Thank you received: 12
17 Feb 2026 18:56 #343107
by tuxcnc
Replied by tuxcnc on topic EtherCAT driver as simply positioner
I done some investigations, and it seems my driver is simplified as possible and supports only homing and CSP modes.
There are no registers for velocity and acceleration, the driver uses internal default values.
In LinuxCNC xml configuration you can create hal pins for non existent registers and you can write to them, but it not affect the driver.
My bash script is far of dreams, but works.
There are no registers for velocity and acceleration, the driver uses internal default values.
In LinuxCNC xml configuration you can create hal pins for non existent registers and you can write to them, but it not affect the driver.
My bash script is far of dreams, but works.
Please Log in or Create an account to join the conversation.
Time to create page: 0.092 seconds