ni / niveristand-scan-engine-ethercat-custom-device

Provides NI Scan Engine, EtherCAT and Remote IO support for NI VeriStand
MIT License
16 stars 22 forks source link

How to use SDO to configure slave? #240

Open fangz0424 opened 1 year ago

fangz0424 commented 1 year ago

We use NI Real-Time Controllers (PXIe 8861) as EtherCAT Master for third party (non NI) EtherCAT Slaves. But how to use SDO to configure slaves?

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YNpoCAG&l=zh-CN

Karl-G1 commented 1 year ago

The Custom Device does not contain a mechanism to send/receive SDOs. It only interacts with PDOs by exposing VeriStand channels for each PDO defined and enabled in the ESI file.

If I recall correctly, you can use the Mailbox > CoE > InitCmd tags to define configuration SDOs to be sent on initialization (during Scan Engine state change which happens on VeriStand deployment). This is handled at the driver level, and VeriStand should not interfere with them. However, it can't be defined, read, or changed from VeriStand.

        <Mailbox DataLinkLayer="1">
          <EoE />
          <CoE SdoInfo="true" PdoAssign="true" PdoConfig="true">
            <InitCmd>
              <Transition>PS</Transition>
              <Index>#x6060</Index>
              <SubIndex>0</SubIndex>
              <Data>08</Data>
              <Comment>Op mode</Comment>
            </InitCmd>
          </CoE>
          <FoE />
        </Mailbox>