Lcnc & Ethercat data types, Ethercat automated hal pin setup.

  • Grotius
  • Grotius's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
04 May 2025 11:10 #327665 by Grotius
Hi all,

I was wondering why lcnc don't have the data types U8, U16, S8, S16 to use with ethercat lcec?
To me it looks like the lcec is some times loading S32 types (bigger data types) when it could load a U8.
The result is in-effiecient memory management. Don't get me wrong if this is not the case.

This issue came to light when i made a few tests to automate the ethercat hal pin setup for lcnc.
After automated hal pin setup worked i added new hal data types into the lcnc source code : U8, U16, S8, S16

Now the ethercat data types can be used 1:1 with lcnc.
For example a ethercat U16 is loaded into a hal pin off type U16 and
not as a U32 as before. This saves us the memory size of a U16 i guess?

Mention the automated hal pin names and the new data types:


In above picture, a component called ecad.so is loaded in hal. (lcec replacement)
The component name: ecad.so

When the component start's up, it load's c++ code that has a automated hal pin setup under the hood,
looking what kind off data types are used etc.
Setting up the hal pins :  hal pin setup

And at runtime update the hal pins every cycle :
Update hal pins: hal_pin_update

So far above situation works quite well.

In the ecad.so component we don't need any .xml config file anymore.
As the component just throws out all hal pins from the ethercat bus by itself.

What i didn't code yet, is time dc synchronisation. I tested a stepper config in axis, and steppers run just
as fast as using the linuxcnc-ethercat config. However i am on a really bad desktop pc.
Axis stepper config, driving one stepper motor: axis config
 
Attachments:

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

  • Hakan
  • Away
  • Platinum Member
  • Platinum Member
More
04 May 2025 13:11 - 04 May 2025 13:14 #327676 by Hakan
halType is limited to the data type that are in hal: bit, float, s32, u32.
Whatever comes from ethercat will be shoe-horned into one of those.

What I see many times is the difficulty the get the xml file right both in relation to the ethercat device and in relation to the hal code.
Unfortunately, halshow et al aren't available until linuxcnc is started and it doesn't start until the xml is right.
Last edit: 04 May 2025 13:14 by Hakan.
The following user(s) said Thank You: Grotius

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

  • Hakan
  • Away
  • Platinum Member
  • Platinum Member
More
04 May 2025 13:41 #327679 by Hakan
I hope to get to test this this week as well as the s-curve modification. Waiting for a test system.

It isn't bad with a xml file as such. There can be the same pdo in several places, and one need to pick the right one.
I doubt an automatic system can handle all situations.
For prototyping and creating a config, a graphics tool is really nice. But for production I don't mind a static config.
It isn't supposed to change. If it does something is wrong.
The following user(s) said Thank You: Grotius

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

  • Grotius
  • Grotius's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
04 May 2025 15:33 - 04 May 2025 15:34 #327687 by Grotius
Hi Hakan,

I did some extra coding and found a problem.
It turned out i used pdos info so far and not sdos info.
I see sdos can give more detailled info of the device. This is exactly what i need to get the used datatypes to set up the 1:1 hal pins and
their names.

halType is limited to the data type that are in hal: bit, float, s32, u32.
Whatever comes from ethercat will be shoe-horned into one of those.

This is stupid, this i really don't get.
We have a 4x40mm screw and we put it in a 20ft sea container, because we don't have other storage available.

I hope to get to test this this week as well as the s-curve modification.
The scurve runs fine in a simulation. But on real hardware most testers have problems with acceleration.
So i have to review that soon.
Last edit: 04 May 2025 15:34 by Grotius. Reason: remove empty lines

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

Time to create page: 0.156 seconds
Powered by Kunena Forum