Hi,
Here is our DC initialization sequence (Pseudo C++ code)
int64_t_dcActivationTime = getEtherCatMonotonicNanoTime(); //
clock_gettime(CLOCK_MONOTONIC) + Ethercat time offset
ecrt_master_application_time(pMaster, dcActivationTime); // 1st time before
master activation!
// Activate the master, the cycle time is used to calculate the max. amount of
data per cycle
int64_t cycleDuration = 250000; // 4kHz
ecrt_master_set_send_interval(pMaster,cycleDuration/1000);
ecrt_master_activate(pMaster);
// initialize domain data here
// Set realtime context and lock to CPU core.
// DC initialization loop
do
{
ecrt_master_receive(pMaster);
ecrt_master_application_time(pMaster, getEtherCatMonotonicNanoTime());
ecrt_master_sync_reference_clock(pMaster);
ecrt_master_sync_slave_clocks(pMaster);
ecrt_master_send(pMaster);
nanoSleep(cycleDuration -
((getEtherCatMonotonicNanoTime()-dcActivationTime) % cycleDuration)); // sync
master
send times with dc activation time
if (initialCounter > MaxInitialCycles)
{
// error
}
initialCounter++;
}
while ( (allSlavesOperational() == false));
// main loop
Regards
Martin
--
Martin Troxler
Senior Software Engineer R&D
Department E1
Komax AG
Industriestrasse 6
CH - 6036 Dierikon
Note:
This e-mail is for the named person's use only. It may contain confidential
and/or privileged information. If you have received this e-mail in error,
please notify the sender immediately and delete the material from any system.
Any unauthorized copying, disclosure, distribution or other use of this
information by persons or entities other than the intended recipient is
prohibited.
Thank You.
_______________________________________________
etherlab-users mailing list
[email protected]
http://lists.etherlab.org/mailman/listinfo/etherlab-users