OpenEtherCATsociety / SOEM

Simple Open Source EtherCAT Master
Other
1.23k stars 653 forks source link

cannot clear DC activation #784

Open Edphoenixmax opened 4 months ago

Edphoenixmax commented 4 months ago

I wish all you good. I have noticed that the ecx_dcsync0 function will clear dc activation first ,then it will set the starttime of the sync0 signal. If I set DC activation at starttime 0(write data in the register directly) before I use this function , the slave cannot change to the OP state. I wanna ask what is the problem and what ado can I find the problem is By the way, is there any way to make sure the sync0 has been triggered correctly or not and how to measure the dc jitter? Thanks for your answer. I would appreciate it !

ArthurKetels commented 4 months ago

The sync start time is an absolute time at which the first sync pulse is triggered. If you set it to 0 and the slave clock is larger than 0 when you activate it, the sync will only be triggered after the slave clock has overflown and returns back to 0. For a 64 bit time that can be up to 584 years! So your slave will go to OP if you wait for a very very long time.

If you read the comments in the configdc code you will see that SOEM sets the sync start time a bit in the future to make sure that when the unit is activated the start trigger is yet to come.

There have been multiple post here on how to measure DC jitter. Please search. It includes very nice graphs how the clocks stabilize and show the remaining jitter between slaves and the master.