This page covers the lower-level EtherCAT and commissioning helpers that are available when the normal addSlave.cmd and applyComponent.cmd path is not enough.
Use it when you need:
The normal setup uses one EtherCAT domain.
If you need a separate execution rate or execution offset for a set of entries, create another domain:
${SCRIPTEXEC} ${ecmccfg_DIR}addDomain.cmd "EXE_RATE=2,EXE_OFFSET=0,ALLOW_OFFLINE=0"
Important behavior:
addDomain.cmd belong to the new domainEXE_RATE is in realtime cyclesEXE_OFFSET is also in realtime cyclesALLOW_OFFLINE=1 relaxes the domain state requirement, but can affect the rest of the bus and the DC behaviorUse extra domains only when you have a clear reason. For most systems, the default single-domain setup is simpler and safer.
addEcDataItem.cmd exposes a value directly from already configured process-image data.
Think of it as a typed pointer into the process image.
Example:
${SCRIPTEXEC} ${ecmccfg_DIR}addEcDataItem.cmd \
"STRT_ENTRY_S_ID=5,STRT_ENTRY_NAME=statusWord01,OFFSET_BYTE=0,OFFSET_BITS=0,RW=2,DT=U16,NAME=rawStatus"
Use this when:
Key parameters:
STRT_ENTRY_S_ID: slave positionSTRT_ENTRY_NAME: start entry nameOFFSET_BYTE, OFFSET_BITS: offset from that start entryRW: 1 write, 2 readDT: data type such as B1, U16, S32, F32, F64NAME: runtime name of the created itemBy default, the wrapper also loads a matching EPICS record for the item.
Use addEcSdoRT.cmd when you need on-demand access to one EtherCAT SDO while the IOC is already running in realtime.
This is useful for:
addEcSdoRT.cmd wraps Cfg.EcAddSdoAsync(...).
addEcSdoRT.cmd creates one named asynchronous SDO object in ecmc and then loads EPICS records for it.
For a name like HW_ENABLE, the underlying asyn object path becomes:
ec<master>.s<slave>.sdo.HW_ENABLE
The script then creates these PVs:
...SDO-HW_ENABLE-Val...SDO-HW_ENABLE-RdCmd...SDO-HW_ENABLE-WrtCmd...SDO-HW_ENABLE-Bsy...SDO-HW_ENABLE-ErrIdIn practice:
Val holds the current value to write and the most recent readback valueRdCmd triggers an SDO readWrtCmd triggers an SDO writeBsy indicates that the SDO object is currently busyErrId exposes the most recent SDO error code${SCRIPTEXEC} ${ecmccfg_DIR}addEcSdoRT.cmd \
"SLAVE_ID=<slave>,INDEX=0x<index>,SUBINDEX=0x<sub>,DT=<type>,NAME=<name>"
Supported parameters:
SLAVE_ID: EtherCAT slave position. Optional, defaults to 0INDEX: SDO index, for example 0x8010SUBINDEX: SDO subindex, for example 0x07DT: data type string such as U8, S16, U32, S32, F32, F64NAME: logical object name used in both the asyn path and EPICS PV namesP_SCRIPT: optional naming-prefix script; defaults to ${ECMC_P_SCRIPT}${SCRIPTEXEC} ${ecmccfg_DIR}addEcSdoRT.cmd \
"SLAVE_ID=7,INDEX=0x8010,SUBINDEX=0x07,DT=U16,NAME=DRV_PARAM"
Typical usage from EPICS:
...SDO-DRV_PARAM-Val...SDO-DRV_PARAM-WrtCmd to write it...SDO-DRV_PARAM-RdCmd to refresh the readback...SDO-DRV_PARAM-Bsy and ...SDO-DRV_PARAM-ErrIdThe script chooses the value record template from DT:
F32 and F64 use the floating-point template and asynFloat64asynInt32That means:
aoaoVal is always the central EPICS value record, while RdCmd and WrtCmd control when the actual SDO transfer happensPrefer RT SDO objects when:
Do not use RT SDO objects when:
For startup-time writes, prefer normal SDO configuration with Cfg.EcAddSdo(...), Cfg.EcAddSdoDT(...), or the higher-level slave/component setup.
Use applySlaveDCconfig.cmd when a slave needs explicit distributed-clock configuration:
${SCRIPTEXEC} ${ecmccfg_DIR}applySlaveDCconfig.cmd \
"ASSIGN_ACTIVATE=0x0300,SYNC_0_CYCLE=1000000,SYNC_0_SHIFT=0"
Typical inputs:
ASSIGN_ACTIVATE: DC assign/activate word from the terminal XMLSYNC_0_CYCLE: sync period in nsSYNC_0_SHIFT: sync shift in nsSYNC_1_CYCLE: optional second sync period in nsUse this only when the slave actually needs explicit DC setup. Unnecessary DC customization can make commissioning harder.
Use slaveVerify.cmd during commissioning or in strict production setups to verify that the expected slave is actually present:
${SCRIPTEXEC} ${ecmccfg_DIR}slaveVerify.cmd "RESET=0,READ_FW=1"
The script can:
0x10110x100aThis is useful when:
Use ignoreSlaves.cmd when the logical topology in the startup file must skip one or more bus positions:
${SCRIPTEXEC} ${ecmccfg_DIR}ignoreSlaves.cmd "COUNT=2"
This does not configure anything by itself. It only advances the slave-position counter used by later slave-related scripts.
Typical use:
For normal systems:
addSlave.cmdapplyComponent.cmd where possibleFor advanced systems:
addEcDataItem.cmd