Master object dictionary (Master OD)
A master object dictionary that follows the ETG.1510 standard. It provides master identity information plus slave configuration, status and diagnostic data, and lets external diagnostic tools and HMI reach it over the standard SDO interface.
Access it through master.master_od.
The master object dictionary is implemented according to the ETG.1510 specification. Used together with the mailbox gateway, it gives remote diagnostic tools standard access to the master.
Object index overview
| Index | Category | Name | Subindexes | Read/write | Description |
|---|---|---|---|---|---|
| 0x1000 | Device identity | Device Type | 0 | Read-only | 0x00001389 (EtherCAT master) |
| 0x1008 | Device identity | Manufacturer Device Name | 0 | Read-only | "Darra EtherCAT Master" |
| 0x1009 | Device identity | Manufacturer Hardware Version | 0 | Read-only | Process bitness: a 64-bit process returns "x64", a 32-bit process returns "x86" |
| 0x100A | Device identity | Manufacturer Software Version | 0 | Read-only | SDK version (major.minor.build) |
| 0x1018 | Device identity | Identity Object | 4 | Read-only | Master identity information |
| 0x8nnn | Slave configuration | Configuration Data | 40 | Read-only | Configuration data of slave n |
| 0x9nnn | Slave information | Information Data | 32 | Read-only | Detected information of slave n |
| 0xAnnn | Slave diagnostics | Diagnosis Data | 19 | Read-only | Diagnostic data of slave n |
| 0xF002 | Scan | Detect Modules Command | 3 | Read-only | Slave scan status |
| 0xF120 | Master diagnostics | Master Diag Data | 16 | Read-only | Master diagnostic data |
| 0xF200 | Diagnostic control | Diag Interface Control | 16 | Read/write | Diagnostic interface control |
nnn = slave index (1-based); the indexes are generated dynamically from master.slave_count. With 3 slaves, for example, 0x8001 ~ 0x8003, 0x9001 ~ 0x9003 and 0xA001 ~ 0xA003 are all accessible.
0x1009 has two read paths and two return values: master.master_od.read_object returns "x64" / "x86"; the mailbox gateway path currently returns "1.0". This is recorded as implemented; a later version will unify it to the process bitness.
0x1018 — Master identity (Identity Object)
| Subindex | Category | Name | Type | Value | Read/write | Description |
|---|---|---|---|---|---|---|
| 0 | Identity | Number of Entries | int | 4 | Read-only | Fixed |
| 1 | Identity | Vendor ID | int | 0x00001164 | Read-only | Assigned by ETG, fixed value |
| 2 | Identity | Product Code | int | 0x00000001 | Read-only | Fixed value |
| 3 | Identity | Revision Number | int | Automatic | Read-only | Derived automatically from the underlying library version (high word = major version, low word = minor version) |
| 4 | Identity | Serial Number | int | Automatic, incrementing | Read-only | Each instance is assigned 0, 1, 2... automatically, so multiple 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.
| Subindex | Category | Name | Type | Read/write | Description |
|---|---|---|---|---|---|
| 0 | Structure | Number of Entries | int | Read-only | Fixed at 40 |
| 1 | Address | Fixed Station Address | int | Read-only | Configured address ConfigAddr (slave.config_addr), not the 1-based slave index; a failed read returns None |
| 2 | Identification | Type | str | Read-only | Device type string (slave.drive_name, ASCII; non-ASCII characters are replaced with ? under the ASCII convention); a failed read returns None |
| 3 | Identification | Name | str | Read-only | Slave group name (slave.name, the EEPROM group_name; ASCII; non-ASCII characters follow the same replacement convention as :2); a failed read returns None |
| 4 | Identification | Device Type | int | Read-only | Fixed 0 (same convention as the SDKs in other languages: this field has no data source and is always 0) — this is a well-founded definite value, not "unknown" |
| 5 | Identification | Vendor ID | int | Read-only | Vendor ID |
| 6 | Identification | Product Code | int | Read-only | Product code |
| 7 | Identification | Revision Number | int | Read-only | Revision number |
| 8 | Identification | Serial Number | int | Read-only | Serial number |
| 33 | Mailbox | Mailbox Out Size | int | Read-only | SM0 mailbox output size (slave.mbx_length, u16); a failed read returns None |
| 34 | Mailbox | Mailbox In Size | int | Read-only | SM1 mailbox input size (slave.mbx_read_length, u16); a failed read returns None |
| 35 | Link | Link Status | int | Read-only | ETG.1510 0x8nnn:35 (1 byte). bit0 = slave lost (the criterion is the live verdict for the current cycle; the latched lost-slave flag is not read); bit(4+p) = port p currently has a link (p=0..3); the remaining bits are always 0. This byte has no unknown encodings: all high bits 0 may simply mean this slave's DLSTAT has never been sampled, so a 0 alone must not be taken to assert "all four ports are down". When the read fails, read_object returns None (subindex unavailable) rather than passing off 0. |
| 36 | Link | Link Preset | int | Read-only | ETG.1510 0x8nnn:36 (1 byte). 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 slave.active_ports in the current cycle (200 ms DLSTAT refresh), the same sample as :35; it is not the link count from configuration time. 0 = definitively no port is expected to have a link (also returned as 0 when the input is unknown). When the underlying layer returns non-0, read_object returns None rather than passing off 0. |
| 37 | Link | Flags | int | Read-only | Fixed 0 (1 byte; same convention as the SDKs in other languages; Bit3 reserved) — a definite value, not "unknown" |
| 38 | Link | Port Physics | int | Read-only | Port physical type (slave.physical_type, u16); a failed read returns None |
| 39 | Mailbox | Mailbox Protocols | int | Read-only | Bit mask of the supported mailbox protocols (slave.mbx_proto, u16; CoE=0x04, FoE=0x08 and so on); a failed read returns None |
| 40 | Diagnostics | Diag History Supported | int | Read-only | Whether 0x10F3 is reachable, decided in three tiers: (a) no CoE mailbox (mbx_proto does not contain 0x04, or the SM0 length is 0) ⇒ 0; (b) the OD list is loaded ⇒ 1 if it contains 0x10F3, otherwise 0; (c) not loaded ⇒ None (the diagnostic read path does not trigger a scan) |
read_object currently implements subindexes 0, 1, 2, 3, 4, 5, 6, 7, 8, 33, 34, 35, 36, 37, 38, 39 and 40 for 0x8nnn; the rest (9–32, 41 and above) return None.
0x9nnn — Slave detection information
Each slave has one 0x9nnn object holding the actual information detected at runtime.
| Subindex | Category | Name | Type | Read/write | Description |
|---|---|---|---|---|---|
| 0 | Structure | Number of Entries | int | Read-only | Fixed at 32 |
| 1 | Address | Station Address | int | Read-only | Actual configured address ConfigAddr (slave.config_addr), not the 1-based slave index; a failed read returns None |
| 5 | Identification | Vendor ID | int | Read-only | Detected vendor ID |
| 6 | Identification | Product Code | int | Read-only | Detected product code |
| 7 | Identification | Revision Number | int | Read-only | Detected revision number |
| 8 | Identification | Serial Number | int | Read-only | Detected serial number |
| 32 | Link | DL Status | int | Reserved | DL Status register (ESC 0x0110-0x0111) |
read_object currently implements only subindexes 0, 1 and 5–8 for 0x9nnn; subindex 32 is an ETG.1510 layout placeholder and reads return None.
0xAnnn — Slave diagnostic data
Each slave has one 0xAnnn object holding diagnostic data. Reads all go through the underlying ETG.1510 entry point that returns the real value (Etg1510_ReadObject, a blocking register read): subindexes 1–5 and 10–13 are read from it; subindexes 6–9 come from one underlying read of the fixed addresses of the 4 ports; subindex 18 is taken from slave.coe.last_sdo_error; subindexes 14–17 and 19 have no true-value source and return None. Convention: unavailable = None; never pass off 0 as a definite value; 0 is reported only where a true value of 0 really exists (on this page :18 is such a case when no SDO abort has ever occurred).
| Subindex | Category | Name | Type | Read/write | Description |
|---|---|---|---|---|---|
| 0 | Structure | Number of Entries | int | Read-only | Fixed at 19 |
| 1 | Status | AL Status | int | Read-only | AL Status from ESC 0x0130 (underlying ETG.1510 blocking read); returns None when it cannot be read, never passing off 0 as "a live slave in INIT with no error" |
| 2 | Control | AL Control | int | Read/write | Read = current value of ESC 0x0120 (underlying blocking read; returns None when it cannot be read); write = write_object writes ESC 0x0120, and the data must be 2 bytes (one of the only writable subindexes) |
| 3 | Status | Last AL Status Code | int | Read-only | Most recent AL error code from ESC 0x0134 (underlying blocking read); returns None when it cannot be read |
| 4 | Link | Link Conn. Status | int | Read-only | Link Conn. Status (the DL Status bit field parsed into a two-bit connection state per port), not the port this slave is attached to; returns None when it cannot be read |
| 5 | Link | Link Control | int | Read-only | Link control from ESC 0x0101 (underlying blocking read); returns None when it cannot be read |
| 6 | Link | Fixed Addr Conn. Port 0 | int | Read-only | One underlying read of the fixed addresses of the four ports P0..P3 delivers this entry as P0; a failed read returns None. 0 = this port reports no connected slave, which is not the same as definitively nothing being connected (it also returns 0 when the parent is unknown). To find which port of the parent this slave is attached to, use slave.parent_port |
| 7 | Link | Fixed Addr Conn. Port 1 | int | Read-only | One underlying read of the fixed addresses of the four ports P0..P3 delivers this entry as P1; a failed read returns None. 0 = this port reports no connected slave, which is not the same as definitively nothing being connected (it also returns 0 when the child's parent_port is unknown) |
| 8 | Link | Fixed Addr Conn. Port 2 | int | Read-only | One underlying read of the fixed addresses of the four ports P0..P3 delivers this entry as P2; a failed read returns None. 0 = this port reports no connected slave, which is not the same as definitively nothing being connected (it also returns 0 when the child's parent_port is unknown) |
| 9 | Link | Fixed Addr Conn. Port 3 | int | Read-only | One underlying read of the fixed addresses of the four ports P0..P3 delivers this entry as P3; a failed read returns None. 0 = this port reports no connected slave, which is not the same as definitively nothing being connected (it also returns 0 when the child's parent_port is unknown) |
| 10 | Link | Frame Error Port 0 | int | Read-only | Frame error count of port 0 (ESC 0x0300+2×p, underlying blocking read); returns None when it cannot be read |
| 11 | Link | Frame Error Port 1 | int | Read-only | Frame error count of port 1, same as :10; returns None when it cannot be read |
| 12 | Link | Frame Error Port 2 | int | Read-only | Frame error count of port 2, same as :10; returns None when it cannot be read |
| 13 | Link | Frame Error Port 3 | int | Read-only | Frame error count of port 3, same as :10; returns None when it cannot be read |
| 14 | Counter | Cyclic WC Error Counter | int | Unavailable | Unavailable: there is no per-slave source for the real value of a cumulative cyclic WKC error counter; the read returns None |
| 15 | Counter | Slave Not Present Counter | int | Unavailable | Unavailable: there is no per-slave source for the real value of a cumulative slave-absence counter; the read returns None |
| 16 | Counter | Abnormal State Change Counter | int | Unavailable | Unavailable: there is no per-slave source for the real value of a cumulative abnormal state change counter; the read returns None |
| 17 | Link | Disable Auto Link Control | int | Unavailable | Unavailable: neither the underlying layer nor the CoE side has a mirrored source for this per-slave flag; the read returns None (it does not pass off False) |
| 18 | Protocol | Last CoE/SoE Protocol Error | int | Read-only | Most recent CoE/SoE protocol error code (taken live from slave.coe.last_sdo_error); 0 when no SDO abort has ever occurred (a real value) |
| 19 | Diagnostics | New Diag Messages | int | Unavailable | Unavailable: it would require really reading 0x10F3:4 from the slave, and there is no per-slave source for the real value of the flag; the read returns None (it does not pass off False) |
0xF002 — Scan command
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. More functions will come in a future update.
| Subindex | Category | Name | Type | Read/write | Description |
|---|---|---|---|---|---|
| 0 | Structure | Number of Entries | int | Read-only | Fixed at 3 |
| 1 | Scan | Scan Command Request | int | Read-only | Scan command request (external writes are rejected) |
| 2 | Scan | Scan Command Status | int | Read-only | 1 = finished without error, 3 = finished with error, 255 = in progress |
| 3 | Scan | Scan Command Response | bytes | Read-only | State + error code + detected slave count |
On the Python side the slave scan does not go through this object; in the current implementation subindex 2 is always 1 (finished without error) and the detected slave count in subindex 3 is always 0.
0xF120 — Master diagnostic data
| Subindex | Category | Name | Type | Read/write | Description |
|---|---|---|---|---|---|
| 0 | Structure | Number of Entries | int | Read-only | Fixed at 16 |
| 1 | Statistics | Cyclic Lost Frames | int | Read-only | Cumulative count of lost cyclic frames (a real count, not scaled into a percentage) |
| 2 | Statistics | Acyclic Lost Frames | int | Read-only | Cumulative count of lost acyclic frames (underlying ETG.1510 blocking read); returns None when it cannot be read, never passing off 0 as "no lost frames" |
| 3 | Statistics | Cyclic Frames/Second | int | Read-only | Cyclic frames per second (taken from the underlying bus cycle; returns 0 when the real cycle cannot be obtained) |
| 4 | Statistics | Acyclic Frames/Second | int | Read-only | Acyclic frames per second (underlying ETG.1510 blocking read); returns None when it cannot be read |
| 16 | Status | Master State | int | Read-only | Current EtherCAT state of the master |
0xF200 — Diagnostic interface control
| Subindex | Category | Name | Type | Read/write | Description |
|---|---|---|---|---|---|
| 0 | Structure | Number of Entries | int | Read-only | Fixed at 16 |
| 16 | Control | Reset Diag Info | int | Writable | Writing 1 resets the last protocol error cache of 0xAnnn:18 (triggered on a rising edge) |
Methods
read_object()
def read_object(self, index: int, subindex: int) -> Optional[bytes]
Reads the data at the given index from the master object dictionary.
Parameters:
index(int) — object index (such as0x1018,0x8001,0xA001)subindex(int) — subindex
Returns:
Optional[bytes]— the raw data read; an unknown object or a subindex that is not available yet returnsNone(unavailable ≠ 0; do not fold it into 0 as a definite value)
Example:
import struct
vid = master.master_od.read_object(0x8001, 5)
if vid is not None:
vendor_id = struct.unpack('<I', vid)[0]
print(f"厂商ID: 0x{vendor_id:08X}") # VendorID: 0x{vendor_id:08X}
write_object()
def write_object(self, index: int, subindex: int, data: bytes) -> bool
Writes to the master object dictionary. Only 0xF200:16 (Reset Diag Info) and 0xAnnn:2 (AL Control, written to ESC 0x0120, must be 2 bytes) are writable subindexes; 0xF002 is read-only for safety, and writes to every other object and subindex return False (see the Read/write column of the object tables above).
Parameters:
index(int) — object indexsubindex(int) — subindexdata(bytes) — the data to write
Returns:
bool—Trueon success
get_object_name()
def get_object_name(self, index: int) -> str
Gets the name of an object.
Parameters:
index(int) — object index
Returns:
str— the object name; an unknown index returns"Unknown"
get_subindex_count()
def get_subindex_count(self, index: int) -> int
Gets the subindex count of an object.
Parameters:
index(int) — object index
Returns:
int— the subindex count (an unknown index returns 0)
get_supported_object_indices()
def get_supported_object_indices(self) -> List[int]
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[int]— the list of supported indexes
Reading and writing the master object dictionary
Reads and writes both go through master.master_od:
# Read the master object dictionary
data = master.master_od.read_object(0x1018, 1)
# Write to the master object dictionary (only some objects are writable)
ok = master.master_od.write_object(0xF200, 16, bytes([1]))
Complete example
od = master.master_od
def hex_or_none(data):
return "None" if data is None else f"0x{int.from_bytes(data, 'little'):X}"
for i in range(1, master.slave_count + 1):
cfg_idx = 0x8000 | i
diag_idx = 0xA000 | i
addr = od.read_object(cfg_idx, 1) # ConfigAddr
name = od.read_object(cfg_idx, 3) # device name (ASCII)
link_status = od.read_object(cfg_idx, 35) # ETG.1510 Link Status
link_preset = od.read_object(cfg_idx, 36) # ETG.1510 Link Preset
sdo_err = od.read_object(diag_idx, 18) # most recent SDO Abort Code
# None = this subindex is unavailable; do not collapse it to 0 and treat it as a "known value"
print(f"从站{i} [{name.decode('ascii') if name else 'None'}]: " # Slave{i} [{name.decode('ascii') if name else 'None'}]:
f"ConfigAddr={hex_or_none(addr)}, "
f"LinkStatus={hex_or_none(link_status)}, "
f"LinkPreset={hex_or_none(link_preset)}, "
f"SDOLastErr={hex_or_none(sdo_err)}")
# Reset the diagnostic cache (0xF200:16, rising-edge triggered)
od.write_object(0xF200, 16, bytes([1]))