HAL CiA402 Drive Interface for Can Bus,Ethercat etc...
- rodw
-
- Offline
- Platinum Member
-
Less
More
- Posts: 11306
- Thank you received: 3785
24 Mar 2022 07:20 #238200
by rodw
Replied by rodw on topic HAL CiA402 Drive Interface for Can Bus,Ethercat etc...
Well, this is interesting. Homing is now able to be a user defined module thanks to Dewey Garrett
github.com/LinuxCNC/linuxcnc/commit/08ac...b0cd47dc0eedfbc36785
Docs: linuxcnc.org/docs/devel/html/man/man9/homecomp.9.html
This sounds like what is required.
github.com/LinuxCNC/linuxcnc/commit/08ac...b0cd47dc0eedfbc36785
Docs: linuxcnc.org/docs/devel/html/man/man9/homecomp.9.html
This sounds like what is required.
Please Log in or Create an account to join the conversation.
- sqmathlete
- Offline
- Premium Member
-
Less
More
- Posts: 118
- Thank you received: 18
28 Mar 2022 23:03 - 28 Mar 2022 23:06 #238562
by sqmathlete
Replied by sqmathlete on topic HAL CiA402 Drive Interface for Can Bus,Ethercat etc...
Hi Rod,
Thanks for you're very detailed instructions on how to install ethercat and linuxcnc . Worked perfectly!
Also, I totally agree, this github.com/LinuxCNC/linuxcnc/commit/08ac...b0cd47dc0eedfbc36785
is very interesting. I think this would be way more elegant than forcing the code to ignore the homing error and would keep everything in one place rather than spread out over several files. Being able to eliminate having to create an ini variable and allow one to focus on dropping through the homing states is also nice. Thanks Garret Dewey!
I've posted my homing.c file, it's a bit of a mess but you can see how I dropped through the homing states.
Dan
Thanks for you're very detailed instructions on how to install ethercat and linuxcnc . Worked perfectly!
Also, I totally agree, this github.com/LinuxCNC/linuxcnc/commit/08ac...b0cd47dc0eedfbc36785
is very interesting. I think this would be way more elegant than forcing the code to ignore the homing error and would keep everything in one place rather than spread out over several files. Being able to eliminate having to create an ini variable and allow one to focus on dropping through the homing states is also nice. Thanks Garret Dewey!
I've posted my homing.c file, it's a bit of a mess but you can see how I dropped through the homing states.
Dan
Attachments:
Last edit: 28 Mar 2022 23:06 by sqmathlete. Reason: Linked whole paragraph
Please Log in or Create an account to join the conversation.
- sqmathlete
- Offline
- Premium Member
-
Less
More
- Posts: 118
- Thank you received: 18
28 Mar 2022 23:08 #238563
by sqmathlete
Replied by sqmathlete on topic HAL CiA402 Drive Interface for Can Bus,Ethercat etc...
The previous homing.c file name looked weird. Try this one.
Attachments:
Please Log in or Create an account to join the conversation.
- bkt
-
- Offline
- Platinum Member
-
Less
More
- Posts: 1224
- Thank you received: 113
05 Apr 2022 19:03 #239369
by bkt
Replied by bkt on topic HAL CiA402 Drive Interface for Can Bus,Ethercat etc...
sorry at all .... but can mix old style lcec xml with cia402 style like these?
or need to set all axis with new cia402_comp (in hal and in xml) ??
regards
bkt
<slave idx="0" type="generic" vid="000007DD" pid="01" configPdos="true">
<sdoConfig idx="6060" subIdx="0"><sdoDataRaw data="08"/></sdoConfig>
<sdoConfig idx="60C2" subIdx="1"><sdoDataRaw data="01"/></sdoConfig>
<sdoConfig idx="60C2" subIdx="2"><sdoDataRaw data="FD"/></sdoConfig>
<sdoConfig idx="607E" subIdx="0"><sdoDataRaw data="E0"/></sdoConfig>
<syncManager idx="0" dir="out"></syncManager>
<syncManager idx="1" dir="in"></syncManager>
<syncManager idx="2" dir="out">
<pdo idx="1601">
<pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="driverControl" halType="bit"/>
<pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="posCommand" halType="float" scale="71750"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1A01">
<pdoEntry idx="603F" subIdx="00" bitLen="16" halPin="errorStat" halType="bit"/>
<pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="driverStatus" halType="bit"/>
<pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="posActual" halType="float" scale="0.000013937"/>
<pdoEntry idx="606C" subIdx="00" bitLen="32" halPin="velActual" halType="float" scale="0.000013937"/>
<pdoEntry idx="6077" subIdx="00" bitLen="16" halPin="torkStat" halType="float" scale="0.1"/>
</pdo>
</syncManager>
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="500000"/>
<slave idx="1" type="generic" vid="000007DD" pid="01" configPdos="true">>
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
<syncManager idx="2" dir="out">
<pdo idx="1600">
<pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="cia-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-velocity" halType="s32"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1a00">
<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="606C" subIdx="00" bitLen="32" halPin="actual-velocity" halType="s32"/>
<pdoEntry idx="6077" subIdx="00" bitLen="32" halPin="actual-torque" halType="s32"/>
</pdo>
</syncManager>
</slave>
or need to set all axis with new cia402_comp (in hal and in xml) ??
regards
bkt
Please Log in or Create an account to join the conversation.
- rodw
-
- Offline
- Platinum Member
-
Less
More
- Posts: 11306
- Thank you received: 3785
05 Apr 2022 20:03 - 05 Apr 2022 20:05 #239375
by rodw
Replied by rodw on topic HAL CiA402 Drive Interface for Can Bus,Ethercat etc...
CiA402 is a standard that specifies a set of registers and what they do.
So yes, you still need to define them in the ethercat xml file in the first instance.
The cia402.comp of Dominic's brings that standard structure into hal.
sqmathelete (Dan) and I are working on a replacement homing module using the new homecomp.comp in master branch.
Don't hold your breath as its very early days.
If we are successful, the cia402.comp will be likely redundant. It still relies on standard homing.c and it makes a mess of what is needed to home internally so the ability to install our own version of homing.c in the ini file will be very exciting.
EDIT: But the amazing foundation work by Dominc in cia402.comp is a very important part of the proposed module.
So yes, you still need to define them in the ethercat xml file in the first instance.
The cia402.comp of Dominic's brings that standard structure into hal.
sqmathelete (Dan) and I are working on a replacement homing module using the new homecomp.comp in master branch.
Don't hold your breath as its very early days.
If we are successful, the cia402.comp will be likely redundant. It still relies on standard homing.c and it makes a mess of what is needed to home internally so the ability to install our own version of homing.c in the ini file will be very exciting.
EDIT: But the amazing foundation work by Dominc in cia402.comp is a very important part of the proposed module.
Last edit: 05 Apr 2022 20:05 by rodw.
The following user(s) said Thank You: bkt
Please Log in or Create an account to join the conversation.
- bkt
-
- Offline
- Platinum Member
-
Less
More
- Posts: 1224
- Thank you received: 113
05 Apr 2022 22:06 #239395
by bkt
Replied by bkt on topic HAL CiA402 Drive Interface for Can Bus,Ethercat etc...
thanks rodw .... my xml is a mix of xml cia402 and old style xml for ethercat conf .... is possible use it or not? because i receive error and not understand if is related or not.
regards
regards
Please Log in or Create an account to join the conversation.
- rodw
-
- Offline
- Platinum Member
-
Less
More
- Posts: 11306
- Thank you received: 3785
05 Apr 2022 22:46 #239397
by rodw
Replied by rodw on topic HAL CiA402 Drive Interface for Can Bus,Ethercat etc...
Yes, I believe so. You just need to make sure the pins required by the component are defined by SDO's in your XML
Dominic has an example XML on his repo
Dominic has an example XML on his repo
Please Log in or Create an account to join the conversation.
- udoS
- Offline
- Elite Member
-
Less
More
- Posts: 216
- Thank you received: 25
16 Jun 2022 07:24 - 21 Jun 2023 14:00 #245247
by udoS
Replied by udoS on topic HAL CiA402 Drive Interface for Can Bus,Ethercat etc...
Hi to all;
I think I mentioned it somewhere else in some linuxcnc forum but...
Now this is not an open source thing but it works and solves the problem with the CIA402;
www.axelsoftware.it/en/logiclab/
I can hook the plc to the LinuxCNC HAL and do the homing with the drives; then let LinuxCNC take the actual pos;
best regards
I think I mentioned it somewhere else in some linuxcnc forum but...
Now this is not an open source thing but it works and solves the problem with the CIA402;
www.axelsoftware.it/en/logiclab/
I can hook the plc to the LinuxCNC HAL and do the homing with the drives; then let LinuxCNC take the actual pos;
best regards
Last edit: 21 Jun 2023 14:00 by udoS.
Please Log in or Create an account to join the conversation.
- Grotius
-
- Offline
- Platinum Member
-
Less
More
- Posts: 2414
- Thank you received: 2331
05 Jun 2025 20:39 #329770
by Grotius
Replied by Grotius on topic HAL CiA402 Drive Interface for Can Bus,Ethercat etc...
Hi,
The request:
A few weeks ago i recieved a ethercat servo drive from a forum sponsor. A Delta-asda-b3 drive and motor set.
The sponsor had a request for me. Figur out homing the drive using it with linuxcnc.
The difficulty:
Now the drive has internal home programs. And there comes the problem. How to deal with this using homemod.so?
Where homemod.so is the component responsible for linuxcnc home sequence.
The desired home sequence:
1. Home with search_vel to hard end stop of machine using a lower motor torque and stop on torque home limit value.
2. Move back from hard stop to find the first motor index z pulse, using the servo drive's internal home program.
The motivation to get it work:
1. Using the servo drives internal search for index z pulse program is the most accurate way to home a machine as it is not
depending on a servo cycle, where the servo cycle is not contributing to a ultra high precision.
In theory the index pulse may in between 2 servo cycles. This is what i mean with no ultra high precision.
My workflow:
1. To use the servo drive with ethercat i had to install lcec and cia402.
After installation and editing the ethercat .xml file, i was able to run the servo set.
2. The original cia402.so component was written in halcompile language.
The idea was to convert the halcompile component code into a c coded component.
This resulted in a base component, code can be found here.
3. After coding a few day's i was gradually understanding how the servo's work and i could expand the codebase
to include torque control. And i was able to run servo drive internal homing programs.
This resulted in a new component : libcia402
4. After up's and down's and trying different workflows i was able to edit the homemod.so component,
that is used by linuxcnc to do the home sequence.
The new component works exactly as the homemod.so, but it has additional features to enable external homing.
This resulted in a new component: libhomecia402
Note: The motivation to keep the homemod.so original is that users can now combine external homing on servo's
with steppers and homing works as normal.
Conclusion:
The extern homing on index works as expected.
Variations:
As we use the .ini file to set home configuration. In .hal we can set servo drive home program and more values.
Therefore i did not test other external home variations so far. But we can think of multiple home sequence variations.
Installation on rip systems:
Readme. Section installation.
The request:
A few weeks ago i recieved a ethercat servo drive from a forum sponsor. A Delta-asda-b3 drive and motor set.
The sponsor had a request for me. Figur out homing the drive using it with linuxcnc.
The difficulty:
Now the drive has internal home programs. And there comes the problem. How to deal with this using homemod.so?
Where homemod.so is the component responsible for linuxcnc home sequence.
The desired home sequence:
1. Home with search_vel to hard end stop of machine using a lower motor torque and stop on torque home limit value.
2. Move back from hard stop to find the first motor index z pulse, using the servo drive's internal home program.
The motivation to get it work:
1. Using the servo drives internal search for index z pulse program is the most accurate way to home a machine as it is not
depending on a servo cycle, where the servo cycle is not contributing to a ultra high precision.
In theory the index pulse may in between 2 servo cycles. This is what i mean with no ultra high precision.
My workflow:
1. To use the servo drive with ethercat i had to install lcec and cia402.
After installation and editing the ethercat .xml file, i was able to run the servo set.
2. The original cia402.so component was written in halcompile language.
The idea was to convert the halcompile component code into a c coded component.
This resulted in a base component, code can be found here.
3. After coding a few day's i was gradually understanding how the servo's work and i could expand the codebase
to include torque control. And i was able to run servo drive internal homing programs.
This resulted in a new component : libcia402
4. After up's and down's and trying different workflows i was able to edit the homemod.so component,
that is used by linuxcnc to do the home sequence.
The new component works exactly as the homemod.so, but it has additional features to enable external homing.
This resulted in a new component: libhomecia402
Note: The motivation to keep the homemod.so original is that users can now combine external homing on servo's
with steppers and homing works as normal.
Conclusion:
The extern homing on index works as expected.
Variations:
As we use the .ini file to set home configuration. In .hal we can set servo drive home program and more values.
Therefore i did not test other external home variations so far. But we can think of multiple home sequence variations.
Installation on rip systems:
Readme. Section installation.
The following user(s) said Thank You: tommylight, pommen, besriworld, COFHAL
Please Log in or Create an account to join the conversation.
- Grotius
-
- Offline
- Platinum Member
-
Less
More
- Posts: 2414
- Thank you received: 2331
08 Jun 2025 11:01 #329936
by Grotius
Replied by Grotius on topic HAL CiA402 Drive Interface for Can Bus,Ethercat etc...
Hi all.
In the previous post i designed a c coded cia402 component to use with external homing, running on a general ethercat .xml config.
In this post i can announce that i included a new driver into the lcec source code.
The delta-asda-b3 is now included. And it can use external homing using homemod_extern.so
The homemod_extern is specified in the .ini file : link
Now the hal file, looks quite simple :
hal example
And also the ethercat .xml file look simple :
ethercat-conf example
Source:
linuxcnc-etthercat
homemod_extern
In the previous post i designed a c coded cia402 component to use with external homing, running on a general ethercat .xml config.
In this post i can announce that i included a new driver into the lcec source code.
The delta-asda-b3 is now included. And it can use external homing using homemod_extern.so
The homemod_extern is specified in the .ini file : link
Now the hal file, looks quite simple :
hal example
And also the ethercat .xml file look simple :
ethercat-conf example
Source:
linuxcnc-etthercat
homemod_extern
Please Log in or Create an account to join the conversation.
Time to create page: 0.256 seconds