Skip to main content

DC synchronization

Slave-level Distributed Clocks (DC) configuration. DC properties are accessed directly through slave.*; DC configuration methods are operated through the DcConfig class.

Prefer the master-level method

In most scenarios, use master.configure_dc() to configure all DC slaves in one call. The slave-level methods are for scenarios where individual slaves need different parameters.

Read-only properties​

CategoryPropertyTypeRead/writeDescription
DC statehas_dcOptional[bool]read-onlyWhether DC is supported (ESC hardware bit): True / False are definite conclusions; returns None (unknown) when the read fails
DC statedc_config.has_esi_dc_syncboolread-onlyWhether the ESI declares DC synchronization for this slave (falls back conservatively to has_dc when the ESI is not bound)
DC statedc_config.esi_dc_sync_modeintread-onlyDC synchronization tier declared by the ESI: 3 = DC-Sync0 + SYNC1; 2 = DC-Sync0 only; 0 = not declared / undeterminable
DC statedc_config.current_dc_sync_modeOptional<DcSyncMode>read-onlyCurrently landed DC synchronization type (FreeRun / SmSynchron are not DC synchronization); returns None when the read fails
dc_activeintread-onlyCurrent landed value of DC AssignActivate. 0 = not enabled; non-0 = DC-active. 0x0980 in 0x0300 is only a common landed value, not the criterion for "SYNC0 activated" — whether it is armed is determined by dc_config.sync0_armed (an underlying tri-state), and whether it is synchronized by dc_config.sync_window.in_sync
DC timedc_cycle0intread-onlyCurrent SYNC0 cycle (nanoseconds)
dc_cycle1intread-onlyCurrent SYNC1 cycle (nanoseconds)
dc_shiftintread-onlyCurrent phase shift (nanoseconds)
propagation_delayintread-onlyPropagation delay of a frame from the master to this slave (nanoseconds)
DC topologydc_next / dc_previousintread-onlyIndex of the next / previous slave in the DC chain
dc_receive_time_a/b/c/dintread-onlyReceive time per port (nanoseconds)
dc_parent_portintread-onlyCompatibility entry point for parent_port: 0..3 = the parent port, -1 = unknown or invalid parameter

DcConfig.dc_sync_mode_from_esi()​

def dc_sync_mode_from_esi(self) -> int

Queries the raw underlying value of the DC synchronization mode declared by the ESI, preserving negative-value semantics:

ValueMeaning
3Declares DC-Sync0 + SYNC1 (AssignActivate contains the SYNC1 enable bit 0x0400, e.g. #x700)
2Declares DC-Sync0 only (AssignActivate is something like #x300, without 0x0400)
1SM-Sync
0The ESI has <Dc> but declares FreeRun only
-1The ESI does not declare <Dc>
-2Invalid parameter / the slave has no bound ESI

Use this method when you need to distinguish "the ESI explicitly does not use DC" from "the ESI is not bound at all"; for outward decisions use esi_dc_sync_mode uniformly.

DcConfig.esi_dc_sync_mode​

@property
def esi_dc_sync_mode(self) -> int

The DC synchronization tier the ESI declares for this slave (the normalized outward value, equivalent to C# Slave.EsiDcSyncMode), used by upper layers to decide "whether SYNC1 can be enabled":

ValueMeaningTypical ESI
3ESI declares DC-Sync0 + SYNC1: AssignActivate contains the SYNC1 enable bit 0x0400 (e.g. #x700)Beckhoff EL7411
2ESI declares DC-Sync0 only: AssignActivate is non-zero but does not contain 0x0400 (e.g. #x300)EL7041 / Ezi-SERVO2
0ESI does not declare DC, or it cannot be determined (ESI not bound / unreadable)EK1100 / EK1110 / EL6022 / GCAN-8200

There is only one rule: DC-Sync01 can be requested only when the value is 3; with 2 only DC-Sync0 is possible. Treating 2 as 3 (forcing SYNC1) makes a slave that declares only Sync0 refuse to enter OP, and it does not necessarily report an AL status code.

ESI-declared value ≠ landed value: dc_config.esi_dc_assign_activate returns the three-state EsiDeclareU16 (DECLARED / NOT_DECLARED / UNREADABLE, never collapsed) carrying the raw 16-bit SYNC0 <Dc><OpMode><AssignActivate> declared in the ESI AssignActivate. It is not the landed value written into the slave's 0x0980 — read dc_active (or dc_config.assign_activate) for that.

Relationship with has_esi_dc_sync: on the four branches 0 / 1 / 2 / 3 both agree (has_esi_dc_sync is esi_dc_sync_mode >= 2); the only difference is that when the underlying layer returns -2 (ESI not bound), has_esi_dc_sync falls back conservatively to has_dc, while esi_dc_sync_mode reports "undeterminable" truthfully as 0. Use the former when you must "not switch DC off by mistake while unbound"; use the latter when you need to know exactly which tier the ESI declared.

Example:

from darra_ethercat.slave.dc import DcSyncMode

slave = master[1]
dc = slave.dc_config
mode = dc.esi_dc_sync_mode

if slave.has_dc and dc.has_esi_dc_sync:
if mode == 3:
dc.configure_mode(DcSyncMode.DcSynchron01, 1_000_000, 1_000_000) # SYNC0 + SYNC1
else:
dc.configure_mode(DcSyncMode.DcSynchron, 1_000_000) # SYNC0 only

DcConfig.has_esi_dc_sync​

@property
def has_esi_dc_sync(self) -> bool # DcConfig property

Whether the ESI file declares DC synchronization for this slave. slave.has_dc reflects only the ESC hardware bit and does not mean the application layer enables DC. Before enabling DC, check slave.has_dc and slave.dc_config.has_esi_dc_sync together; this filters out slaves whose ESC reports capable but whose ESI does not declare a DC OpMode (such as the GCAN-8200) and avoids forcing DCCUC, which makes the slave hang.

When the ESI is not loaded it falls back conservatively to has_dc.

has_dc is tri-state

slave.has_dc returns None (unknown) when the read fails and is never folded into False. if slave.has_dc: treats unknown as "no DC" and skips configuration; when you need to tell them apart, test is True / is False / is None explicitly. DcConfig.has_dc has the same semantics and the same tri-state as Slave.has_dc.

FreeRun is not DC synchronization

DcSyncMode.FreeRun can be queried, but it is the slave's local clock: it is not DC enabled and not synchronized. DC synchronization = SYNC0 (0x1C32/0x1C33 = 2) and armed: whether it is armed is determined by dc_config.sync0_armed (an underlying tri-state; None means undeterminable), and whether it is synchronized by dc_config.sync_window.in_sync. dc_active == 0x0300 is not the criterion — 0x0300 is only a common landed value of 0x0980. in_sync is always False under FreeRun.

Example:

slave = master[1]
if slave.has_dc and slave.dc_config.has_esi_dc_sync:
master.configure_dc(1_000_000)
else:
print(f"从站 {slave.slave_num} 跳过 DC 配置") # Slave {slave.slave_num} skips DC configuration

Configuration methods​

DcConfig.configure()​

def configure(sync0_cycle_ns: int, sync1_cycle_ns: int = 0,
shift_ns: Optional[int] = None) -> bool

Configures slave DC synchronization. All parameter units are nanoseconds (ns).

Parameters:

  • sync0_cycle_ns (int) — SYNC0 cycle (nanoseconds); 0 means disarm SYNC0 (back to FreeRun)
  • sync1_cycle_ns (int) — SYNC1 increment time (nanoseconds); 0 means SYNC0 only
  • shift_ns (Optional[int]) — phase shift (nanoseconds): None = no phase specified, resolved by the SDK in order of precedence (the ESI ShiftTimeSync0 declaration → 70% by default); an integer (including 0 and negative values) = an explicit user phase, sent as-is (0 is the literal 0 phase, with no fallback to 70%)

Returns:

  • bool — whether the parameters were sent (True does not mean the hardware is locked; for the real synchronization state check sync_window_status / in_sync)

Example:

# obtained through the public slave.dc_config accessor
dc = master[1].dc_config
dc.configure(1_000_000) # SYNC0 = 1ms, phase resolved by default
dc.configure(1_000_000, 500_000) # SYNC0 = 1ms, SYNC1 = 500 µs
Default phase and FreeRun
  • Precedence resolution happens only when shift_ns=None: an ESI ShiftTimeSync0 that is not 0 → otherwise the default 70% of 1 cycle, sync0_cycle_ns * 70 // 100 (1 ms → 700 µs).
  • The phase is a phase shift only and does not add software propagation delay compensation; the propagation delay is corrected by the ESC hardware.
  • shift_ns=0 is the literal 0 phase, not "unspecified", and does not fall back to 70%; pass None if you want the default 70%.
  • sync0_cycle_ns=0 disarms SYNC0 (FreeRun), it is not a 0 ns cycle. A slave with PDO writes 0x1C32:01 / 0x1C33:01 back to 0, clearing residue from the previous session (otherwise it may block SafeOp, AL=0x002D); when SM2/SM3 are not mapped the write is deferred until after mapping.
  • On hot-plug recovery the SDK re-arms the DC start point and activates SYNC0 automatically (the start point is based on the newly read slave DC time). The phase keeps the first resolution result (phase only) and does not jump on re-arming; if the reference clock fails a new one is selected immediately.

DcConfig.configure_mode()​

dc.configure_mode(mode: DcSyncMode, sync0_cycle_ns: int = 0,
sync1_cycle_ns: int = 0, shift_ns: Optional[int] = None) -> bool

Configures DC by synchronization mode.

Parameters:

  • mode (DcSyncMode) — DC synchronization mode
  • sync0_cycle_ns (int) — SYNC0 cycle (nanoseconds)
  • sync1_cycle_ns (int) — SYNC1 increment time (nanoseconds, DcSynchron01 mode only)
  • shift_ns (Optional[int]) — phase shift (nanoseconds); None = unspecified (resolved by precedence), an integer (including 0 and negative values) takes effect as-is

Returns:

  • bool — the SYNC0/1 parameters were sent successfully and the SM synchronization type (0x1C32/0x1C33) was configured successfully; returning False for a slave that does not support the synchronization type object dictionary is normal

Related structures:

class DcSyncMode(IntEnum):
FreeRun = 0 # free run (local clock, not DC synchronization)
SmSynchron = 1 # SM event synchronization
DcSynchron = 2 # DC synchronization, SYNC0 signal only
DcSynchron01 = 3 # DC synchronization, SYNC0 + SYNC1 signals
There is only one DcSyncMode in the whole library

DcSyncMode is defined only in darra_ethercat.slave.dc, with four values (FreeRun / SmSynchron / DcSynchron / DcSynchron01); from darra_ethercat import DcSyncMode at the top level gives the same class, and no second copy exists.

Example:

from darra_ethercat.slave.dc import DcSyncMode

dc.configure_mode(DcSyncMode.DcSynchron, 1_000_000) # SYNC0 = 1ms
dc.configure_mode(DcSyncMode.DcSynchron01, 1_000_000, 500_000) # SYNC0 + SYNC1
dc.configure_mode(DcSyncMode.FreeRun) # disable DC

DcConfig.disable()​

dc.disable() -> bool

Disables DC synchronization for this slave (back to FreeRun). True means the disable request was sent.

Slave.set_sync()​

def set_sync(self, sync0_ns: int, sync1_ns: int = 0,
shift_ns: Optional[int] = None)

Sends the DC synchronization parameters directly, slave by slave (slave.set_sync(...)). It sends the same parameter set as DcConfig.configure(); this method returns no result, because the underlying layer only registers the intent to send and does not report success or failure.

Parameters:

  • sync0_ns (int) — SYNC0 cycle (nanoseconds); 0 = disarm SYNC0 (back to FreeRun)
  • sync1_ns (int) — SYNC1 cycle (nanoseconds); 0 = disable SYNC1, default 0
  • shift_ns (Optional[int]) — DC phase (nanoseconds), default None:
    • None = unspecified; the underlying layer resolves it with the pure-phase precedence of the ESI declaration → 70% default, without adding software propagation compensation
    • 0 = literal 0 phase, sent as it is
    • a negative value = an explicit negative phase, sent as it is
    • any value other than None is not overridden by the 70% default
Sending is not the same as being synchronized

The call only means the parameters have been registered. To check whether the hardware is armed and inside the synchronization window, read slave.dc_config.sync0_armed and slave.dc_config.sync_window.in_sync (or slave.sync_window_status).

Example:

slave = master[1]

slave.set_sync(1_000_000) # SYNC0 = 1 ms, phase resolved to the default
slave.set_sync(1_000_000, 500_000, 0) # SYNC0 = 1 ms, SYNC1 = 500 µs, literal 0 phase
slave.set_sync(0) # disarm SYNC0 (back to FreeRun)

Synchronization window diagnostics​

slave.sync_window_status​

@property
def sync_window_status(self) -> Optional[dict]

Gets the detailed status of the slave DC synchronization window. Returns None when DC is not supported or the read fails.

Returns:

  • Optional[dict] — synchronization window status dictionary
{
'diff_ns': int, # current time difference (nanoseconds)
'max_diff_ns': int, # maximum time difference (nanoseconds)
'min_diff_ns': int, # minimum time difference (nanoseconds)
'in_sync': int, # raw underlying synchronization flag (0/1). May report a false positive under FreeRun / unarmed SYNC0; use dc_config.get_sync_window_status() for the real synchronization verdict
'out_of_sync_count': int, # number of times the synchronization window was exceeded
}
Properties

If you only need is_in_sync or sync_time_difference, use slave.diagnostics.dc (returns Optional; None when there is no DC or the read fails). is_in_sync returns True for "reference clock and SYNC0 armed" (0x092C is N/A by definition for the reference clock itself, so the underlying layer no longer synthesizes an in-sync value; it only means the slave can be treated as synchronized, not that convergence was measured).

DcConfig.get_sync_window_status()​

dc.get_sync_window_status() -> Optional[SyncWindowStatus]

Gets the synchronization window status through DcConfig and returns a SyncWindowStatus object. Returns None when the read fails. The returned in_sync already folds in the SYNC0 arming conclusion: it is decided by the underlying tri-state, and when arming is unknown the whole window is unusable (returns None) and is never folded into False. Under FreeRun (known unarmed) it is always False and never reports "synchronized" by mistake.

SyncWindowStatus field definitions

SyncWindowStatus is an ordinary property container class (not a @dataclass); its fields are diff_ns / max_diff_ns / min_diff_ns / in_sync / out_of_sync_count.

slave.reset_sync_stats()​

def reset_sync_stats(self) -> None

Resets the synchronization window statistics of this slave (maximum/minimum time difference, out-of-sync count and so on).

DcConfig.reset_sync_window_stats()​

dc.reset_sync_window_stats() -> None

Resets the synchronization window statistics of this slave from the dc_config side; same effect as slave.reset_sync_stats().

DC diagnostics (per slave)​

A set of read-only properties on slave.dc_config, using the same conventions as the 2-second master-level snapshot. All of them read the local cache and send no bus frames, so they can be read directly on the UI thread or a diagnostics thread. Unknown / not applicable is always None or a reason enum; 0 is never used as a substitute.

Properties​

CategoryPropertyTypeRead/writeDescription
DC diagnosticscapabilityDcCapabilityread-onlyCapability tier: Unknown / None_ / FreeRunOnly / Sync0 / Sync0AndSync1. Unknown = the slave snapshot is unreadable / the ESI is not bound / not declared, not "no capability"
DC diagnosticsassign_activateOptional[int]read-only0x0980 landed value (a cache mirror already proven by write-then-read-back in the underlying layer). None = no DC capability / unreadable; 0 = DC capable but not currently active (FreeRun)
DC diagnosticssync0_cycle_nsOptional[int]read-only0x09A0 landed value. None = no DC / unreadable; 0 = no cycle landed in the underlying layer (unarmed / FreeRun), not a "0 ns cycle"
DC diagnosticssync1_cycle_nsOptional[int]read-only0x09A4 landed value, same semantics as sync0_cycle_ns
DC diagnosticspropagation_delay_nsOptional[int]read-only0x0928 landed value (nanoseconds). None = no DC / unreadable / the underlying value is negative
DC diagnosticspropagation_delay_sourceDcPropagationDelayOriginread-onlySource tier: Unknown / ZeroNsAmbiguous (0 ns is ambiguous: domain root or not measured) / NonZeroLandedBaseline
DC diagnosticssync_windowDcSyncWindowInforead-onlyPer-slave synchronization window (the 0x092C measured surface plus the applicability envelope), see below
DC diagnosticssync0_armedOptional[bool]read-onlyWhether SYNC0 is armed: True = the slave has committed to producing SYNC0; False = unarmed with evidence; None = the underlying layer cannot answer, must not be folded into False
DC diagnosticsis_reference_clock_selfOptional[bool]read-onlyWhether this slave is the reference clock (tri-state: True yes / False known not / None the slave index could not be read)
DC diagnosticsmaster.dc_diagnostics snapshot find(index).convergence_msOptional[int]read-onlyConvergence time (ms): from the first "armed but not yet in window" to the first entry into the window, at the 2-second sampling granularity; None when no complete transition was observed. The per-slave DcConfig property surface does not provide that historical conclusion
DC diagnosticsmaster.dc_diagnostics snapshot find(index).jitterOptional[DcJitterStats]read-onlySteady-state jitter (σ / peak-to-peak / maximum adjacent change), 2-second sampling surface; None when there are fewer than 2 samples

sync0_armed only means "this slave has committed to producing SYNC0"; it does not mean the whole network clock has converged — for convergence check sync_window.in_sync / applicable.

DcSyncWindowInfo​

CategoryFieldTypeRead/writeDescription
DC diagnosticsapplicableboolread-onlyTrue = this slave participates in SYNC0 and a measurement was read; False = check not_applicable_reason
DC diagnosticsnot_applicable_reasonDcSyncWindowNaReasonread-onlyEnumeration of the not-applicable reason; None_ when applicable
DC diagnosticsdiff_nsOptional[int]read-onlyCurrent synchronization error (ns); None when not applicable
DC diagnosticsmax_diff_nsOptional[int]read-onlyMaximum time difference within the window (ns); None when not applicable
DC diagnosticsmin_diff_nsOptional[int]read-onlyMinimum time difference within the window (ns); None when not applicable
DC diagnosticsout_of_sync_countOptional[int]read-onlyTotal number of times the synchronization window was exceeded; None when not applicable
DC diagnosticsin_syncOptional[bool]read-onlyWhether this sample is inside the synchronization window (measured ∧ SYNC0 armed); None when not applicable
DC diagnosticssync_window_threshold_nsOptional[int]read-onlySynchronization window threshold (ns); None = unreadable (distinct from "threshold 0")
DC diagnosticsreading_unchangedOptional[bool]read-onlyWhether the four 0x092C readings have stayed completely unchanged across several consecutive samples (freeze proxy bit); None = not enough samples to conclude. It is always None when this property is read directly (the property carries no history)
DC diagnosticsunchanged_streakintread-onlyNumber of consecutive samples with identical readings (the same count as reading_unchanged); 0 when this property is read directly
DC diagnosticssampled_at_utcOptional[datetime]read-onlySampling time of this sample (UTC); None when not applicable

When applicable=False, the measured numeric fields (diff_ns / max_diff_ns / min_diff_ns / out_of_sync_count / in_sync) and reading_unchanged are always None, never 0; unchanged_streak is a count and is 0 in that case.

Convergence time and steady-state jitter are not on the per-slave property surface: they need consecutive samples and are provided only by the master 2-second sampling surface — read the per-slave snapshot of master.dc_diagnostics (convergence_ms / jitter).

Seven states (decidable synchronization window states)​

CategoryStatePython expressionRead/writeMeaning
DC diagnosticsNo capabilityapplicable is False, reason DcSyncWindowNaReason.NoDcCapabilityread-onlyThere is no SYNC0 cycle unit, so a synchronization error does not exist
DC diagnosticsUnarmedapplicable is False, reason Sync0NotArmedread-onlyKnown not to participate in DC synchronization, so the window is undefined
DC diagnosticsReference clock itselfapplicable is False, reason ReferenceClockItselfread-onlyA synchronization error does not exist by definition
DC diagnosticsArmed but readings frozenapplicable is True and reading_unchanged is Trueread-onlyThe four window readings have stayed completely unchanged across several consecutive samples (freeze proxy bit); the conclusion comes from the 2-second sampling surface
DC diagnosticsTruly in windowapplicable is True and in_sync is Trueread-onlyArmed and measured inside the synchronization window
DC diagnosticsArming unknownapplicable is False, reason ArmedUnknownread-onlyThe underlying layer cannot answer, so participation cannot be asserted either way
DC diagnosticsNever sampledapplicable is False, reason NotSampledread-onlyAll four items are 0 and it is not in the window; 0 is not "perfect synchronization"

Determination order: slave snapshot unreadable → no capability → reference clock slave index unreadable → this slave is the reference clock → arming unknown → known unarmed → window read failed → never sampled → measured. When the window is usable (applicable=True), reading_unchanged is True reports "readings frozen" first; otherwise the in_sync value splits "truly in window / armed but out of window".

Read-failure family (not part of the seven states):

CategoryReasonMeaningRead/write
DC diagnosticsSlaveReadFailedThe slave snapshot is unreadable, so even the capability cannot be determinedread-only
DC diagnosticsReferenceClockUnknownThe reference clock slave index is unreadable, so it cannot be decided whether this slave is the time baseread-only
DC diagnosticsWindowReadFailedArmed and not the reference clock, but reading the window measurement failedread-only

Armed but out of window: applicable is True, in_sync is False (and not frozen). It does not belong to any of the seven states and must be handled as the real conclusion in_sync=False; do not treat it as "unarmed" or "unknown".

Three honest tri-states​

CategoryConclusionWhen there is no conclusionPython expressionRead/write
DC diagnosticsWhether all are in windowNo confirmed participant → unknown, not Truemaster.dc_diagnostics.all_in_sync is Noneread-only
DC diagnosticsMaximum synchronization differenceNo usable window → unknown, not 0master.dc_diagnostics.max_drift_ns is Noneread-only
DC diagnosticsSYNC0 armingThe underlying layer cannot answer → unknown, not Falsedc_config.sync0_armed is Noneread-only

"Not applicable" is never written as 0: the synchronization window of the reference clock itself is always N/A; unarmed / no DC / never sampled likewise never produce 0 ns.

Example:

slave = master[1]
dc = slave.dc_config

print("能力档:", dc.capability.name) # Capability tier:
print("已武装:", dc.sync0_armed) # True / False / None (undeterminable)

w = dc.sync_window
if not w.applicable:
print("窗口不适用:", w.not_applicable_reason.name) # Window not applicable:
else:
print(f"同步差 {w.diff_ns} ns, 阈值 {w.sync_window_threshold_ns} ns, " # Sync deviation {w.diff_ns} ns, threshold {w.sync_window_threshold_ns} ns,
f"在窗 {w.in_sync}") # In window {w.in_sync}

SYNC0 relative cycle jitter (per slave)​

Distribution of the phase offset of SYNC0 pulses relative to the cycle start; servo commissioning uses it to judge how much SYNC0 jitters relative to the cycle. The offset range is [−cycle/2, +cycle/2): in steady state it is nearly constant (the geometric phase determined by the shift passed to configure), and jitter amplitude = sync0_jitter_max_ns − sync0_jitter_min_ns. The window accumulates from the last reset_sync0_jitter_stats() (it is invalidated automatically when the session changes and reopens automatically at the limit); with no samples everything is None, never 0 as a substitute. Samples accumulate per cycle while OP is running; the pre-OP / recovery phases are not mixed in. Each of the four properties is read once, so values across properties may come from different samples.

CategoryPropertyTypeRead/writeDescription
DC diagnosticsdc_config.sync0_jitter_min_nsOptional<int>read-onlyMinimum phase offset within the window (ns)
DC diagnosticsdc_config.sync0_jitter_max_nsOptional<int>read-onlyMaximum phase offset within the window (ns)
DC diagnosticsdc_config.sync0_jitter_avg_nsOptional<int>read-onlyAverage phase offset within the window (integer ns, truncated toward zero)
DC diagnosticsdc_config.sync0_jitter_sample_countOptional<int>read-onlyNumber of samples accumulated in the window (the three values above are valid when > 0)
StatisticsDcConfig.reset_sync0_jitter_stats()Nonewrite-onlyClears the statistics of this slave; the next sample opens a new window
if (dc.sync0_jitter_sample_count or 0) > 0:
lo, hi = dc.sync0_jitter_min_ns, dc.sync0_jitter_max_ns
print(f"SYNC0 相位偏移 {lo}..{hi} ns,抖动 {hi - lo} ns") # SYNC0 phase offset {lo}..{hi} ns, jitter {hi - lo} ns
dc.reset_sync0_jitter_stats()

Complete example​

slave = master[1]  # 1-based index

if slave.has_dc:
dc = slave.dc_config # public accessor
dc.configure(1_000_000) # SYNC0 = 1ms

print(f"DCActive={slave.dc_active}, DCCycle0={slave.dc_cycle0}ns, DCShift={slave.dc_shift}ns")

# detailed synchronization window status
status = slave.sync_window_status
if status is not None:
print(f"同步差={status['diff_ns']}ns, 同步={status['in_sync']}") # Sync deviation={status['diff_ns']}ns, in sync={status['in_sync']}

dc.disable()

Failures and handling​

SymptomCauseHandling
in_sync is FalseThe DC mode declared by the ESI does not match the configuration, the reference clock is not armed, or SYNC0 does not match the PDO cycleCheck the DC mode in the ESI and the reference clock; set SYNC0 to the cycle or an integer fraction of it
get_sync_window_status returns NoneThe SYNC0 arming conclusion is unknown (the underlying layer returns -1/-2), or the window read failedTreat it as unknown, not as synchronized; confirm has_dc / sync0_armed and re-read
sync0_jitter_min_ns / max_ns / avg_ns / sample_count is NoneNo DC, no samples yet, or the read failedTreat it as unknown; samples accumulate while OP is running, so read again after entering OP
configure_mode returns FalseThis slave does not support DC, or the ESI does not declare that DC modeSkip this slave and let it run free; check the hardware of that slave and the ESI declaration
A synchronization-loss callback is receivedThe deviation of this slave exceeds the synchronization window thresholdRecord the slave index and deviation and check the DC mode and cycle of that slave
Readings do not return to zero after reset_sync_statsThe statistics were cleared but the window is still samplingRe-read the window status and use the new sample as authoritative