Ethercat random jitter fix
- Hakan
- Offline
- Platinum Member
-
- Posts: 1316
- Thank you received: 451
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
-
Topic Author
- Away
- Elite Member
-
- Posts: 266
- Thank you received: 337
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.
Please Log in or Create an account to join the conversation.
- grandixximo
-
Topic Author
- Away
- Elite Member
-
- Posts: 266
- Thank you received: 337
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.
- andrax
-
- Offline
- Elite Member
-
- Posts: 261
- Thank you received: 62
Please Log in or Create an account to join the conversation.
- Hakan
- Offline
- Platinum Member
-
- Posts: 1316
- Thank you received: 451
Please Log in or Create an account to join the conversation.
- Atsu
- Offline
- New Member
-
- Posts: 13
- Thank you received: 3
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.
Please Log in or Create an account to join the conversation.
- Atsu
- Offline
- New Member
-
- Posts: 13
- Thank you received: 3
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
-
Topic Author
- Away
- Elite Member
-
- Posts: 266
- Thank you received: 337
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.
Please Log in or Create an account to join the conversation.
- Atsu
- Offline
- New Member
-
- Posts: 13
- Thank you received: 3
Please Log in or Create an account to join the conversation.
- TAKUYA
- Offline
- Junior Member
-
- Posts: 31
- Thank you received: 4
Or should i use this patch with the settings above?
github.com/grandixximo/linuxcnc-ethercat
Please Log in or Create an account to join the conversation.