- Configuring LinuxCNC
- Advanced Configuration
- EtherCAT
- CiA 402 progress (RTelligent and Leadshine working!)
CiA 402 progress (RTelligent and Leadshine working!)
- scottlaird
-
Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 136
- Thank you received: 160
20 Apr 2024 19:08 #298746
by scottlaird
CiA 402 progress (RTelligent and Leadshine working!) was created by scottlaird
Progress on CiA 402 driver issues has been kind of slow lately, between a mix of travel, work, and a couple really annoying bugs that took way to long to track down.
But, I *think* we're good now. I just merged a bunch of changes and released v1.32.0.
At this point, we have "normal-looking" drivers for most RTelligent and Leadshine CiA 402 stepper drives, including the dual-axis models that they both make. I have 3 different RT drives (ECT60, ECT60x2, ECR60x2) and 1 Leadshine drive (2CS3E-D507) in my test system. You should be able to use them by just adding something like this to your XML config:
I've also enhanced `lcec_configgen` so that drivers can communicate with it to provide suggested <modParam>s. Just run `lcec_configgen` and it'll print a suggested config. The slave portions are better than the non-slave portions right now. Here's what it provides for the ECT60x2:
There are a lot of additional settings in the RT driver (and almost none in the Leadshine driver at the moment), but only the ones that will generally need to be changed are listed automatically. See linuxcnc-ethercat.github.io/linuxcnc-ethercat/ for device-specific documentation.
One thing that the documentation probably doesn't make clear enough -- you mostly need to use the `cia402` HAL component in order to get any of the CiA 402 devices to work, no matter what your XML file looks like. Generic, `basic_cia402`, or a device-specific driver, they all need the `cia402` component to work. Hopefully we'll be able to make this less complex (or at least better-documented) soon.
But, I *think* we're good now. I just merged a bunch of changes and released v1.32.0.
At this point, we have "normal-looking" drivers for most RTelligent and Leadshine CiA 402 stepper drives, including the dual-axis models that they both make. I have 3 different RT drives (ECT60, ECT60x2, ECR60x2) and 1 Leadshine drive (2CS3E-D507) in my test system. You should be able to use them by just adding something like this to your XML config:
<slave idx="4" type="ECT60x2" name="rt-ect60x2"/>
<slave idx="5" type="2CS3E-D507" name="ls-2cl3"/>
<slave idx="7" type="ECT60" name="rt-ect60"/>
<slave idx="8" type="ECR60x2" name="rt-ecr60x2"/>
I've also enhanced `lcec_configgen` so that drivers can communicate with it to provide suggested <modParam>s. Just run `lcec_configgen` and it'll print a suggested config. The slave portions are better than the non-slave portions right now. Here's what it provides for the ECT60x2:
<slave idx="4" type="ECT60x2" name="D26">
<!-- Enable support for Cyclic Synchronous Position mode. -->
<modParam name="ch1enableCSP" value="true"/>
<!-- Enable support for Cyclic Synchronous Position mode. -->
<modParam name="ch2enableCSP" value="true"/>
<!-- Enable support for Cyclic Synchronous Velocity mode. -->
<modParam name="ch1enableCSV" value="false"/>
<!-- Enable support for Cyclic Synchronous Velocity mode. -->
<modParam name="ch2enableCSV" value="false"/>
<!-- Maximum stepper Amps. -->
<modParam name="ch1peakCurrent_amps" value="6.0"/>
<!-- Maximum stepper Amps. -->
<modParam name="ch2peakCurrent_amps" value="6.0"/>
<!-- Operation mode: openloop, closedloop, or foc. -->
<modParam name="ch1controlMode" value="closedloop"/>
<!-- Operation mode: openloop, closedloop, or foc. -->
<modParam name="ch2controlMode" value="closedloop"/>
<!-- Number of encoder steps per revolution. -->
<modParam name="ch1encoderResolution" value="4000"/>
<!-- Number of encoder steps per revolution. -->
<modParam name="ch2encoderResolution" value="4000"/>
<!-- Output 1 use: general, alarm, brake, in-place. -->
<modParam name="ch1output1Func" value="alarm"/>
<!-- Output 1 use: general, alarm, brake, in-place. -->
<modParam name="ch2output1Func" value="alarm"/>
<!-- Output 2 use: general, alarm, brake, in-place. -->
<modParam name="ch1output2Func" value="brake"/>
<!-- Output 2 use: general, alarm, brake, in-place. -->
<modParam name="ch2output2Func" value="brake"/>
<!-- Input 3 use: general, cw-limit, ccw-limit, home, clear-fault, emergency-stop, motor-offline, probe1, probe2 -->
<modParam name="ch1input3Func" value="cw-limit"/>
<!-- Input 3 use: general, cw-limit, ccw-limit, home, clear-fault, emergency-stop, motor-offline, probe1, probe2 -->
<modParam name="ch2input3Func" value="cw-limit"/>
<!-- Input 4 use: general, cw-limit, ccw-limit, home, clear-fault, emergency-stop, motor-offline, probe1, probe2 -->
<modParam name="ch1input4Func" value="ccw-limit"/>
<!-- Input 4 use: general, cw-limit, ccw-limit, home, clear-fault, emergency-stop, motor-offline, probe1, probe2 -->
<modParam name="ch2input4Func" value="ccw-limit"/>
<!-- Input 5 use: general, cw-limit, ccw-limit, home, clear-fault, emergency-stop, motor-offline, probe1, probe2 -->
<modParam name="ch1input5Func" value="home"/>
<!-- Input 5 use: general, cw-limit, ccw-limit, home, clear-fault, emergency-stop, motor-offline, probe1, probe2 -->
<modParam name="ch2input5Func" value="home"/>
<!-- Input 6 use: general, cw-limit, ccw-limit, home, clear-fault, emergency-stop, motor-offline, probe1, probe2 -->
<modParam name="ch1input6Func" value="motor-offline"/>
<!-- Input 6 use: general, cw-limit, ccw-limit, home, clear-fault, emergency-stop, motor-offline, probe1, probe2 -->
<modParam name="ch2input6Func" value="motor-offline"/>
</slave>
There are a lot of additional settings in the RT driver (and almost none in the Leadshine driver at the moment), but only the ones that will generally need to be changed are listed automatically. See linuxcnc-ethercat.github.io/linuxcnc-ethercat/ for device-specific documentation.
One thing that the documentation probably doesn't make clear enough -- you mostly need to use the `cia402` HAL component in order to get any of the CiA 402 devices to work, no matter what your XML file looks like. Generic, `basic_cia402`, or a device-specific driver, they all need the `cia402` component to work. Hopefully we'll be able to make this less complex (or at least better-documented) soon.
The following user(s) said Thank You: rodw, besriworld, Pro_El, CORBETT, onceloved
Please Log in or Create an account to join the conversation.
- aeth
- Offline
- New Member
-
Less
More
- Posts: 13
- Thank you received: 0
14 May 2025 20:09 #328485
by aeth
Replied by aeth on topic CiA 402 progress (RTelligent and Leadshine working!)
Thank you for this amazing contribution! Does it also work with CL3-E57H? The documentation seems to mention support for the dual version, but not the single one, but then it seems that this version is nearly identical to CS3E-D507, only for the Asian market? Getting this version would help me save quite a lot of money compared to CS3E-D507!
Please Log in or Create an account to join the conversation.
- jrc
- Offline
- New Member
-
Less
More
- Posts: 3
- Thank you received: 1
12 Sep 2025 09:59 #334873
by jrc
Replied by jrc on topic CiA 402 progress (RTelligent and Leadshine working!)
Many thanks for this! I am using (or rather trying to use!) 2 units of 2CS3E-D507 dual-stepper drives for the arm and carousel platters in a dual-carousel machine, and need a little help with working out how to define the joints and address each stepper motor in the drive separately.
Looking at just one stepper drive, say for the right-hand carousel, if its index is 9, I assume I need to put in my ethercat.xml something like:
possibly with some modParam entries as needed.
The question is what do I need to do after than in machine.ini, machine.hal, and cia402.comp so that I can address each of the two motors (two in each drive) separately and associate each of them with its own individual joint. And once I have done than, what is the name of each of them?
Normally they end up producing a lot of pins with a "base name" which looks like "lcec.0.x.", thus lcec.0.4.cia_statusword for example.
My naive idea is to put something like this in machine.ini, assuming this carousel uses joints 6 and 7 :
cia402.comp presumably needs something like:
What about machine.hal? Presumably the top part needs something like :
However, what do I need to put lower down to link the joints 6 and 7, cia402's and lcec's?
My current bit for the X-axis using EL8 servo drives looks like the code below. What is the rough equivalent for a dual-stepper drive that needs to associate each of the two steppers controlled by the drive to joints 6 and 7 respectively?
Many thanks!
Looking at just one stepper drive, say for the right-hand carousel, if its index is 9, I assume I need to put in my ethercat.xml something like:
<slave idx="9" type="2CS3E-D507" name="ATC-Right" />
possibly with some modParam entries as needed.
The question is what do I need to do after than in machine.ini, machine.hal, and cia402.comp so that I can address each of the two motors (two in each drive) separately and associate each of them with its own individual joint. And once I have done than, what is the name of each of them?
Normally they end up producing a lot of pins with a "base name" which looks like "lcec.0.x.", thus lcec.0.4.cia_statusword for example.
My naive idea is to put something like this in machine.ini, assuming this carousel uses joints 6 and 7 :
#*** RIGHT CAROUSEL *******************************
#** arm **
[JOINT_6]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -10.0
MAX_LIMIT = 200.0
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 750.0
FERROR = 1000
MIN_FERROR = 1000
HOME_ABSOLUTE_ENCODER = 2
#** platter **
[JOINT_7]
TYPE = LINEAR (maybe "ANGULAR"?)
HOME = 0.0
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 750.0
FERROR = 1000
MIN_FERROR = 1000
HOME_ABSOLUTE_ENCODER = 2
#******************************************
cia402.comp presumably needs something like:
##########################\n
# Functions servo-thread\n
##########################\n
addf lcec.read-all servo-thread\n
addf cia402.6.read-all servo-thread\n
addf cia402.7.read-all servo-thread\n
addf motion/ PIDs / PCL / etc .\n
addf cia402.6.write-all servo-thread\n
addf cia402.7.write-all servo-thread\n
addf lcec.write-all servo-thread\n
#########################################\n
#nets .....\n
What about machine.hal? Presumably the top part needs something like :
addf cia402.6.read-all servo-thread
addf cia402.7.read-all servo-thread
addf cia402.6.write-all servo-thread
addf cia402.7.write-all servo-thread
However, what do I need to put lower down to link the joints 6 and 7, cia402's and lcec's?
My current bit for the X-axis using EL8 servo drives looks like the code below. What is the rough equivalent for a dual-stepper drive that needs to associate each of the two steppers controlled by the drive to joints 6 and 7 respectively?
#*******************
# AXIS X lcec.0.5 cia402.0 joint.0
#*******************
setp cia402.0.csp-mode 1
setp cia402.0.pos-scale -2000
# joint signals for motion
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 x-enable joint.0.amp-enable-out => cia402.0.enable
net x-amp-fault joint.0.amp-fault-in <= cia402.0.drv-fault
# ethercat to cia402 driver
net x-statusword lcec.0.5.cia-statusword => cia402.0.statusword
net x-opmode-display lcec.0.5.opmode-display => cia402.0.opmode-display
net x-drv-act-pos lcec.0.5.actual-position => cia402.0.drv-actual-position
# cia402 driver to ethercat
net x-controlword cia402.0.controlword => lcec.0.5.cia-controlword
net x-modes-of-operation cia402.0.opmode => lcec.0.5.opmode
net x-drv-target-pos cia402.0.drv-target-position => lcec.0.5.target-position
# homing
#net x-home-request joint.0.request-custom-homing => cia402.0.home
#net x-homing joint.0.is-custom-homing <= cia402.0.stat-homing
#net x-homed joint.0.custom-homing-finished <= cia402.0.stat-homed
Many thanks!
Please Log in or Create an account to join the conversation.
- Configuring LinuxCNC
- Advanced Configuration
- EtherCAT
- CiA 402 progress (RTelligent and Leadshine working!)
Time to create page: 0.399 seconds