Skip to main content

EtherCATMaster

The core EtherCAT master class. It manages initialization, state management, slave control and PDO communication for the whole EtherCAT network.

Class structure​

EtherCATMaster                                   # Master instance
│
├── config -> MasterConfig # Communication configuration
├── diagnostics -> Optional[dict] # ETG.1510 basic diagnostics data
├── diagnostics_info -> MasterDiagnosticsInfo # Advanced diagnostics (frame counts, jitter, etc.)
├── logs -> LogView # Log view
├── master_od -> MasterObjectDictionary # ETG.1510 master object dictionary
├── mailbox_gateway -> MailboxGatewayService # ETG.8200 mailbox gateway
│
├── hotplug_bind_mode -> HotplugBindMode # Hot-plug bind mode (by identity / by position)
│
├── master[n] -> Slave # Slave access (1-based index)
│ │
│ ├── coe -> CoE # CANopen over EtherCAT (SDO read/write)
│ ├── soe -> SoE # Servo over EtherCAT
│ ├── foe -> FoE # File over EtherCAT
│ ├── eoe -> EoE # Ethernet over EtherCAT
│ ├── aoe -> AoE # ADS over EtherCAT
│ ├── voe -> VoE # Vendor over EtherCAT
│ ├── fsoe -> FSoE # Functional safety protocol
│ ├── cia402 -> CiA402 # Servo drive protocol
│ ├── pdo -> SlavePdo # PDO data read/write
│ ├── events -> SlaveEvents # Slave-level events
│ ├── dc_config -> DcConfig # DC distributed clock configuration
│ └── startup -> StartupParameterList # Startup parameters
│
├── on_pdo_cycle() # PDO cycle callback (regular worker thread, not the PDO cycle thread)
├── on_state_change() # Slave state change callback
├── on_emergency() # Emergency event callback
├── on_slave_discovery() # Slave discovery/loss callback
├── on_pdo_frame_loss() # PDO frame-loss callback
├── on_redundancy_mode_changed() # Redundancy mode change callback
├── set_dc_sync_lost_callback() # DC sync-lost callback
└── set_log_callback() # Log callback

Protocol instances (CoE, SoE and so on) are created lazily on demand and always return an object; whether a slave supports a protocol is judged through slave.coe.is_supported and the like (returns Optional[bool]: coe / eoe / foe can give True / False / None; aoe / voe / soe / fsoe only produce True / None, where None means there is no positive evidence or the read failed, not "confirmed unsupported"; EoEAdvanced on is_supported(mailbox_protocols=None) is the method that accepts a mailbox protocol bit field; slave.mdp returns None when it is not supported). CiA402 can also be created independently through CiA402Advanced, which supports PDO mapping scans.