Ethercat random jitter fix
- Hakan
- Offline
- Platinum Member
-
Less
More
- Posts: 1260
- Thank you received: 441
09 Mar 2026 08:13 #344050
by Hakan
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.
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
-
Topic Author
- Away
- Premium Member
-
Less
More
- Posts: 150
- Thank you received: 247
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.
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
-
Topic Author
- Away
- Premium Member
-
Less
More
- Posts: 150
- Thank you received: 247
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
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.
Time to create page: 0.072 seconds