DC synchronization
Slave-level DC (distributed clock) configuration. All DC properties and methods are accessed directly through slave.*.
In most scenarios, use master.ConfigureDC() to configure all DC slaves in one call.
Slave-level methods are for scenarios where individual slaves need different parameters. When no phase is specified, both resolve it with the same precedence.
Read-only properties
| Category | Property | Type | Read/write | Description |
|---|---|---|---|---|
| DC state | HasDC | bool | Read-only | Whether the ESC hardware supports DC |
| HasEsiDcSync | bool | Read-only | Whether the ESI declares DC synchronization for this slave (OpMode/AssignActivate non-zero) | |
| EsiDcSyncMode | int | Read-only | DC synchronization capability tier declared by the ESI; yields only 0 / 2 / 3: 3 = DC-Sync0 + SYNC1; 2 = DC-Sync0 only; 0 = no DC synchronization capability declared (includes FreeRun / SM-Sync / unbound / undeterminable). For raw values (including 1 = SM-Sync, -1 / -2) see EsiDcSyncModeRaw | |
| EsiDcSyncModeRaw | int | Read-only | Raw ESI tier value: -2 = unbound / wrong parameter, -1 = ESI has no Dc node, 0 = FreeRun, 1 = SM-Sync, 2 = DC-Sync0, 3 = DC-Sync0 + SYNC1. Use this property to judge the capability tier; negative values are not folded | |
| DCActive | ushort | Read-only | Read-back value of 0x0980 AssignActivate. 0 = DC capable but not currently active (FreeRun); 0x0300 is only a common landed value, not the criterion for "armed". Whether the slave is armed is determined solely by Sync0Armed | |
| DC time | DCCycle0 | int | Read-only | Current SYNC0 cycle (ns) |
| DCCycle1 | int | Read-only | Current SYNC1 cycle (ns) | |
| DCShift | int | Read-only | Current phase shift (ns); phase only | |
| PropagationDelay | int | Read-only | Propagation delay of a frame from the master to this slave (ns), the measured 0x0928 value | |
| DC topology | DCNext / DCPrevious | ushort | Read-only | Index of the next / previous slave in the DC chain |
| DCParentPort | int | Read-only | Compatibility entry for ParentPort: 0..3 = parent port, -1 = unknown or invalid parameter | |
| DCReceiveTimeA/B/C/D | int | Read-only | Receive time per port (ns) |
HasDC reflects only the ESC hardware bit and does not mean the application layer uses DC. Some slaves report DC capable in the ESC, but their ESI does not declare a DC OpMode; in that case run FreeRun / SM-Sync, because forcing DC makes the slave refuse to enter OP.
DcSyncMode.FreeRun can be queried, but it is the slave's local clock: it is not DC enabled and not synchronized. For the protocol mode check 0x1C32/0x1C33 = 2; whether the slave is armed is determined solely by Sync0Armed; for convergence check InSync / Applicable on the sync window. 0x0300 in 0x0980 is only a common landed value and cannot serve as the "armed" criterion. InSync is always false under FreeRun.
A safe pattern before enabling DC:
if (slave.HasDC && slave.HasEsiDcSync)
{
slave.ConfigureDC(1_000_000);
}
:::
DC synchronization types declared by the ESI
HasDC answers only "does the ESC hardware support DC"; EsiDcSyncMode answers "which DC synchronization tier the vendor requires for this slave in the ESI". The tier decides whether SYNC1 can be enabled:
| Value | Meaning | Typical ESI |
|---|---|---|
3 | ESI declares DC-Sync0 + SYNC1: AssignActivate contains the SYNC1 enable bit 0x0400 (e.g. #x700) | Beckhoff EL7411 |
2 | ESI declares DC-Sync0 only: AssignActivate is non-zero but does not contain 0x0400 (e.g. #x300) | EL7041 / Ezi-SERVO2 |
0 | No DC synchronization capability declared: covers ESI explicitly FreeRun / SM-Sync, ESI without <Dc>, unbound / undeterminable | 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: slave.EsiDcAssignActivate returns the raw 16-bit SYNC0 AssignActivate declared in the ESI <Dc><OpMode><AssignActivate> (null = not declared in the ESI / ESI not bound / unreadable). It is not the landed value written into the slave's 0x0980 — read DCActive for that.
EsiDcSyncMode yields only 0 / 2 / 3 (consistent with the other five languages): raw values 1 (SM-Sync) and 0 (FreeRun) both collapse to 0; -1 (ESI without <Dc>) / -2 (unbound or wrong parameter) likewise become 0. To distinguish "explicit SM-Sync", "not declared" and "unbound", read EsiDcSyncModeRaw:
| Category | EsiDcSyncModeRaw | Read/write | Meaning |
|---|---|---|---|
| DC diagnostics | 3 | Read-only | DC-Sync0 + SYNC1 |
| DC diagnostics | 2 | Read-only | DC-Sync0 only |
| DC diagnostics | 1 | Read-only | SM-Sync |
| DC diagnostics | 0 | Read-only | FreeRun |
| DC diagnostics | -1 | Read-only | ESI has no <Dc>, not declared |
| DC diagnostics | -2 | Read-only | Slave has no bound ESI / wrong parameter / read failed (undeterminable) |
Always use EsiDcSyncModeRaw to judge the capability tier (whether SYNC0 / SYNC1 is possible); do not treat -1 / -2 as "explicitly no DC".
Relationship with HasEsiDcSync: on the C# side both share one judgement (HasEsiDcSync is EsiDcSyncMode >= 2), so they never contradict each other; the difference is that EsiDcSyncMode can also distinguish "SYNC0 only" from "SYNC0 + SYNC1 possible". EsiDcSyncMode prefers the SDK return value; only when the SDK returns a negative number (ESI not declared / unbound) does it fall back to parsing the local ESI XML, and if it is still undeterminable it reports 0 truthfully. The capability tier on the DC diagnostics surface, DcCapability, does not take this fallback: it reads only the raw SDK value (EsiDcSyncModeRaw), so "not declared" is never folded into "FreeRun only".
The ESI must first be imported and bound to the slave (binding happens automatically during Build()). While unbound, a reading means only "undeterminable" and must not be taken as proof that the slave does not support DC.
A safe pattern before enabling DC:
var slave = master.Slaves[0];
if (slave.HasDC && slave.HasEsiDcSync)
{
if (slave.EsiDcSyncMode == 3)
slave.ConfigureDC(DcSyncMode.DcSynchron01, 1_000_000, 1_000_000); // SYNC0 + SYNC1
else
slave.ConfigureDC(DcSyncMode.DcSynchron, 1_000_000); // SYNC0 only
}
Configuration methods
Slave.ConfigureDC(uint sync0CycleNs, uint sync1CycleNs = 0, int? shiftNs = null)
public bool ConfigureDC(uint sync0CycleNs, uint sync1CycleNs = 0, int? shiftNs = null)
Slave-level overload: configures DC synchronization for a single slave in one call, for scenarios where individual slaves need different SYNC0 / shift values. All parameter units are nanoseconds (ns). For bulk configuration use master.ConfigureDC.
If the slave does not support DC (HasDC == false) the method returns false immediately without writing anything.
Parameters:
sync0CycleNs(uint) — SYNC0 cycle (ns); 0 removes the SYNC0 arming (back to FreeRun)sync1CycleNs(uint) — SYNC1 increment time (ns); 0 means SYNC0 onlyshiftNs(int?) — phase shift (ns):null= phase not specified, resolved by precedence ESI explicit > user explicit > default 70%;0and negative values are explicit user phase and take effect as given (0is the literal 0 phase and does not fall back to 70%). Omit the parameter to get the default 70%
The phase is only a phase shift; propagation delay is corrected by the ESC in hardware per
0x0928, with no software compensation added.
Return value:
bool—trueon success;falseif the slave does not support DC or the write fails
Example:
if (slave.ConfigureDC(1_000_000)) // SYNC0 = 1ms, phase resolved by default precedence
Console.WriteLine("DC 配置成功"); // DC configuration succeeded
slave.ConfigureDC(1_000_000, shiftNs: 0); // SYNC0 = 1ms, phase 0 ns (omit shiftNs for the default 70%)
ConfigureDC(DcSyncMode mode, uint sync0CycleNs = 0, uint sync1CycleNs = 0, int? shiftNs = null)
public bool ConfigureDC(DcSyncMode mode, uint sync0CycleNs = 0, uint sync1CycleNs = 0, int? shiftNs = null)
Configures DC according to the synchronization mode (ETG.1020). The SM synchronization type is configured automatically. For bulk configuration use master.ConfigureDC(DcSyncMode, ...).
Parameters:
mode(DcSyncMode) — DC synchronization modesync0CycleNs(uint) — SYNC0 cycle (ns), used only in DcSynchron / DcSynchron01 modessync1CycleNs(uint) — SYNC1 cycle (ns), used only in DcSynchron01 modeshiftNs(int?) — phase shift (ns), used only in DC modes;null= phase not specified (resolved by precedence),0and negative values = explicit user phase and take effect as given (0is the literal 0 phase and does not fall back to 70%)
Return value:
bool—trueon success;falseif the slave does not support DC or the write fails
Related structures:
public enum DcSyncMode
{
FreeRun = 0, // Free run (local clock, not DC synchronization)
SmSynchron = 1, // SM synchronization - triggered by SM events
DcSynchron = 2, // DC synchronization - SYNC0 signal only
DcSynchron01 = 3 // DC synchronization - SYNC0 + SYNC1 signals
}
Example:
slave.ConfigureDC(DcSyncMode.DcSynchron, 1_000_000); // DC SYNC0 = 1ms
slave.ConfigureDC(DcSyncMode.SmSynchron); // SM synchronization mode
slave.ConfigureDC(DcSyncMode.FreeRun); // free run
CurrentDcSyncMode
public DcSyncMode CurrentDcSyncMode { get; }
Gets the current synchronization mode. FreeRun / SmSynchron can be queried but are not DC synchronization. DC synchronization is only DcSynchron / DcSynchron01 and requires 0x1C32/0x1C33 = 2; whether the slave is armed is determined solely by Sync0Armed, and 0x0300 in 0x0980 is only a common landed value.
Example:
var mode = slave.CurrentDcSyncMode;
Console.WriteLine($"当前 DC 同步模式: {mode}"); // Current DC sync mode: {mode}
DisableDC()
public void DisableDC()
Disables DC synchronization for this slave.
Sync window diagnostics
GetSyncWindowStatus()
public SyncWindowStatus? GetSyncWindowStatus()
Gets the detailed state of the slave's DC sync window. Returns null when DC is unsupported or the read fails.
Return value:
SyncWindowStatus?— sync window status
Related structures:
public struct SyncWindowStatus
{
public int DiffNs; // current difference (ns)
public int MaxDiffNs; // maximum difference (ns)
public int MinDiffNs; // minimum difference (ns)
public bool InSync; // whether inside the DC SYNC0 sync window. Always false under FreeRun; never treat it as synchronized
public uint OutOfSyncCount; // number of times outside the sync window
}
If only the synchronization state (slave.Diagnostics.DC.IsInSync) or the time difference (SyncTimeDifference) is needed, access it through slave.Diagnostics.DC. GetSyncWindowStatus() suits scenarios that need the full statistics.
SyncWindow
public SyncWindowStatus? SyncWindow { get; }
Property entry point for the per-slave sync window, backed by the same implementation as GetSyncWindowStatus() (data acquisition goes through properties uniformly). null = no DC / window read failed / the SYNC0 arming conclusion is unknown (same rule as the older method).
The InSync it returns is the AND of two dimensions, "configuration armed" and "measured inside the window": it is always false when unarmed, and it never reports "in window" just because the difference happens to be 0. For a full domain determination (including the "not applicable" reason), use DcSyncWindow.
Return value:
SyncWindowStatus?— sync window status;nullmeans undeterminable
Example:
var w = slave.SyncWindow;
if (w is null)
Console.WriteLine("同步窗口不可判定(无 DC / 读失败 / 武装未知)"); // Sync window cannot be determined (no DC / read failed / arm state unknown)
else
Console.WriteLine($"同步差={w.Value.DiffNs}ns 在窗={w.Value.InSync} 超窗次数={w.Value.OutOfSyncCount}"); // Sync diff={w.Value.DiffNs}ns in window={w.Value.InSync} out-of-window count={w.Value.OutOfSyncCount}
Master-level maximum sync difference (int? tri-state)
master.GetMaxSyncDifference() returns int?; the three meanings must be kept apart:
| Category | Value | Read/write | Meaning |
|---|---|---|---|
| DC diagnostics | null | Read-only | Read failed / unavailable: the master is closed, not initialized, the SDK read failed, or the slave table could not be read completely enough to decide |
| DC diagnostics | -1 | Read-only | Confirmed: no DC-active slave on the network (this is a conclusion, not an error) |
| DC diagnostics | >= 0 | Read-only | Measured maximum absolute sync difference (ns); 0 is a real measured 0, not "no DC" |
Equivalent entry points: the property master.MaxSyncDifferenceNs has the same semantics; the legacy-signature master.GetMaxSyncDifferenceLegacy() returns int and folds null into -1 — under that signature a read failure and no DC-active slave are indistinguishable, so do not use it in new code.
-1 means only "no DC-active slave". When the master is closed, not initialized or the slave table cannot be read completely, the return value is null, not -1; do not merge the two into one alarm.
ResetSyncWindowStats()
public void ResetSyncWindowStats()
Resets this slave's sync window statistics (maximum/minimum difference, number of times outside sync, and so on).
SYNC0 phase jitter statistics
This group of properties treats the phase difference of this slave's SYNC0 relative to the cycle anchor as a quantity that can be measured statistically: the value is a phase difference (ns, in the range −SYNC0 cycle/2 to +SYNC0 cycle/2) and should approach a constant in steady state (the geometric phase determined by the phase configuration); jitter = Sync0JitterMaxNs − Sync0JitterMinNs. The four properties share a single read (reading any one of them fetches the whole four-value set).
| Category | Property | Type | Read/write | Description |
|---|---|---|---|---|
| DC jitter | Sync0JitterMinNs | int? | Read-only | Minimum phase difference in this window (ns); null = no DC / no samples yet / read failed |
| Sync0JitterMaxNs | int? | Read-only | Maximum phase difference in this window (ns); the difference from the minimum is the jitter amplitude | |
| Sync0JitterAvgNs | int? | Read-only | Mean phase difference in this window (integer ns, truncated toward zero) | |
| Sync0JitterSampleCount | uint? | Read-only | Number of samples accumulated in this window; null = unreadable, 0 = no samples yet (the three values above are also null in that case) |
The window accumulates from the last reset or from the start of a new session, and opens a new window automatically when it reaches the limit. null always means "no samples / unknown" and is not folded into 0; a steady phase does not mean "zero jitter" — to judge jitter, look at the maximum minus the minimum. Jitter describes only this slave's phase distribution and does not answer "is the whole network synchronized" — for convergence, check Applicable / InSync on DcSyncWindow.
ResetSync0JitterStats()
public void ResetSync0JitterStats()
Resets this slave's SYNC0 phase distribution statistics; the next sample opens a new window. After changing the phase / SYNC0 cycle, call it first and then observe the new steady state, so that extremes from the old window do not contaminate the conclusion.
Example:
slave.ResetSync0JitterStats();
// Wait several cycles and then read the jitter
if (slave.Sync0JitterMinNs is int min && slave.Sync0JitterMaxNs is int max)
Console.WriteLine($"SYNC0 抖动 = {max - min} ns(样本 {slave.Sync0JitterSampleCount})"); // SYNC0 jitter = {max - min} ns (samples {slave.Sync0JitterSampleCount})
else
Console.WriteLine("尚无样本或读取失败,不要当成抖动为 0"); // No samples yet or the read failed, do not treat jitter as 0
DC diagnostics (per slave)
All members below are read-only: reading returns the current diagnostic result without producing any bus frame, so they can be read directly from the UI thread or a diagnostics thread. Frozen readings, jitter and convergence are historical conclusions that need continuous sampling; they accumulate from the master's diagnostic sampling roughly once every 2 seconds. Reading an individual slave property directly does not include historical conclusions.
| Member | Type | Category | Read/write | Unavailable representation | Description |
|---|---|---|---|---|---|
DcCapability | DcCapability | DC diagnostics | Read-only | Unknown (not "no capability") | Capability tier = ESC capability bit + highest tier declared by the ESI. Answers "can it do SYNC0", not "is it armed right now" |
DcArmOutcome | DcArmResult | DC diagnostics | Read-only | Unknown = no final-state record | Final conclusion of the automatic DC arming policy; Unknown does not mean unarmed, nor does it mean failure |
DcAssignActivate | ushort? | DC diagnostics | Read-only | null = no DC capability / snapshot unavailable | 0x0980 read-back value (write-then-read-back is proven by the SDK). 0 = DC capable but not currently active (FreeRun), not "unreadable" |
DcSync0CycleNs | int? | DC diagnostics | Read-only | null as above | 0x09A0 read-back value; 0 = the SDK has not written a cycle yet (unarmed / FreeRun), not a "0 ns cycle". Difference from DCCycle0: that property falls back to the ESI-declared cycle when the SDK value is 0, while this one reports the read-back value only |
DcSync1CycleNs | int? | DC diagnostics | Read-only | null as above | 0x09A4 read-back value, same semantics as DcSync0CycleNs |
DcPropagationDelayNs | int? | DC diagnostics | Read-only | null = no DC / unreadable / negative read-back | 0x0928 landed propagation delay (ns) |
DcPropagationDelaySource | DcPropagationDelayOrigin | DC diagnostics | Read-only | Unknown | Origin tier: ZeroNsAmbiguous (0 ns may be the domain root or may be unmeasured; the SDK provides no way to tell) / NonZeroLandedBaseline (a landed baseline exists; whether it was measured this time or reused within the session is likewise indistinguishable) |
DcSyncWindow | DcSyncWindowInfo | DC diagnostics | Read-only | Applicable = false + reason enum | Sync window (including its domain). When read directly, ReadingUnchanged = null, UnchangedStreak = 0 (no history) and SampledAtUtc = the instant of this read (UTC) |
DcConvergenceMs | int? | DC diagnostics | Read-only | null = no complete transition observed | First sighting of "armed but not yet in window" → first time in window; 2-second sampling granularity |
DcJitter | DcJitterStats? | DC diagnostics | Read-only | null = fewer than 2 samples / not a participant | Mean, σ, peak-to-peak, largest adjacent change and average sampling interval of the 2-second sampling surface |
Sync0Armed | bool? | DC diagnostics | Read-only | null = undeterminable | true = armed; false = unarmed with evidence (including slaves without DC capability); null must not be folded into false. Armed means only that this slave commits to generating SYNC0; it does not mean the whole network clock has converged |
Sync1Armed | bool? | DC diagnostics | Read-only | null = undeterminable | true = armed (this slave commits to generating SYNC1); false = unarmed with evidence (including slaves without DC capability); null must not be folded into false. SYNC1 is meaningful only when SYNC0 is armed, so check Sync0Armed before judging SYNC1 |
DcSyncWindowInfo is a domain wrapper: when Applicable = false every numeric field is null (not 0), so "unarmed / reference clock itself / unreadable" and "a measured 0 ns" remain distinguishable.
| Member | Type | Category | Read/write | Description |
|---|---|---|---|---|
Applicable | bool | DC diagnostics | Read-only | true = this slave is a SYNC0 participant and a measurement was read; when false, see NotApplicableReason |
NotApplicableReason | DcSyncWindowNaReason | DC diagnostics | Read-only | Reason for being unavailable; None when applicable |
DiffNs | int? | DC diagnostics | Read-only | Current sync difference (ns) |
MaxDiffNs / MinDiffNs | int? | DC diagnostics | Read-only | Maximum / minimum difference within the window (ns) |
OutOfSyncCount | uint? | DC diagnostics | Read-only | Cumulative number of times outside the sync window |
InSync | bool? | DC diagnostics | Read-only | Whether this sample is inside the sync window |
SyncWindowThresholdNs | int? | DC diagnostics | Read-only | Sync window threshold (ns); null = unreadable |
ReadingUnchanged | bool? | DC diagnostics | Read-only | Whether the four 0x092C readings stayed completely unchanged across several consecutive samples (used to detect a frozen reading); null = not enough samples. false does not mean "confirmed to be advancing" |
UnchangedStreak | int | DC diagnostics | Read-only | Number of consecutive samples with identical readings |
SampledAtUtc | DateTime? | DC diagnostics | Read-only | Sampling instant of this sample (UTC) |
Seven states
The seven states describe only "determinable sync window states". The read-failure family and "armed but outside the window" are not among them.
| State | Category | Read/write | Determination (C# field) | Meaning |
|---|---|---|---|---|
| No capability | DC diagnostics | Read-only | HasDC == false → DcSyncWindow.Applicable = false, reason NoDcCapability | No SYNC0 cycle unit, so synchronization error does not exist |
| Unarmed | DC diagnostics | Read-only | Sync0Armed == false → reason Sync0NotArmed | Known not to participate in DC synchronization; 0x092C is undefined |
| Reference clock itself | DC diagnostics | Read-only | ReferenceClockSlaveIndex == SlaveNum → reason ReferenceClockItself | Synchronization error does not exist by definition; the window is always N/A |
| Armed but reading frozen | DC diagnostics | Read-only | Applicable == true and ReadingUnchanged == true | The four 0x092C readings stayed completely unchanged across several consecutive samples (used to detect a frozen reading) |
| Actually in window | DC diagnostics | Read-only | Applicable == true and InSync == true | Armed and measured inside the sync window |
| Arming unknown | DC diagnostics | Read-only | Sync0Armed == null → reason ArmedUnknown | Undeterminable; cannot assert participation or non-participation |
| Never sampled | DC diagnostics | Read-only | Applicable == false and reason NotSampled | All four values are 0 and not in window; 0 is not "perfect synchronization", nor does it mean the statistics were reset |
Determination order (first match wins): 1. slave snapshot unreadable → SlaveReadFailed; 2. no DC capability → NoDcCapability; 3. reference clock slave index unreadable → ReferenceClockUnknown; 4. this slave is the reference clock → ReferenceClockItself; 5. arming unknown → ArmedUnknown; 6. known unarmed → Sync0NotArmed; 7. window read failed → WindowReadFailed; 8. all 0 and not in window → NotSampled; 9. otherwise → measured (Applicable = true).
Read-failure family (not among the seven states; Applicable = false, but the reason is still readable):
| Reason | Category | Read/write | Meaning |
|---|---|---|---|
SlaveReadFailed | DC diagnostics | Read-only | The slave snapshot cannot be read, so even the capability cannot be determined |
ReferenceClockUnknown | DC diagnostics | Read-only | The reference clock slave index cannot be read, so it cannot be determined whether this slave is the time base |
WindowReadFailed | DC diagnostics | Read-only | Armed and not the reference clock, but reading the measured window failed (SDK read failed / bus configuration was updated) |
Armed but outside the window (Applicable = true, InSync = false, not frozen) is none of the seven states. In that case read Applicable and InSync directly and treat it as "armed but not converged"; do not treat it as "unarmed" or "unknown".
Three honest tri-states
| Conclusion | When undetermined | Category | Read/write | C# representation |
|---|---|---|---|---|
All in window (AllInSync) | no confirmed participant → unknown, not true | DC diagnostics | Read-only | bool? = null |
Maximum sync difference (MaxDriftNs) | no usable window at all → unknown, not 0 | DC diagnostics | Read-only | int? = null |
SYNC0 arming (Sync0Armed) | undeterminable → unknown, not false | DC diagnostics | Read-only | bool? = null |
Additional rules:
- "Not applicable" is never written as
0. The reference clock's own sync window is always N/A; unarmed / no DC / never sampled likewise never produce 0 ns. AllInSync:true/falseis possible only when at least one confirmed participant exists ("armed + not the reference clock"); if participants exist but were not sampled, cannot be read or are not in window →false; if any DC slave's arming is unknown → conservativelyfalse.MaxDriftNs: counts only windows that actually have a measurement; if there is none →null.- The legacy summary surface
master.Diagnostics.DcAllInSync(bool,falsewhen undetermined, paired withDcAllInSyncKnown) andmaster.Diagnostics.DcMaxDriftNs(int, returns the sentinel-1when there is no measurement, paired withDcMaxDriftNsKnown) is a degraded surface kept for legacy consumers and must not be used as a tri-state; for tri-state semantics read themaster.DcDiagnosticssnapshot.
Boundaries of DcArmOutcome
C# is the only one of the six SDKs with a real arming final state: the final-state decision and accounting are done by the SDK's automatic start policy, and the public enum only reflects them read-only.
| Value | Name | Category | Read/write | Meaning |
|---|---|---|---|---|
| 0 | Unknown | DC diagnostics | Read-only | No final-state record at all (automatic start has not run yet / the slave did not participate); it means neither unarmed nor failure |
| 1 | Armed | DC diagnostics | Read-only | The write is proven (0x0980 read-back) and the runtime state has Sync0Armed == true |
| 2 | ArmFailedRolledBack | DC diagnostics | Read-only | The attempted arming failed or the runtime state was not confirmed; this slave was rolled back to FreeRun (other slaves are unaffected) |
| 3 | HardwareNoSync0Unit | DC diagnostics | Read-only | The ESC capability bit is false; arming was not attempted |
| 4 | NotCapable | DC diagnostics | Read-only | The ESI declares only non-SYNC0 modes; arming is not attempted |
| 5 | FreeRunByUserIntent | DC diagnostics | Read-only | The user explicitly chose FreeRun / SM synchronization; the automatic policy does not override it |
| 6 | DeferredUntilAfterMap | DC diagnostics | Read-only | PDO is not mapped yet, so arming is deferred until after-map and is not proven in this sample |
| 7 | ProbeFailed | DC diagnostics | Read-only | Capability probing raised an error, so arming was not initiated in this sample (this is not "no capability") |
DC mode truth
Mode display is always driven by the hardware read-back (sync type read-back + SYNC0 arming truth), never by the "intended mode". User intent (registered / queued pending activation) is exposed alongside as separate fields, and any mismatch with the read-back is flagged by HalfConfigured / MismatchText.
For the master-level recovery escalation observation (master.Diagnostics.MasterRecoveryLadder), see DC configuration § DC truth values and recovery observations.
| Category | Property | Type | Read/write | Description |
|---|---|---|---|---|
| DC diagnostics | DcModeTruth | DcModeTruthInfo | Read-only | Mode truth + intent side-by-side snapshot, re-sampled on every read |
| PendingDcIntent | DcPendingIntentInfo | Read-only | Mode switch request queued and waiting to be replayed at the configuration confirmation point; null = none | |
| LastDcModeSwitchError | string? | Read-only | Readable failure reason of the most recent mode switch; null = the most recent switch succeeded, or no switch has been attempted in this session |
All three members are read-only; DcModeTruth and PendingDcIntent re-sample the current values on every read, so call them at the UI refresh rate and do not put them inside the per-cycle process data loop.
LastDcModeSwitchError
public string? LastDcModeSwitchError { get; }
Readable failure reason of the most recent DC mode switch: which object rejected it, with which abort, and which window did not pass. Read-only, for direct display in the status bar / log.
Return value:
string?— failure reason;null= the most recent switch succeeded, or no switch has been attempted in this session
Example:
if (slave.LastDcModeSwitchError is string err)
Console.WriteLine($"上次 DC 模式切换失败: {err}"); // Last DC mode switch failed: {err}
PendingDcIntent
public DcPendingIntentInfo? PendingDcIntent { get; }
A DC mode intent waiting to take effect. When a user's DC / SM mode switch is rejected by the hardware or deferred by the configuration write gate, the request is queued on this slave and not silently dropped; the SDK replays it automatically at the configuration confirmation point (before the next entry into OP / on return to PreOp / after reconfiguration completes). null = there is currently no pending intent.
After the slave table is regenerated or the device is replaced, queued intents become invalid automatically and are reported as null — an intent for the old device is never applied to the new device.
Return value:
DcPendingIntentInfo?— the queued intent;null= none
Related structures:
public sealed class DcPendingIntentInfo
{
public DcSyncMode Mode { get; } // Queued target mode
public uint Sync0CycleNs { get; } // Target SYNC0 period (ns), 0 = disarm
public uint Sync1CycleNs { get; } // Target SYNC1 period (ns), 0 = disabled
public int? ShiftNs { get; } // Target phase (ns); null = unspecified, 0 / negative = explicit phase
public string Reason { get; } // Reason for queuing (engineer-readable)
public DateTime QueuedAtUtc { get; } // First queued time (UTC)
public int ReplayAttempts { get; } // How many times the configuration checkpoint has been replayed
public DateTime? LastReplayAtUtc { get; } // Time of the last replay (UTC); null = never replayed
}
Example:
var pending = slave.PendingDcIntent;
if (pending != null)
Console.WriteLine($"待生效: {pending.Mode}, SYNC0={pending.Sync0CycleNs}ns, 已重放 {pending.ReplayAttempts} 次, 原因: {pending.Reason}"); // Pending: {pending.Mode}, SYNC0={pending.Sync0CycleNs}ns, replayed {pending.ReplayAttempts} times, reason: {pending.Reason}
DcModeTruth
public DcModeTruthInfo DcModeTruth { get; }
DC mode truth snapshot: the mode follows the hardware read-back, and user intent is exposed alongside. HalfConfigured = true means only one of the two faces, "armed" and "sync type", was written (half configured); MismatchText gives a readable explanation.
Sync0CycleNs reports the read-back value only; when the read-back is 0 it does not fall back to the ESI-declared cycle; use slave.DCCycle0 when you need a fallback value.
Return value:
DcModeTruthInfo— truth snapshot for this sample
Related structures:
public sealed class DcModeTruthInfo
{
public DcSyncMode ActualMode { get; } // The synchronisation mode read back; (DcSyncMode)(-1) = no conclusion, not FreeRun
public bool? Sync0Armed { get; } // Whether SYNC0 was armed; null = no conclusion
public int? Sync0CycleNs { get; } // The real SYNC0 period that took effect (ns); null = no DC / could not be read, 0 = not armed
public bool? HalfConfigured { get; } // true = half configured, false = both sides agree, null = insufficient evidence (never pretends to agree)
public string MismatchText { get; } // Explanation of the inconsistency; empty = consistent or insufficient evidence
public DcSyncMode? IntentMode { get; } // The registered user intent mode; null = not recorded (decided automatically from ESI / ESC capability)
public DcPendingIntentInfo? PendingIntent { get; } // Intent queued to take effect; null = none
public DateTime SampledAtUtc { get; } // Sampling time (UTC)
}
Example:
var truth = slave.DcModeTruth;
Console.WriteLine($"回读={truth.ActualMode} 武装={truth.Sync0Armed} 周期={truth.Sync0CycleNs}ns 采样={truth.SampledAtUtc:O}"); // Readback={truth.ActualMode} armed={truth.Sync0Armed} cycle={truth.Sync0CycleNs}ns sampled={truth.SampledAtUtc:O}
if (truth.HalfConfigured == true)
Console.WriteLine($"半配置: {truth.MismatchText}"); // Half-configured: {truth.MismatchText}
else if (truth.HalfConfigured is null)
Console.WriteLine("判据不足,不能断言配置一致"); // Insufficient evidence, cannot assert the configuration is consistent
Reference clock and time base
- Reference clock: the master picks, in chain order, the first slave on the link that is DC-active (real SYNC0); when no slave is armed it falls back to the first DC-capable slave in the chain. The whole bus has exactly this one time base.
- Single origin: the reference domain has exactly one origin instant (the same physical instant); the master converts it into each slave's time domain and writes it to
0x0990. It is not measured separately per slave. - Reference clock changes hands (slave drop / hot-plug / capability change): every
0x0920written in the old clock's time domain becomes invalid. In chain order the master re-reads0x0920for each DC slave that is not in OP, not dropped and not the reference clock itself, proves it by reading back, and then rewrites that slave's0x0990in the new time domain. Slaves in OP are not interrupted on SYNC0; error is corrected by online adjustment. - Phase only:
0x0928is corrected by the ESC in hardware when SYNC0 is generated;shiftNsis only a phase shift and contains no propagation delay compensation. - Diagnostics: the current SDK does not expose read-only properties for
0x0990/0x0920; register-level evidence is available in the run log.
Full example
var slave = master.Slaves[0];
if (slave.HasDC)
{
slave.ConfigureDC(1_000_000); // SYNC0 = 1ms
Console.WriteLine($"DCActive={slave.DCActive}, DCCycle0={slave.DCCycle0}ns, DCShift={slave.DCShift}ns");
// detailed sync window status
var status = slave.GetSyncWindowStatus();
if (status.HasValue)
{
Console.WriteLine($"同步差={status.Value.DiffNs}ns, 同步={status.Value.InSync}"); // Sync diff={status.Value.DiffNs}ns, in sync={status.Value.InSync}
}
slave.DisableDC();
}