Ethercat random jitter fix

More
09 Mar 2026 08:13 #344050 by Hakan
Replied by Hakan on topic Ethercat random jitter fix

Now as in just recently or in the patch from last year? or reaaally recently
Also, what does the refClockSyncCycles value do and is there any baseline on what to set it at?
 
github.com/linuxcnc-ethercat/linuxcnc-et...84ef36b53f0b734eaedf
the above is my patch, which I tested on real hardware, both 
refClockSyncCycles="5"
or any other positive number, this will have linuxcnc ask the slaves to sync to it every 5 cycles, put in whatever number you need to get phased in the time frame you desire, 
 
 


Did you change this because that is not how it works today.
refClockSyncCycles sets the time of the EtherCAT master (and from there, the slaves).
Linuxcnc servo loop time and speed is different from the EtherCAT master time and speed,
that's what causes these synchronization problems.
No value of refClockSyncCycles will make the linuxcnc servo loop synch to the EtherCAT master.
Except a negative which activates PLL which is a different thing.

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

  • grandixximo
  • grandixximo's Avatar Topic Author
  • Away
  • Elite Member
  • Elite Member
More
09 Mar 2026 08:34 - 09 Mar 2026 08:42 #344051 by grandixximo
Replied by grandixximo on topic Ethercat random jitter fix
It was a simplified model of how it actually works, just to have a rough model in the users mind.
positive refClockSyncCycles has linuxcnc-ethercat ask ethercat-master to ask the slaves to do the sync by sending the clock time.
this is how it always worked I think...

what I did for positive refClockSyncCycles, I added an initial bang-bang to nudge the servo loop in the correct phasing with sync0shift, not ideal but it works, after that is done every x specified cycle we set the time again, this works well.

there are two main causes of the grinding noise, one is clock drift, this happens if you have
refClockSyncCycles=0
nothing stops the drives and linuxcnc to drift apart
the second is servo thread startup time having a random offset with sync0shift , to fix this you can either use PLL with refClockSyncCycles=-1, which is constant PLL every cycle, or set refClockSyncCycles=5 for example, and in this version of the code I shared, it will bang-bang for the first 100 cycles only, to find proper shift, and then just set time every 5 cycles.
 
Last edit: 09 Mar 2026 08:42 by grandixximo.

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

  • grandixximo
  • grandixximo's Avatar Topic Author
  • Away
  • Elite Member
  • Elite Member
More
09 Mar 2026 08:57 #344052 by grandixximo
Replied by grandixximo on topic Ethercat random jitter fix
What I wrote was
linuxcnc ask the slaves to sync to it every 5 cycles

"It" being linucxcnc servo thread.

But you understand
"Linuxcnc servo loop synch to the EtherCAT master."

That's not what I meant

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

More
09 Mar 2026 17:13 #344059 by andrax
Replied by andrax on topic Ethercat random jitter fix
I cannot activate syncToRefClock="true". I get ‘invalid master attribute’. My EtherCAT version 1.6.8.g2543cc5-1+27.2 is probably too old, even though I installed it last autumn.

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

More
09 Mar 2026 17:37 #344061 by Hakan
Replied by Hakan on topic Ethercat random jitter fix
Yes, too old. Use a negative number to refClockSyncCycles. That's equivalent to the syncToRefClock="true".

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

More
09 Mar 2026 18:19 - 09 Mar 2026 18:23 #344062 by Atsu
Replied by Atsu on topic Ethercat random jitter fix

After activation of PLL there shouldn't be any random clicks anymore.
Check dmesg if you get any errors there, it can be the network adapter too.


In my case, activation of PLL fixed the issue almost entirely, but the random clunk noises still occur every once in a while, just not nearly as often. After updating to the latest version from the linuxcnc-ethercat repo, I haven't had it occur during motion anymore, which is a good sign. However, I haven't run the machine much yet, so more testing is needed. I will also check the dmesg you pointed out.
Last edit: 09 Mar 2026 18:23 by Atsu.

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

More
09 Mar 2026 18:26 #344063 by Atsu
Replied by Atsu on topic Ethercat random jitter fix

I could share my experience with this issue. Attached is a link to a video showing how the jitter sounds on StepperOnline A6 servos. This is exaggerated by disabling the synchronization. Once synchronization is enabled (syncToRefClock="true" or refClockSyncCycles="-1"), it still happens but much more rarely, just like grandixximo explained at the start of this post. Last week, I upgraded to the latest version of linuxcnc-ethercat, and am currently testing how the changes committed at the end of 2025 affect my machine configuration.

​​​https://imgur.com/a/FXSuvOS
 
Thank you for the independent testing, if you want a better version

github.com/linuxcnc-ethercat/linuxcnc-et...84ef36b53f0b734eaedf

this I have tested and works well, unfortunately Scott has not been around to merge it, so it is not in the main linuxcnc-ethercat repo yet, but it is a better version


Great, thanks! I'll switch to that version and continue testing.

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

  • grandixximo
  • grandixximo's Avatar Topic Author
  • Away
  • Elite Member
  • Elite Member
More
10 Mar 2026 06:52 - 11 Mar 2026 07:44 #344082 by grandixximo
Replied by grandixximo on topic Ethercat random jitter fix

It sounds like you get gravel in the servo motors from time to time.
Or you get click sounds from the motors. It repeats itself with a few or many minutes apart.
The first thing to do is to enable syncToRefClock and enable DC mode for the servos,
this will keep the servo loop in sync with the DC.

What grandixximo is doing here is fixing an effect that despite DC and servo loop are synchronized,
the two loops have been started with an undetermined/unfortunate phase between them.
The gravel sound is there all the time and it doesn't go away until linuxcnc is restarted.

Surprisingly, yesterday Sasha Ittner popped up in the PR log and mentioned he had been working
on a complete redesign of the DC system, eliminating all these problems (don't know details)
grandixximo seems to have reviewed that work and decided to adopt Sasha's work.
grandixximo will have to say himself. And if you don't know, Sasha Ittner is the author of linuxcnc-ethercat
from many (>10) years ago. 
 


After reviewing on real hardware today, I found my original PR works better than what Sascha Ittner did in his repo, I reverted back to the original state before I started reviewing Sasha's work.
If anyone wants to help me test, I'd love feedback on the code in my repo, because for me this is what works.
github.com/grandixximo/linuxcnc-ethercat
But I need more data from other testers.
To prove the system works, you should get grinding noise, if you set sync0shift of your drive to be half your max servo latency, open halscope and scope your servo-thread and open a couple of glxgears to induce latency in the servo thread, this should induce the grinding noise, and the noise will not be anywhere else.
Last edit: 11 Mar 2026 07:44 by grandixximo.

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

More
11 Mar 2026 05:56 #344127 by Atsu
Replied by Atsu on topic Ethercat random jitter fix
I’ll switch to your PR and test it on my hardware the next time I’m working with my mill.

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

More
11 Mar 2026 15:54 - 11 Mar 2026 15:55 #344139 by TAKUYA
Replied by TAKUYA on topic Ethercat random jitter fix
Gotcha. i will try to get this (github.com/linuxcnc-ethercat/linuxcnc-et...84ef36b53f0b734eaedf) installed first, with syncToRefClock=true and ClockSyncCycles set to 5 to see if my jitter issues go away. they are very random as of right now.

Or should i use this patch with the settings above?
github.com/grandixximo/linuxcnc-ethercat
 
Last edit: 11 Mar 2026 15:55 by TAKUYA.

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

Time to create page: 0.499 seconds
Powered by Kunena Forum