[etherlab-users] dc_user example understanding

Florian Pose fp at igh-essen.com
Fri Feb 5 09:25:09 CET 2010


HI,

On Thu, Jan 21, 2010 at 10:39:53AM +0100, Peter van Knippenbergh wrote:
> Here is part of the code I try to understand including the questions
> 
>     app_time.tv_usec += 1000000 / FREQUENCY;
>     if (app_time.tv_usec >= 1000000)  {
>         app_time.tv_usec -= 1000000;
>         app_time.tv_sec++;
>     }
>     ecrt_master_application_time(master, EC_TIMEVAL2NANO(app_time));
> 
> What is the result of this call for the slaves (after the ecrt_master_send
> call)??

Let me cite from the documentation of ecrt_master_application_time(): ;-)

„The master has to know the application's time when operating slaves with
distributed clocks. The time is not incremented by the master itself, so
this method has to be called cyclically.

The time is used when setting the slaves' <tt>System Time Offset</tt> and
<tt>Cyclic Operation Start Time</tt> registers and when synchronizing the
DC reference clock to the application time via
ecrt_master_sync_reference_clock().

The time is defined as nanoseconds from 2000-01-01 00:00. Converting an
epoch time can be done with the EC_TIMEVAL2NANO() macro.“

>     if (sync_ref_counter) {
>         sync_ref_counter--;
>     } else {
>         sync_ref_counter = 9;
>         ecrt_master_sync_reference_clock(master);
> 
> What is the result for the slaves of this call for the slaves (after the
> ecrt_master_send call) ??

„The reference clock will by synchronized to the application time provided
by the last call off ecrt_master_application_time().“

>     ecrt_master_sync_slave_clocks(master);
> 
> Here I assume that after the ecrt_master_send all the slave clocks are
> synchronized with the DC master clock and the DC master clock will not be
> changed. Correct ??

The slave clocks (the local clocks on the slaves supporting DC after the
reference clock) are slightly tuned towards the reference clock, so when
calling this cyclically, they will be more or less equal to the
reference clock at some point in time.

Please also have a look at the DC chapter in the master PDF documentation.

-- 
Best regards,
Florian Pose

http://etherlab.org



More information about the Etherlab-users mailing list