[etherlab-users] DC questions
Good morning, In the master documentation is reported, in DC section, that the reference clock is the one of the first slave that supports this functionality. This reference can be synchronized with the master clock. My questions, based on the 'dc_user' example, are the following: 1 - calling cyclically the function 'ecrt_master_sync_reference_clock()' I have that the reference clock is the one of the master? Only for this case is useful to call the function 'ecrt_master_application_time()' or I have to call it every time I want to use the DC? 2 - the function 'ecrt_master_sync_slave_clocks()' is used for the synchronization of all the slave clocks for every reference clock? If I want to exploit the DC functionality I have always to call it cyclically? 3 - it makes sense to call 'ecrt_slave_config_dc()' even for slaves which do not support the DC functionality, like the EL2004? Thank you for your help. Best regards, Tommaso ___ etherlab-users mailing list etherlab-users@etherlab.org http://lists.etherlab.org/mailman/listinfo/etherlab-users
Re: [etherlab-users] DC questions
Hi, 1) Distributed clocks can work in a couple of ways, but all ways require a slave DC master which should be the first DC slave in the network. Note: some slaves can act as a DC time master even though they are not fully DC capable: a) EtherCAT master is the master clock: - The computer is used as the DC master for the entire system. ecrt_master_application_time() must be called every cycle to tell the EtherLab master what the current PC time is. - Call ecrt_master_sync_reference_clock() to tell the slave DC master to sync to the EtherLab masters time. - Call ecrt_master_sync_slave_clocks() to tell all other DC slaves to sync to the slave DC master b) Slave DC master is the master clock. What I do is: - Get the slave DC masters time using ecrt_master_reference_clock_time() and sync the EtherLab masters cycle and time to it - Call ecrt_master_sync_slave_clocks() to tell all other DC slaves to sync to the slave DC master - Call ecrt_master_application_time() with the next cycles master time Note: With option b you need to adjust your masters PC's time by the drift time from the slave DC master time and adjust your realtime cycle to suit. I do this by having a wrapper around the time calls to rt_get_time() and use rt_sleep_until() (I use RTAI) rather than using a fixed periodic cycle. Option b is the best, because option a has way too much jitter and the slaves find it very hard to synchronise. Note: option b is the default option used via TwinCAT. 2) Yes, call ecrt_master_sync_slave_clocks() every cycle (and ecrt_master_application_time() and ecrt_master_reference_clock_time()). Just before the ecrt_master_send() call to reduce jitter. 3) No, only call ecrt_slave_config_dc() on slaves that support DC and are going to be used with DC. Regards, Graeme. -Original Message- From: etherlab-users [mailto:etherlab-users-boun...@etherlab.org] On Behalf Of Tommaso Sent: Friday, 10 June 2016 7:14 p.m. To: etherlab-users@etherlab.org Subject: [etherlab-users] DC questions Good morning, In the master documentation is reported, in DC section, that the reference clock is the one of the first slave that supports this functionality. This reference can be synchronized with the master clock. My questions, based on the 'dc_user' example, are the following: 1 - calling cyclically the function 'ecrt_master_sync_reference_clock()' I have that the reference clock is the one of the master? Only for this case is useful to call the function 'ecrt_master_application_time()' or I have to call it every time I want to use the DC? 2 - the function 'ecrt_master_sync_slave_clocks()' is used for the synchronization of all the slave clocks for every reference clock? If I want to exploit the DC functionality I have always to call it cyclically? 3 - it makes sense to call 'ecrt_slave_config_dc()' even for slaves which do not support the DC functionality, like the EL2004? Thank you for your help. Best regards, Tommaso ___ etherlab-users mailing list etherlab-users@etherlab.org http://lists.etherlab.org/mailman/listinfo/etherlab-users ___ etherlab-users mailing list etherlab-users@etherlab.org http://lists.etherlab.org/mailman/listinfo/etherlab-users
Re: [etherlab-users] DC questions
Just to try to clarify a little: "DC" is actually two separate but related features. The first is distributed time synchronisation, which ensures that the whole network has an approximately synchronised clock. This works in one of the two ways that Graeme indicates in #1 below. Most "infrastructure" slaves (bus couplers etc) and "smart" slaves (those with CoE) have a DC clock and support this kind of synchronisation, even if they don't support the next one. The second feature is action synced to that clock -- typically a slave can be set to capture inputs and/or generate outputs or just do its own internal processing synched to a specific timestamp (and then repeated cyclicly). This reduces jitter relative to the EtherCAT communications cycle. Only a smaller number of devices support this (typically those that require precisely timed outputs or that provide input timestamps), but this is what the ecrt_slave_config_dc() function is for -- all the other functions are for the first feature instead. The second feature requires the first, but the first can operate without the second. (And of Graeme's examples below, 1a is the method used by the dc_user sample. There's some sample code for 1b floating around the newsgroup archive somewhere.) > -Original Message- > From: etherlab-users [mailto:etherlab-users-boun...@etherlab.org] On Behalf > Of Graeme Foot > Sent: Monday, 13 June 2016 10:28 > To: Tommaso ; etherlab-users@etherlab.org > Subject: Re: [etherlab-users] DC questions > > Hi, > > 1) Distributed clocks can work in a couple of ways, but all ways require a slave > DC master which should be the first DC slave in the network. Note: some > slaves can act as a DC time master even though they are not fully DC capable: > > a) EtherCAT master is the master clock: > - The computer is used as the DC master for the entire system. > ecrt_master_application_time() must be called every cycle to tell the > EtherLab master what the current PC time is. > - Call ecrt_master_sync_reference_clock() to tell the slave DC master to sync > to the EtherLab masters time. > - Call ecrt_master_sync_slave_clocks() to tell all other DC slaves to sync to the > slave DC master > > b) Slave DC master is the master clock. What I do is: > - Get the slave DC masters time using ecrt_master_reference_clock_time() > and sync the EtherLab masters cycle and time to it > - Call ecrt_master_sync_slave_clocks() to tell all other DC slaves to sync to the > slave DC master > - Call ecrt_master_application_time() with the next cycles master time > > Note: With option b you need to adjust your masters PC's time by the drift time > from the slave DC master time and adjust your realtime cycle to suit. I do this > by having a wrapper around the time calls to rt_get_time() and use > rt_sleep_until() (I use RTAI) rather than using a fixed periodic cycle. > > Option b is the best, because option a has way too much jitter and the slaves > find it very hard to synchronise. Note: option b is the default option used via > TwinCAT. > > > 2) Yes, call ecrt_master_sync_slave_clocks() every cycle (and > ecrt_master_application_time() and ecrt_master_reference_clock_time()). > Just before the ecrt_master_send() call to reduce jitter. > > > 3) No, only call ecrt_slave_config_dc() on slaves that support DC and are going > to be used with DC. > > > Regards, > Graeme. > > > -----Original Message- > From: etherlab-users [mailto:etherlab-users-boun...@etherlab.org] On Behalf > Of Tommaso > Sent: Friday, 10 June 2016 7:14 p.m. > To: etherlab-users@etherlab.org > Subject: [etherlab-users] DC questions > > Good morning, > > In the master documentation is reported, in DC section, that the reference > clock is the one of the first slave that supports this functionality. This reference > can be synchronized with the master clock. > My questions, based on the 'dc_user' example, are the following: > 1 - calling cyclically the function 'ecrt_master_sync_reference_clock()' > I have that the reference clock is the one of the master? Only for this case is > useful to call the function 'ecrt_master_application_time()' or I have to call it > every time I want to use the DC? > 2 - the function 'ecrt_master_sync_slave_clocks()' is used for the > synchronization of all the slave clocks for every reference clock? If I want to > exploit the DC functionality I have always to call it cyclically? > 3 - it makes sense to call 'ecrt_slave_config_dc()' even for slaves which do not > support the DC functionality, like the EL2004? > > Thank you for your help. > > Best regards, > > Tommaso ___ etherlab-users mailing list etherlab-users@etherlab.org http://lists.etherlab.org/mailman/listinfo/etherlab-users
Re: [etherlab-users] DC questions
ck is slower (ie the period takes longer) then the time base * value should be increased each period */ void app_setTimeBase( int64_t in_timeBase ) { u_appTimeBase = in_timeBase; } /** add to the app time base value * * if the app clock is slower (ie the period takes longer) then the time base * value should be increased each period */ void app_addTimeBase( int64_t in_timeBase ) { u_appTimeBase += in_timeBase; } Regards, Graeme. From: Tommaso [mailto:furiosi.tomm...@gmail.com] Sent: Monday, 20 June 2016 8:21 p.m. To: Graeme Foot; gav...@compacsort.com; etherlab-users@etherlab.org Subject: R: [etherlab-users] DC questions Thank you both for your answers. I would like to get again your help in order to find a little example, focused only on the synchronization part, for the b method introduced by Graeme, because I have already tried something but the application continuosly sends the "Failed to get reference clock time: Input/Output error" error. Thank you again. Best regards, Tommaso ___ etherlab-users mailing list etherlab-users@etherlab.org http://lists.etherlab.org/mailman/listinfo/etherlab-users