Skip to main content

Master object dictionary (Master OD)

A master object dictionary that follows ETG.1510, exposing master identity plus slave configuration, state and diagnostic data to external diagnostic tools and HMI over the standard SDO interface.

Access through master.MasterOD.​

ETG.1510 standard

The master object dictionary follows the ETG.1510 specification and the standard CoE index conventions. Unlike a slave CoE object dictionary, it holds the diagnostic objects that the master exposes for itself. Together with the mailbox gateway, it gives remote diagnostic tools standard access to the master.

Object index overview​

IndexNameSubindexesRead/writeDescription
0x1000Device Type0Read-only0x00001389 (EtherCAT master)
0x1008Device Name0Read-only"Darra EtherCAT Master"
0x1009Hardware Version0Read-onlyProcess bitness: a 64-bit process returns "x64", a 32-bit process returns "x86"
0x100ASoftware Version0Read-onlySDK version string
0x1018Identity Object4Read-onlyMaster identity (see the subindex table below)
0x8nnnConfiguration Data40Read-onlyConfiguration data of slave n (address, name, vendor, mailbox, and so on)
0x9nnnInformation Data32Read-onlyDetected information of slave n (actual address, vendor ID, DL Status)
0xAnnnDiagnosis Data19Partially writableDiagnostic data of slave n (AL Status, error counters, link, and so on)
0xF002Detect Modules3Read-onlySlave scan status (external writes are rejected)
0xF120Master Diag Data16Read-onlyMaster diagnostic data (lost-frame count, frame rate, state)
0xF200Diag Interface Control16WritableDiagnostic interface control (reset diagnostic information)
note

nnn = slave index (1-based); the indexes are generated dynamically from master.SlaveCount. With 3 slaves, for example, 0x8001 ~ 0x8003, 0x9001 ~ 0x9003 and 0xA001 ~ 0xA003 are all accessible.

0x1018 — Master identity (Identity Object)​

SubindexNameTypeValueDescription
0Number of Entriesbyte4Fixed
1Vendor IDuint0x00001164Assigned by ETG, fixed value
2Product Codeuint0x00000001Fixed value
3Revision NumberuintAutomaticDerived automatically from the SDK version (high word = major version, low word = minor version)
4Serial NumberuintAutomatic, incrementingEach instance is assigned 0, 1, 2… automatically, so several master instances can be told apart

0x8nnn — Slave configuration data​

Each slave has one 0x8nnn object (nnn = slave index) holding the static information configured in the ENI.

SubindexNameTypeRead/writeDescription
0Number of EntriesbyteRead-onlyFixed at 40
1Fixed Station AddressushortRead-onlyConfigured address (ConfigAddr)
2TypestringRead-onlyDevice type string (DriveName)
3NamestringRead-onlyDevice name
4Device TypeuintRead-onlyDevice type code (always 0 at present; no usable data source)
5Vendor IDuintRead-onlyVendor ID
6Product CodeuintRead-onlyProduct code
7Revision NumberuintRead-onlyRevision number
8Serial NumberuintRead-onlySerial number
33Mailbox Out SizeushortRead-onlySM0 mailbox output size
34Mailbox In SizeushortRead-onlySM1 mailbox input size
35Link StatusbyteRead-onlyETG.1510 port link status. bit0 = slave lost (judged from the live verdict for the current cycle, not carried over from a latched historical state); bit(4+p) = port p currently has a link (p=0..3); the remaining bits are always 0. A 0 does not mean "all four ports are down": all high bits 0 can also mean this slave's DLSTAT was never sampled. When the SDK returns <0 (bad parameter / not ready), the read returns null = subindex unavailable, not 0.
36Link PresetbyteRead-onlyETG.1510 port link preset. Low nibble = mask of the ports expected to have a link (bit0..3 = P0..P3), high nibble = the same mask shifted left by 4; N linked ports → 0x11 / 0x33 / 0x77 / 0xFF. The input is the popcount of the ports active in the current cycle (200ms DLSTAT refresh), the same sample as :35; it is not the link count from configuration time. 0 = no port is expected to have a link (also returned as 0 when the input is unknown). When the SDK returns <0, the read returns null = subindex unavailable, not 0.
37FlagsbyteRead-onlySlave flags (Bit3 reserved; currently 0)
38Port PhysicsushortRead-onlyPort physical type
39Mailbox ProtocolsushortRead-onlySupported mailbox protocols (CoE=0x04, FoE=0x08, and so on)
40Diag History SupportedbyteRead-onlyWhether the 0x10F3 diagnostic history object is supported (0 = not supported; returns null when the CoE object dictionary is not loaded — the diagnostic read path does not scan the bus)

0x9nnn — Slave detection information​

Each slave has one 0x9nnn object holding the actual information detected at runtime.

SubindexNameTypeRead/writeDescription
0Number of EntriesbyteRead-onlyFixed at 32
1Station AddressushortRead-onlyActual configured address
5Vendor IDuintRead-onlyDetected vendor ID
6Product CodeuintRead-onlyDetected product code
7Revision NumberuintRead-onlyDetected revision number
8Serial NumberuintRead-onlyDetected serial number
32DL StatusushortRead-onlyDL Status register (ESC 0x0110-0x0111)

0xAnnn — Slave diagnostic data​

Each slave has one 0xAnnn object holding live diagnostic data. It is updated automatically on every read.

SubindexNameTypeRead/writeDescription
0Number of EntriesbyteRead-onlyFixed at 19
1AL StatusushortRead-onlyCurrent AL state
2AL ControlushortWritableWritten through to the slave
3Last AL Status CodeushortRead-onlyMost recent AL error code (ESC 0x0134)
4Link Conn. StatusbyteRead-onlyETG.1510 two-bit-per-port connection state (0 no signal / 1 internal loopback only / 2 communication established / 3 signal present and loop closed); it is not "which port of the parent this slave is attached to" — for that the only answer is Slave.ParentPort. When the per-port two-bit state is unavailable, the read returns null = subindex unavailable.
5Link ControlbyteRead-onlyLink control (DL Control register 0x0101)
6Fixed Addr Conn. Port 0ushortRead-onlyFixed address of the slave connected to port 0 of this slave (the upstream parent). 0 = this port reports no connected slave and does not mean nothing is connected; to find which port of the parent this slave is attached to, use Slave.ParentPort.
7Fixed Addr Conn. Port 1ushortRead-onlyFixed address of the slave connected to port 1 of this slave (a downstream child, child parent_port == 1). 0 = this port reports no connected slave and does not mean nothing is connected; to find which port of the parent this slave is attached to, use Slave.ParentPort.
8Fixed Addr Conn. Port 2ushortRead-onlyFixed address of the slave connected to port 2 of this slave (a downstream child, child parent_port == 2). 0 = this port reports no connected slave and does not mean nothing is connected; to find which port of the parent this slave is attached to, use Slave.ParentPort.
9Fixed Addr Conn. Port 3ushortRead-onlyFixed address of the slave connected to port 3 of this slave (a downstream child, child parent_port == 3). 0 = this port reports no connected slave and does not mean nothing is connected; to find which port of the parent this slave is attached to, use Slave.ParentPort.
10Frame Error Port 0uintRead-onlyPort 0 frame error count
11Frame Error Port 1uintRead-onlyPort 1 frame error count
12Frame Error Port 2uintRead-onlyPort 2 frame error count
13Frame Error Port 3uintRead-onlyPort 3 frame error count
14Cyclic WC Error CounteruintRead-onlyCyclic working counter errors (no usable data source; the read returns null = subindex unavailable)
15Slave Not Present CounteruintRead-onlyCount of slaves not present (no usable data source; the read returns null = subindex unavailable)
16Abnormal State Change CounteruintRead-onlyCount of abnormal state changes (no usable data source; the read returns null = subindex unavailable)
17Disable Auto Link ControlbyteRead-onlyNo usable data source; the read returns null (subindex unavailable) — do not treat it as false
18Last CoE/SoE Protocol ErroruintRead-onlyMost recent CoE/SoE protocol error code
19New Diag MessagesbyteRead-onlyWhether there are new diagnostic messages (answered only when 0x10F3:4 was really read from the slave; returns null when no usable data source exists)
How 0xAnnn:06..09 are read

Subindexes 6..9 are delivered by the SDK 4 ports at a time: out[p] = the fixed address of the slave connected to port p of this slave (p=0 the upstream parent; p=1..3 a downstream child whose parent_port == p; a parent_port of 0xFE/0xFF means unknown and takes no part in matching). The caller's array must be int[4]; the SDK does not check its capacity. When the call returns <0 (bad parameter / not ready), all four subindexes report null = subindex unavailable; it does not write 0 to pass off "all four ports are empty".

0xF002 — Scan command​

Safety guard

The 0xF002 scan command rejects external writes. Running a scan while the master is operating can lose the configuration and upset devices, so this object is read-only.
A slave scan runs only during master initialization.

SubindexNameTypeRead/writeDescription
0Number of EntriesbyteRead-onlyFixed at 3
1Scan Command RequestushortRead-onlyScan command request (external writes are rejected)
2Scan Command StatusbyteRead-onlyAlways 1 (the scan command rejects writes, so the state machine never leaves the idle state; in the specification 1 = finished without error, 3 = finished with error, 255 = in progress)
3Scan Command Responsebyte[6]Read-onlyState + reserved 0 + error code (2 bytes) + current slave count (2 bytes, live value)

0xF120 — Master diagnostic data​

SubindexNameTypeRead/writeDescription
0Number of EntriesbyteRead-onlyFixed at 16
1Cyclic Lost FramesuintRead-onlyCyclic lost-frame count (reads the raw lost-frame counter, not a percentage)
2Acyclic Lost FramesuintRead-onlyAcyclic lost-frame count (this implementation always returns 0)
3Cyclic Frames/SeconduintRead-onlyCyclic frames per second
4Acyclic Frames/SeconduintRead-onlyAcyclic frames per second (this implementation always returns 0)
16Master StateushortRead-onlyCurrent EtherCAT state of the master
How 0xF120:01 is read

This path returns the raw lost-frame counter (it only increases from the counting start point; it returns to zero when 0xF200:16 resets it). It is a count of lost frames, not a lost-frame rate in percent.

0xF200 — Diagnostic interface control​

SubindexNameTypeRead/writeDescription
0Number of EntriesbyteRead-onlyFixed at 16
16Reset Diag InfobyteWritableWriting 1 resets the diagnostic counters of all slaves and of the master (triggered on a rising edge)

Methods​

ReadObject(ushort index, byte subindex)​

public byte[]? ReadObject(ushort index, byte subindex)

Reads the data at the given index from the master object dictionary.

Parameters:

  • index (ushort) — object index (such as 0x1018, 0x8001, 0xA001)
  • subindex (byte) — subindex

Returns:

  • byte[]? — the raw data read; an unknown object returns null

Example:

byte[] vid = master.MasterOD.ReadObject(0x8001, 5);
uint vendorId = BitConverter.ToUInt32(vid, 0);

ReadObject(ushort index, byte subindex, out byte[] data, out ushort abortCode)​

public int ReadObject(ushort index, byte subindex, out byte[] data, out ushort abortCode)

Reads the master object dictionary and keeps both the return code and the CoE abort code. A failure is no longer collapsed into a single null: the caller can tell "the object / subindex does not exist" from "the bus did not answer", which suits a diagnostic tool that enumerates a whole range of subindexes.

Parameters:

  • index (ushort) — object index
  • subindex (byte) — subindex
  • data (out byte[]) — the data read; an empty array on failure (this overload does not return null)
  • abortCode (out ushort) — CoE abort code (ETG.1000.6); 0 on success

Returns:

  • int — >= 0 = number of bytes written to data; a negative value = failure code (object / subindex does not exist, master not ready, invalid parameter, buffer too small, bus I/O failure, version not supported). When the master is not yet created or already closed, it returns at once without starting a bus read

Example:

int rc = master.MasterOD.ReadObject(0x8001, 5, out byte[] data, out ushort abort);
if (rc < 0)
Console.WriteLine($"读失败 rc={rc}, CoE abort=0x{abort:X4}"); // Read failed rc={rc}, CoE abort=0x{abort:X4}
else
Console.WriteLine($"读到 {data.Length} 字节"); // Read {data.Length} bytes

WriteObject(ushort index, byte subindex, byte[] data)​

public bool WriteObject(ushort index, byte subindex, byte[] data)

Writes to the master object dictionary. Only some objects accept writes (see the Read/write column of the object tables above).

Parameters:

  • index (ushort) — object index
  • subindex (byte) — subindex
  • data (byte[]) — the data to write

Returns:

  • bool — true on success

WriteObject(ushort index, byte subindex, byte[] data, out ushort abortCode)​

public int WriteObject(ushort index, byte subindex, byte[] data, out ushort abortCode)

Writes to the master object dictionary and keeps both the return code and the CoE abort code (WriteObject(index, subindex, data) is the Boolean view of this overload). The writable range matches the WriteObject above; every other object is honestly rejected as read-only / unsupported.

Parameters:

  • index (ushort) — object index
  • subindex (byte) — subindex
  • data (byte[]) — the data to write
  • abortCode (out ushort) — CoE abort code (ETG.1000.6); 0 on success

Returns:

  • int — 0 = success; a negative value = failure code (not writable / object does not exist / master not ready / invalid parameter / bus I/O failure / version not supported). When the master is not yet created or already closed, it returns at once without starting a bus write

GetObjectName(ushort index)​

public string GetObjectName(ushort index)

Gets the name of an object.

Parameters:

  • index (ushort) — object index

Returns:

  • string — the object name; an unknown index returns a string of the form "Unknown (原始值: …)" (SDK output, = Unknown (original value: …))

GetSubindexCount(ushort index)​

public byte GetSubindexCount(ushort index)

Gets the subindex count of an object.

Parameters:

  • index (ushort) — object index

Returns:

  • byte — the subindex count

GetSupportedObjectIndices()​

public List<ushort> GetSupportedObjectIndices()

Gets the list of all object indexes currently supported (fixed indexes plus the 0x8nnn/0x9nnn/0xAnnn ranges generated dynamically from the slave count).

Returns:

  • List<ushort> — the list of supported indexes

Shortcut methods​

// Same as master.MasterOD.ReadObject(index, subindex)
byte[] data = master.ReadMasterObject(0x1018, 1);

// Same as master.MasterOD.WriteObject(index, subindex, data)
bool ok = master.WriteMasterObject(0xF200, 16, new byte[] { 1 });

Full example​

var od = master.MasterOD;

// Walk the diagnostic data of every slave
for (ushort i = 1; i <= master.SlaveCount; i++)
{
ushort cfgIdx = (ushort)(0x8000 | i);
ushort diagIdx = (ushort)(0xA000 | i);

// Read the slave name
byte[] nameData = od.ReadObject(cfgIdx, 3);
string name = nameData != null ? Encoding.ASCII.GetString(nameData) : "N/A";

// Read AL Status and the error code
byte[] alStatus = od.ReadObject(diagIdx, 1);
byte[] alCode = od.ReadObject(diagIdx, 3);

// Read the frame error count of each port
uint[] portErrors = new uint[4];
for (byte p = 0; p < 4; p++)
{
byte[] err = od.ReadObject(diagIdx, (byte)(10 + p));
if (err != null) portErrors[p] = BitConverter.ToUInt32(err, 0);
}

Console.WriteLine($"从站{i} [{name}]: " + // Slave{i} [{name}]:
$"AL=0x{BitConverter.ToUInt16(alStatus ?? new byte[2], 0):X4}, " +
$"Code=0x{BitConverter.ToUInt16(alCode ?? new byte[2], 0):X4}, " +
$"Errors=[{string.Join(",", portErrors)}]");
}

// Reset all diagnostics
od.WriteObject(0xF200, 16, new byte[] { 1 });