logo资料库

Ethercat的基本应用.pdf

第1页 / 共389页
第2页 / 共389页
第3页 / 共389页
第4页 / 共389页
第5页 / 共389页
第6页 / 共389页
第7页 / 共389页
第8页 / 共389页
资料共389页,剩余部分请下载后查看
1 Introduction
1.1 About this Document
1.2 List of Revisions
1.3 Functional Overview
1.4 System Requirements
1.5 Intended Audience
1.6 Specifications
1.7 Terms, Abbreviations and Definitions
1.8 References
1.9 Legal Notes
1.9.1 Copyright
1.9.2 Important Notes
1.9.3 Exclusion of Liability
1.9.4 Export
2 Fundamentals
2.1 General Access Mechanisms on netX Systems
2.2 Accessing the Protocol Stack by Programming the AP Task’s Queue
2.2.1 Getting the Receiver Task Handle of the Process Queue
2.2.2 Meaning of Source- and Destination-related Parameters
2.3 Accessing the Protocol Stack via the Dual Port Memory Interface
2.3.1 Communication via Mailboxes
2.3.2 Using Source and Destination Variables correctly
2.3.2.1 How to use ulDest for Addressing rcX and the netX Protocol Stack by the System and Channel Mailbox
2.3.2.2 How to use ulSrc and ulSrcId
2.3.3 Obtaining useful Information about the Communication Channel
3 Dual-Port Memory
3.1 Cyclic Data (Input/Output Data)
3.1.1 Input Process Data
3.1.2 Output Process Data
3.2 Acyclic Data (Mailboxes)
3.2.1 General Structure of Messages or Packets for Non-Cyclic Data Exchange
3.2.2 Status & Error Codes
3.2.3 Differences between System and Channel Mailboxes
3.2.4 Send Mailbox
3.2.5 Receive Mailbox
3.2.6 Channel Mailboxes (Details of Send and Receive Mailboxes)
3.3 Status
3.3.1 Common Status
3.3.1.1 All Implementations
3.3.1.2 Master Implementation
3.3.1.3 Slave Implementation
3.3.2 Extended Status
3.4 Control Block
4 Configuration
4.1 Overview about Essential Functionality
4.2 Configuration Procedures
4.2.1 Using a Packet (ECAT_DPM_SET_CONFIGURATION_REQ/CNF)
4.3 Warmstart Parameters
4.3.1 Behavior when receiving a Set Configuration / Warmstart Command
4.4 Configuration of an EtherCAT Slave Device
4.4.1 Steps and Hints to configuring with Warmstart Packet
4.5 Behavior of the Stack at Watchdog Error during BUS OFF
4.6 Process Data (Input and Output)
4.6.1 ECAT_DPM_SET_IO_SIZE_REQ/CNF - Selectively changing Process Data Input or Output Length
4.7 Maintenance of Station Alias
4.7.1 Set Station Alias
4.7.2 Get Station Alias
4.8 Update Configuration
4.9 Status Codes for Stack Control
4.9.1 RCX_APP_COS_BUS_ON - Set Bus On in Channel
4.9.2 Channel Watchdog Timeout Handling
4.10 Configuration of the CoE Stack
4.10.1 Internal configuration
4.10.2 CoE Config File Example Snippet
4.11 Configuration Issues for LOM Mode
4.11.1 DC Control Loop Configuration
4.11.2 Variable Mailbox Size Configuration
4.12 Task Structure of the EtherCAT Slave Stack
5 Features of the EtherCAT Slave Stack
5.1 Elementary Features
5.1.1 The EtherCAT State Machine (ESM)
5.1.2 Structure of an EtherCAT Complex Slave
5.1.3 Kinds of Object Access
5.2 The ECAT_ESM Task of the Base Stack
5.2.1 Queue/Task Handle
5.2.2 Startup parameters of the ECAT_ESM-Task
5.2.3 AL Status Events – Indication of Status Changes requested by the Master
5.2.3.1 Standard and Vendor-specific AL Status Codes
5.2.4 SII (Slave Information Interface)
5.2.4.1 SII Description
5.2.5 Boot State Support/Configuration for Variable Mailbox Size
5.2.5.1 Configuration Dependencies with IO Data Size
5.3 The ECAT_MBX Task of the Base Stack
5.3.1 Queue/Task Handle
5.3.2 Startup parameters of the ECAT_MBX-Task
5.4 The ECAT_COE Task of the CoE Stack
5.4.1 Queue/Task Handle
5.4.2 EtherCAT CoE Access Flags
5.4.2.1 Access Type Selection
5.4.2.2 Mailbox Priority Selection
5.4.2.3 Helper Macros
5.4.3 CoE Emergencies
5.5 The ECAT_SDO Task of the CoE Stack
5.5.1 General Information on the ECAT_SDO-Task
5.5.2 Queue/Task Handle
5.5.3 Start-up Parameters of the ECAT_SDO-Task
5.5.4 SDO specific Error Codes
5.5.5 SDO Download and Upload
5.5.6 Object Access Types
OD2_OBJ_ACCESS_RXPDOMAP
OD2_OBJ_ACCESS_TXPDOMAP
OD2_OBJ_ACCESS_PDOMAP
OD2_OBJ_ACCESS_BACKUP
OD2_OBJ_ACCESS_CONFIG
OD2_OBJ_ACCESS_INDEXED
5.5.7 Sub-Object Access Types
5.6 Object Dictionary
5.6.1 General Structure
5.6.2 Objects
5.6.3 Data Types
5.6.4 The CoE Communication Area
5.6.4.1 Device Type
5.6.4.2 Manufacturer Device Name
5.6.4.3 Manufacturer Hardware Version
5.6.4.4 Manufacturer Software Version
5.6.4.5 Identity Object
5.7 The ECAT_SOESSC Task of the SoE Stack
5.7.1 Queue/Task Handle
5.7.2 Start-up Parameters of the ECAT_SOESSC-Task
5.8 The ECAT_SOEIDN Task of the SoE Stack
5.8.1 General Information on the ECAT_SOEIDN-Task
5.8.2 Queue/Task Handle
5.8.3 Start-up Parameters of the ECAT_SOEIDN-Task
5.8.4 SSC specific Error Codes
5.8.5 IDN Read and Write
5.8.6 IDN Element Ids
5.8.7 IDN data state
5.8.8 IDN attribute flags
6 Application Interface
6.1 The ECAT_ESM-Task of the Base Stack
6.1.1 ECAT_ESM_REGISTERNOTIFY_REQ/CNF – Registration at Indication Notification Table
6.1.2 ECAT_ESM_UNREGISTERNOTIFY_REQ/CNF – Unregistration at Indication Notification Table
6.1.3 ECAT_ESM_ALSTATUS_INIT_IND/RES – ESM State changed to Init
6.1.4 ECAT_ESM_ALSTATUS_PRE_OPERATIONAL_IND/RES – ESM State changed to Pre-Operational
6.1.5 ECAT_ESM_ALSTATUS_SAFE_OPERATIONAL_IND/RES – ESM State changed to Safe-Operational
6.1.6 ECAT_ESM_ALSTATUS_OPERATIONAL_IND/RES – ESM State changed to Operational
6.1.7 ECAT_ESM_ALSTATUS_CHANGE_REQ/CNF – Requests an ESM State transition
6.1.8 ECAT_ESM_SETINIT_IND/RES – Indication to Stack to notify Readiness
6.1.9 ECAT_ESM_SII_WRITE_REQ/CNF – SII Write Request
6.1.10 ECAT_ESM_SII_READ_REQ/CNF – SII Read Request
6.1.11 ECAT_ESM_SII_UPDATE_VENDOR_DATA_IND/RES – SII Indication that Vendor-specific Data require an Update
6.1.12 ECAT_ESM_SET_QUEUE_CNF_AL_CONTROL_REQ/CNF – Set a Queue as State Transition Control Receiver
6.1.13 ECAT_ESM_CLR_QUEUE_CNF_AL_CONTROL_REQ/CNF – Clear the current AL State Transition Control Receiver
6.1.14 ECAT_ESM_ALCONTROL_CHANGE_IND/RES – ESM State indicates State Change Request to be confirmed by AP Task
6.1.15 ECAT_ESM_INIT_COMPLETE_IND/ECAT_ESM_INIT_COMPLETE_RES – Initialization Complete Indication
6.1.16 ECAT_ESM_REGISTER_PROCDATA_INDICATIONS_REQ/ ECAT_ESM_REGISTER_PROCDATA_INDICATIONS_CNF – Register for Receiving Process Data Indications
6.1.17 ECAT_ESM_UNREGISTER_PROCDATA_INDICATIONS_REQ/ ECAT_ESM_UNREGISTER_PROCDATA_INDICATIONS_CNF – Unregister from Receiving Process Data Indications
6.1.18 ECAT_ESM_START_PROCDATA_INPUT_IND/ ECAT_ESM_START_PROCDATA_INPUT_RES – Start Process Data Input Indication
6.1.19 ECAT_ESM_STOP_PROCDATA_INPUT_IND / ECAT_ESM_STOP_PROCDATA_INPUT_RES – Stop Process Data Input Indication
6.1.20 ECAT_ESM_START_PROCDATA_OUTPUT_IND/ ECAT_ESM_START_PROCDATA_OUTPUT_RES – Start Process Data Output Indication
6.1.21 ECAT_ESM_STOP_PROCDATA_OUTPUT_IND / ECAT_ESM_STOP_PROCDATA_OUTPUT_RES – Stop Process Data Output Indication
6.2 The ECAT_COE Task of the CoE Stack
6.2.1 ECAT_COE_SEND_EMERGENCY_REQ/CNF – Send CoE Emergency Message
6.3 The ECAT_SDO-Task of the CoE Stack
6.3.1 ECAT_LOCAL_SDO_DOWNLOAD_EXP_REQ/CNF – Request a local SDO Download
6.3.2 ECAT_LOCAL_SDO_UPLOAD_EXP_REQ/CNF – Request a local SDO Upload
6.3.3 ECAT_SDO_DOWNLOAD_EXP_REQ/CNF – Request an SDO Download to another Server
6.3.4 ECAT_SDO_UPLOAD_EXP_REQ/CNF – Request an SDO Upload to another Server
6.3.5 ECAT_OD_CREATE_OBJECT_REQ/CNF – Create an Object
6.3.6 ECAT_OD_CREATE_SUBOBJECT_REQ/CNF – Create a Sub-Object
6.3.7 ECAT_OD_DELETE_OBJECT_REQ/CNF – Delete an Object or Sub-Object
6.3.8 ECAT_OD_SET_OBJECT_NAME_REQ/CNF – Set the Name of an Object
6.3.9 ECAT_OD_SET_SUBOBJECT_NAME_REQ/CNF – Set the Name of a Subobject
6.3.10 ECAT_OD_CREATE_DATATYPE_REQ/CNF – Create new Data Type
6.3.11 ECAT_OD_DELETE_DATATYPE_REQ/CNF – Delete Data Type
6.3.12 ECAT_OD_NOTIFY_REGISTER_REQ/CNF – Register for Notify Indication
6.3.13 ECAT_OD_NOTIFY_UNREGISTER_REQ/CNF – Unregister from Notify Indication
6.3.14 ECAT_OD_NOTIFY_READ_IND/RES – Read Notification of an Object
6.3.15 ECAT_OD_NOTIFY_WRITE_IND/RES – Write Notification of an Object
6.3.16 Undefined Object Read/Write Notify Hooks
6.3.17 SDO Abort Codes
6.3.18 ECAT_OD_UNDEFINED_NOTIFY_REGISTER_REQ/CNF - Undefined Object Read/Write Notification Registration
6.3.19 ECAT_OD_UNDEFINED_NOTIFY_UNREGISTER_REQ/CNF - Undefined Object Read/Write Notification Unregistration
6.3.20 ECAT_OD_UNDEFINED_READ_PREPARE_IND/RES - Data Type Information Indication for Undefined Object
6.3.21 ECAT_OD_UNDEFINED_READ_DATA_IND/RES - Data Read Indication for Undefined Object
6.3.22 ECAT_OD_UNDEFINED_WRITE_DATA_IND/RES - Data Write Indication for Undefined Object
6.3.23 SDO Info Packet API hooks
6.3.24 ECAT_OD_SDOINFO_REGISTER_REQ/CNF - SDO Info Packet Hook Registration
6.3.25 ECAT_OD_SDOINFO_UNREGISTER_REQ/CNF – SDO Info Packet Hook Unregistration
6.3.26 ECAT_OD_SDOINFO_GET_LIST_IND/RES – Object Directory Get List Indication
6.3.27 ECAT_OD_SDOINFO_GET_OBJ_DESC_IND/RES – Object Directory Get Object Description Indication
6.3.28 ECAT_OD_SDOINFO_GET_ENTRY_DESC_IND/RES – Object Directory Get Description Entry Indication
6.4 The ECAT_SOEIDN-Task of the SoE Stack
6.4.1 ECAT_SOE_WRITE_REQ/CNF – Write an IDN stored within the Dictionary
6.4.2 ECAT_SOE_READ_REQ/CNF – Read an IDN stored within the Dictionary
6.4.3 ECAT_SOEIDN_CREATE_IDN_REQ/CNF – Create an IDN
6.4.4 ECAT_SOEIDN_DELETE_IDN_REQ/CNF – Delete an IDN-Object
6.4.5 ECAT_SOEIDN_SET_NAME_REQ/CNF – Set the Name of an IDN
6.4.6 ECAT_SOEIDN_SET_UNIT_REQ/CNF – Set the Unit of an IDN
6.4.7 ECAT_SOEIDN_REGISTER_IDN_NOTIFY_REQ/CNF – Register for IDN Read/Write Indications
6.4.8 ECAT_SOEIDN_UNREGISTER_IDN_NOTIFY_REQ/CNF – Unregister from IDN Read/Write Indications
6.4.9 ECAT_SOE_READ_IND/RES – Read Indication of an IDN
6.4.10 ECAT_SOE_WRITE_IND/RES – Write Indication of an IDN
6.4.11 ECAT_SOE_PROCCMD_NOTIFY_REQ/CNF – Notify the master about data state changes of a Procedure Command
6.4.12 ECAT_SOEIDN_REGISTER_UNDEFINED_NOTIFY_REQ/CNF – Register for IDN Read/Write Indications to non-existing IDNs
6.4.13 ECAT_SOEIDN_UNREGISTER_UNDEFINED_NOTIFY_REQ/CNF – Unregister for IDN Read/Write Indications to non-existing IDNs
6.5 The ECAT_FOE Task of the FoE Stack
6.5.1 ECAT_FOE_REGISTER_FILE_INDICATION_REQ/CNF - Register File Indication
6.5.2 ECAT_FOE_UNREGISTER_FILE_INDICATION_REQ/CNF - Unregister File Indication
6.5.3 ECAT_FOE_FILE_WRITTEN_IND - File Written Indication
6.6 The ECAT_EOE Task of the EoE Stack
6.6.1 ECAT_EOE_SET_NOTIFY_QUEUE_REQ/CNF – Set Notify Queue Request
6.6.2 ECAT_EOE_CLEAR_NOTIFY_QUEUE_REQ/CNF - Clear Notify Queue Request
6.6.3 ECAT_EOE_FRAME_IND/RES –Frame Reception Indication
6.6.4 ECAT_EOE_FRAME_REQ/CNF – Send Frame Request
6.6.5 ECAT_EOE_SET_IPPARAM_NOTIFY_QUEUE_REQ/CNF – Set IP Parameter Notify Queue Request
6.6.6 ECAT_EOE_CLEAR_IPPARAM_NOTIFY_QUEUE_REQ/CNF –Clear IP Parameter Notify Queue Request
6.6.7 ECAT_EOE_SET_IP_PARAM_IND/RES – Set IP Parameter Indication
6.6.8 ECAT_EOE_GET_IP_PARAM_IND/RES - Get IP Parameter Indication
6.6.9 ECAT_EOE_SET_TIMEOUTS_REQ/CNF – Set Timeout Request
6.6.10 ECAT_EOE_GET_TIMEOUTS_REQ/CNF - Get Timeout Request
7 Status/Error Codes Overview
7.1 Status/Error Codes of Base Stack
7.2 Status/Error Codes of CoE Stack
7.3 Status/Error Codes of SoE Stack
8 Appendix
8.1 List of Tables
8.2 List of Figures
8.3 EtherCAT Summary concerning Vendor ID, Conformance Test, Membership and Network Logo
8.4 Contact
g Protocol API EtherCAT Slave V2.5.x.x Hilscher Gesellschaft für Systemautomation mbH www.hilscher.com DOC050701API17EN | Revision 17 | English | 2012-02 | Released | Public
Introduction 2/389 Table of Contents 1 2 3 4 Introduction....................................................................................................................................6 1.1 About this Document.................................................................................................................. 6 1.2 List of Revisions ......................................................................................................................... 6 1.3 Functional Overview................................................................................................................... 9 1.4 System Requirements ................................................................................................................ 9 1.5 Intended Audience ..................................................................................................................... 9 1.6 Specifications ........................................................................................................................... 10 1.7 Terms, Abbreviations and Definitions ...................................................................................... 11 1.8 References ............................................................................................................................... 11 1.9 Legal Notes .............................................................................................................................. 12 1.9.1 Copyright........................................................................................................................................ 12 Important Notes.............................................................................................................................. 12 1.9.2 Exclusion of Liability....................................................................................................................... 13 1.9.3 1.9.4 Export............................................................................................................................................. 13 Fundamentals ..............................................................................................................................14 2.1 General Access Mechanisms on netX Systems ...................................................................... 14 2.2 Accessing the Protocol Stack by Programming the AP Task’s Queue.................................... 15 2.2.1 Getting the Receiver Task Handle of the Process Queue.............................................................. 15 2.2.2 Meaning of Source- and Destination-related Parameters .............................................................. 16 2.3 Accessing the Protocol Stack via the Dual Port Memory Interface.......................................... 16 2.3.1 Communication via Mailboxes ....................................................................................................... 16 2.3.2 Using Source and Destination Variables correctly ......................................................................... 17 2.3.3 Obtaining useful Information about the Communication Channel .................................................. 20 Dual-Port Memory........................................................................................................................22 3.1 Cyclic Data (Input/Output Data) ............................................................................................... 22 3.1.1 Input Process Data......................................................................................................................... 23 3.1.2 Output Process Data...................................................................................................................... 23 3.2 Acyclic Data (Mailboxes).......................................................................................................... 24 3.2.1 General Structure of Messages or Packets for Non-Cyclic Data Exchange................................... 25 Status & Error Codes ..................................................................................................................... 27 3.2.2 3.2.3 Differences between System and Channel Mailboxes ................................................................... 27 3.2.4 Send Mailbox ................................................................................................................................. 28 3.2.5 Receive Mailbox............................................................................................................................. 28 3.2.6 Channel Mailboxes (Details of Send and Receive Mailboxes) ....................................................... 28 3.3 Status ....................................................................................................................................... 30 3.3.1 Common Status ............................................................................................................................. 30 Extended Status............................................................................................................................. 36 3.3.2 3.4 Control Block ............................................................................................................................ 37 Configuration ...............................................................................................................................38 4.1 Overview about Essential Functionality ................................................................................... 38 4.2 Configuration Procedures......................................................................................................... 38 4.2.1 Using a Packet (ECAT_DPM_SET_CONFIGURATION_REQ/CNF)................................................... 38 4.3 Warmstart Parameters ............................................................................................................. 40 Behavior when receiving a Set Configuration / Warmstart Command............................................ 64 4.3.1 4.4 Configuration of an EtherCAT Slave Device............................................................................ 65 4.4.1 Steps and Hints to configuring with Warmstart Packet................................................................... 65 4.5 Behavior of the Stack at Watchdog Error during BUS OFF..................................................... 67 4.6 Process Data (Input and Output) ............................................................................................. 68 4.6.1 ECAT_DPM_SET_IO_SIZE_REQ/CNF - Selectively changing Process Data Input or Output Length 68 4.7 Maintenance of Station Alias.................................................................................................... 71 Set Station Alias............................................................................................................................. 71 4.7.1 4.7.2 Get Station Alias ............................................................................................................................ 73 4.8 Update Configuration ............................................................................................................... 75 4.9 Status Codes for Stack Control................................................................................................ 79 4.9.1 RCX_APP_COS_BUS_ON - Set Bus On in Channel......................................................................... 79 4.9.2 Channel Watchdog Timeout Handling............................................................................................ 79 4.10 Configuration of the CoE Stack................................................................................................ 80 EtherCAT Slave | Protocol API DOC050701API17EN | Revision 17 | English | 2012-02 | Released | Public © Hilscher, 2005-2012
Introduction 5 6 4.10.1 4.10.2 4.11.1 4.11.2 3/389 Internal configuration................................................................................................................. 80 CoE Config File Example Snippet ............................................................................................. 80 4.11 Configuration Issues for LOM Mode ........................................................................................ 82 DC Control Loop Configuration ................................................................................................. 82 Variable Mailbox Size Configuration.......................................................................................... 83 4.12 Task Structure of the EtherCAT Slave Stack........................................................................... 83 Features of the EtherCAT Slave Stack ......................................................................................85 5.1 Elementary Features ................................................................................................................ 85 The EtherCAT State Machine (ESM) ............................................................................................. 85 5.1.1 Structure of an EtherCAT Complex Slave...................................................................................... 86 5.1.2 5.1.3 Kinds of Object Access .................................................................................................................. 86 5.2 The ECAT_ESM Task of the Base Stack................................................................................... 87 5.2.1 Queue/Task Handle ....................................................................................................................... 87 Startup parameters of the ECAT_ESM-Task ................................................................................... 87 5.2.2 5.2.3 AL Status Events – Indication of Status Changes requested by the Master .................................. 89 5.2.4 SII (Slave Information Interface)..................................................................................................... 94 5.2.5 Boot State Support/Configuration for Variable Mailbox Size .......................................................... 96 5.3 The ECAT_MBX Task of the Base Stack................................................................................... 98 5.3.1 Queue/Task Handle ....................................................................................................................... 98 Startup parameters of the ECAT_MBX-Task ................................................................................... 98 5.3.2 5.4 The ECAT_COE Task of the CoE Stack.................................................................................... 99 5.4.1 Queue/Task Handle ....................................................................................................................... 99 EtherCAT CoE Access Flags ......................................................................................................... 99 5.4.2 5.4.3 CoE Emergencies ........................................................................................................................ 100 5.5 The ECAT_SDO Task of the CoE Stack.................................................................................. 102 5.5.1 General Information on the ECAT_SDO-Task ............................................................................... 102 5.5.2 Queue/Task Handle ..................................................................................................................... 103 5.5.3 Start-up Parameters of the ECAT_SDO-Task................................................................................ 103 5.5.4 SDO specific Error Codes ............................................................................................................ 103 5.5.5 SDO Download and Upload ......................................................................................................... 104 5.5.6 Object Access Types ................................................................................................................... 104 5.5.7 Sub-Object Access Types............................................................................................................ 104 5.6 Object Dictionary .................................................................................................................... 105 5.6.1 General Structure......................................................................................................................... 105 5.6.2 Objects......................................................................................................................................... 106 5.6.3 Data Types................................................................................................................................... 107 5.6.4 The CoE Communication Area..................................................................................................... 109 5.7 The ECAT_SOESSC Task of the SoE Stack............................................................................ 114 5.7.1 Queue/Task Handle ..................................................................................................................... 114 5.7.2 Start-up Parameters of the ECAT_SOESSC-Task ......................................................................... 114 5.8 The ECAT_SOEIDN Task of the SoE Stack............................................................................ 115 5.8.1 General Information on the ECAT_SOEIDN-Task......................................................................... 115 5.8.2 Queue/Task Handle ..................................................................................................................... 116 5.8.3 Start-up Parameters of the ECAT_SOEIDN-Task ......................................................................... 116 SSC specific Error Codes ............................................................................................................ 116 5.8.4 IDN Read and Write..................................................................................................................... 116 5.8.5 5.8.6 IDN Element Ids........................................................................................................................... 116 5.8.7 IDN data state .............................................................................................................................. 118 5.8.8 IDN attribute flags ........................................................................................................................ 119 Application Interface .................................................................................................................121 6.1 The ECAT_ESM-Task of the Base Stack................................................................................. 124 6.1.1 ECAT_ESM_REGISTERNOTIFY_REQ/CNF – Registration at Indication Notification Table........... 126 ECAT_ESM_UNREGISTERNOTIFY_REQ/CNF – Unregistration at Indication Notification Table ... 130 6.1.2 ECAT_ESM_ALSTATUS_INIT_IND/RES – ESM State changed to Init ....................................... 134 6.1.3 6.1.4 ECAT_ESM_ALSTATUS_PRE_OPERATIONAL_IND/RES – ESM State changed to Pre-Operational 138 6.1.5 ECAT_ESM_ALSTATUS_SAFE_OPERATIONAL_IND/RES – ESM State changed to Safe- Operational................................................................................................................................................. 142 ECAT_ESM_ALSTATUS_OPERATIONAL_IND/RES – ESM State changed to Operational .......... 146 6.1.6 6.1.7 ECAT_ESM_ALSTATUS_CHANGE_REQ/CNF – Requests an ESM State transition....................... 150 6.1.8 ECAT_ESM_SETINIT_IND/RES – Indication to Stack to notify Readiness ................................. 155 ECAT_ESM_SII_WRITE_REQ/CNF – SII Write Request ............................................................. 158 6.1.9 6.1.10 ECAT_ESM_SII_READ_REQ/CNF – SII Read Request .......................................................... 160 EtherCAT Slave | Protocol API DOC050701API17EN | Revision 17 | English | 2012-02 | Released | Public © Hilscher, 2005-2012
Introduction 4/389 6.1.11 ECAT_ESM_SII_UPDATE_VENDOR_DATA_IND/RES – SII Indication that Vendor-specific Data require an Update....................................................................................................................................... 163 6.1.12 ECAT_ESM_SET_QUEUE_CNF_AL_CONTROL_REQ/CNF – Set a Queue as State Transition Control Receiver......................................................................................................................................... 166 6.1.13 ECAT_ESM_CLR_QUEUE_CNF_AL_CONTROL_REQ/CNF – Clear the current AL State Transition Control Receiver......................................................................................................................................... 170 6.1.14 ECAT_ESM_ALCONTROL_CHANGE_IND/RES – ESM State indicates State Change Request to be confirmed by AP Task ........................................................................................................................... 174 6.1.15 ECAT_ESM_INIT_COMPLETE_IND/ECAT_ESM_INIT_COMPLETE_RES – Initialization Complete Indication.................................................................................................................................... 179 6.1.16 ECAT_ESM_REGISTER_PROCDATA_INDICATIONS_REQ/ ECAT_ESM_REGISTER_PROCDATA_INDICATIONS_CNF – Register for Receiving Process Data Indications 181 6.1.17 ECAT_ESM_UNREGISTER_PROCDATA_INDICATIONS_REQ/ ECAT_ESM_UNREGISTER_PROCDATA_INDICATIONS_CNF – Unregister from Receiving Process Data Indications 184 6.1.18 ECAT_ESM_START_PROCDATA_INPUT_IND/ ECAT_ESM_START_PROCDATA_INPUT_RES – Start Process Data Input Indication ............................................................................................................ 187 6.1.19 ECAT_ESM_STOP_PROCDATA_INPUT_IND / ECAT_ESM_STOP_PROCDATA_INPUT_RES – Stop Process Data Input Indication ............................................................................................................ 189 6.1.20 ECAT_ESM_START_PROCDATA_OUTPUT_IND/ ECAT_ESM_START_PROCDATA_OUTPUT_RES – Start Process Data Output Indication ...................................................................................................... 191 6.1.21 ECAT_ESM_STOP_PROCDATA_OUTPUT_IND / ECAT_ESM_STOP_PROCDATA_OUTPUT_RES – Stop Process Data Output Indication ......................................................................................................... 193 6.2 The ECAT_COE Task of the CoE Stack.................................................................................. 195 6.2.1 ECAT_COE_SEND_EMERGENCY_REQ/CNF – Send CoE Emergency Message........................... 195 6.3 The ECAT_SDO-Task of the CoE Stack.................................................................................. 201 6.3.1 ECAT_LOCAL_SDO_DOWNLOAD_EXP_REQ/CNF – Request a local SDO Download.................... 203 ECAT_LOCAL_SDO_UPLOAD_EXP_REQ/CNF – Request a local SDO Upload............................. 207 6.3.2 6.3.3 ECAT_SDO_DOWNLOAD_EXP_REQ/CNF – Request an SDO Download to another Server .......... 212 ECAT_SDO_UPLOAD_EXP_REQ/CNF – Request an SDO Upload to another Server ................... 216 6.3.4 ECAT_OD_CREATE_OBJECT_REQ/CNF – Create an Object....................................................... 220 6.3.5 6.3.6 ECAT_OD_CREATE_SUBOBJECT_REQ/CNF – Create a Sub-Object........................................... 225 6.3.7 ECAT_OD_DELETE_OBJECT_REQ/CNF – Delete an Object or Sub-Object ................................. 232 6.3.8 ECAT_OD_SET_OBJECT_NAME_REQ/CNF – Set the Name of an Object .................................... 236 ECAT_OD_SET_SUBOBJECT_NAME_REQ/CNF – Set the Name of a Subobject .......................... 239 6.3.9 6.3.10 ECAT_OD_CREATE_DATATYPE_REQ/CNF – Create new Data Type ...................................... 242 6.3.11 ECAT_OD_DELETE_DATATYPE_REQ/CNF – Delete Data Type .............................................. 244 6.3.12 ECAT_OD_NOTIFY_REGISTER_REQ/CNF – Register for Notify Indication............................. 246 ECAT_OD_NOTIFY_UNREGISTER_REQ/CNF – Unregister from Notify Indication .................. 251 6.3.13 ECAT_OD_NOTIFY_READ_IND/RES – Read Notification of an Object................................... 256 6.3.14 6.3.15 ECAT_OD_NOTIFY_WRITE_IND/RES – Write Notification of an Object ................................. 259 6.3.16 Undefined Object Read/Write Notify Hooks ............................................................................ 262 6.3.17 SDO Abort Codes.................................................................................................................... 263 6.3.18 ECAT_OD_UNDEFINED_NOTIFY_REGISTER_REQ/CNF - Undefined Object Read/Write Notification Registration.............................................................................................................................. 267 6.3.19 ECAT_OD_UNDEFINED_NOTIFY_UNREGISTER_REQ/CNF - Undefined Object Read/Write Notification Unregistration .......................................................................................................................... 269 6.3.20 ECAT_OD_UNDEFINED_READ_PREPARE_IND/RES - Data Type Information Indication for Undefined Object........................................................................................................................................ 271 ECAT_OD_UNDEFINED_READ_DATA_IND/RES - Data Read Indication for Undefined Object274 6.3.21 6.3.22 ECAT_OD_UNDEFINED_WRITE_DATA_IND/RES - Data Write Indication for Undefined Object 277 SDO Info Packet API hooks .................................................................................................... 280 6.3.23 ECAT_OD_SDOINFO_REGISTER_REQ/CNF - SDO Info Packet Hook Registration ................ 281 6.3.24 ECAT_OD_SDOINFO_UNREGISTER_REQ/CNF – SDO Info Packet Hook Unregistration ........ 283 6.3.25 6.3.26 ECAT_OD_SDOINFO_GET_LIST_IND/RES – Object Directory Get List Indication ................ 285 6.3.27 ECAT_OD_SDOINFO_GET_OBJ_DESC_IND/RES – Object Directory Get Object Description Indication 288 6.3.28 ECAT_OD_SDOINFO_GET_ENTRY_DESC_IND/RES – Object Directory Get Description Entry Indication 292 6.4.1 6.4 The ECAT_SOEIDN-Task of the SoE Stack ........................................................................... 297 ECAT_SOE_WRITE_REQ/CNF – Write an IDN stored within the Dictionary.................................. 298 EtherCAT Slave | Protocol API DOC050701API17EN | Revision 17 | English | 2012-02 | Released | Public © Hilscher, 2005-2012
Introduction 5/389 ECAT_SOE_READ_REQ/CNF – Read an IDN stored within the Dictionary ................................... 301 6.4.2 ECAT_SOEIDN_CREATE_IDN_REQ/CNF – Create an IDN......................................................... 304 6.4.3 ECAT_SOEIDN_DELETE_IDN_REQ/CNF – Delete an IDN-Object............................................... 308 6.4.4 ECAT_SOEIDN_SET_NAME_REQ/CNF – Set the Name of an IDN ............................................... 310 6.4.5 ECAT_SOEIDN_SET_UNIT_REQ/CNF – Set the Unit of an IDN .................................................. 313 6.4.6 ECAT_SOEIDN_REGISTER_IDN_NOTIFY_REQ/CNF – Register for IDN Read/Write Indications316 6.4.7 6.4.8 ECAT_SOEIDN_UNREGISTER_IDN_NOTIFY_REQ/CNF – Unregister from IDN Read/Write Indications .................................................................................................................................................. 319 6.4.9 ECAT_SOE_READ_IND/RES – Read Indication of an IDN ........................................................... 321 ECAT_SOE_WRITE_IND/RES – Write Indication of an IDN .................................................... 324 6.4.10 6.4.11 ECAT_SOE_PROCCMD_NOTIFY_REQ/CNF – Notify the master about data state changes of a Procedure Command ................................................................................................................................. 327 6.4.12 ECAT_SOEIDN_REGISTER_UNDEFINED_NOTIFY_REQ/CNF – Register for IDN Read/Write Indications to non-existing IDNs ................................................................................................................. 330 6.4.13 ECAT_SOEIDN_UNREGISTER_UNDEFINED_NOTIFY_REQ/CNF – Unregister for IDN Read/Write Indications to non-existing IDNs .............................................................................................. 333 6.5 The ECAT_FOE Task of the FoE Stack .................................................................................. 335 ECAT_FOE_REGISTER_FILE_INDICATION_REQ/CNF - Register File Indication...................... 335 6.5.1 ECAT_FOE_UNREGISTER_FILE_INDICATION_REQ/CNF - Unregister File Indication .............. 338 6.5.2 6.5.3 ECAT_FOE_FILE_WRITTEN_IND - File Written Indication.......................................................... 341 6.6 The ECAT_EOE Task of the EoE Stack .................................................................................. 344 ECAT_EOE_SET_NOTIFY_QUEUE_REQ/CNF – Set Notify Queue Request................................. 344 6.6.1 ECAT_EOE_CLEAR_NOTIFY_QUEUE_REQ/CNF - Clear Notify Queue Request ......................... 346 6.6.2 6.6.3 ECAT_EOE_FRAME_IND/RES –Frame Reception Indication ....................................................... 348 6.6.4 ECAT_EOE_FRAME_REQ/CNF – Send Frame Request................................................................ 352 6.6.5 ECAT_EOE_SET_IPPARAM_NOTIFY_QUEUE_REQ/CNF – Set IP Parameter Notify Queue Request 356 6.6.6 ECAT_EOE_CLEAR_IPPARAM_NOTIFY_QUEUE_REQ/CNF –Clear IP Parameter Notify Queue Request 358 6.6.7 ECAT_EOE_SET_IP_PARAM_IND/RES – Set IP Parameter Indication ....................................... 360 ECAT_EOE_GET_IP_PARAM_IND/RES - Get IP Parameter Indication........................................ 364 6.6.8 ECAT_EOE_SET_TIMEOUTS_REQ/CNF – Set Timeout Request ................................................. 368 6.6.9 6.6.10 ECAT_EOE_GET_TIMEOUTS_REQ/CNF - Get Timeout Request............................................. 370 Status/Error Codes Overview...................................................................................................372 7.1 Status/Error Codes of Base Stack ......................................................................................... 372 7.2 Status/Error Codes of CoE Stack........................................................................................... 375 7.3 Status/Error Codes of SoE Stack........................................................................................... 378 Appendix ....................................................................................................................................382 8.1 List of Tables .......................................................................................................................... 382 8.2 List of Figures......................................................................................................................... 387 8.3 EtherCAT Summary concerning Vendor ID, Conformance Test, Membership and Network Logo 388 8.4 Contact ................................................................................................................................... 389 7 8 EtherCAT Slave | Protocol API DOC050701API17EN | Revision 17 | English | 2012-02 | Released | Public © Hilscher, 2005-2012
6/389 Introduction 1 Introduction 1.1 About this Document This manual describes the application interface of the EtherCAT Slave Protocol Stack. The intention of it is to help the interested developer to use this interface and implement application tasks using this stack. The application task will be called AP-Task in the following chapters. The development of the stack is based on the Hilscher’s Task Layer Reference Programming Model. It is a specification of how to develop a task in general, which is a convention defining a combination of appropriate functions belonging to the same task. Furthermore, It defines how different tasks have to communicate together in order to exchange their data. The Reference Model is commonly used by all developers at Hilscher and shall be used by you as well when writing your application task on top of the stack. 1.2 List of Revisions Name Chapter Rev 14 Date 2010-07-02 RG, UJ 15 2011-03-21 RG, GG, UJ, EO Revision Firmware/stack version V2.5.10 Reference to netX Dual-Port Memory Interface Manual Revision 9. Added new section Behavior of the Stack at Watchdog Error during BUS OFF in order to clarify conditions preventing the stack from correct start-up to OPERATIONAL State Removed some outdated parts Changed some mask names Added description of response packets Added description of process data indication packets. Rewrote subsections concerning SDO Upload/Download Corrected first sentence of text. Field element szName in ECAT_OD_SDOINFO_GET_OBJ_DESC_RES must be NUL-terminated Firmware/stack version V2.5.14 Some additions Length corrected (7->11) More precise description of SDO Upload/Download, description of parameter ulSDOLength has been improved Error correction (number of I/O bytes) in Table 21: ECAT_DPM_WARMSTART_REQ– Request Command to configure the Stack A lot of corrections and additions in section ECAT_ESM_ALCONTROL_CHANGE_IND/RES – ESM State indicates State Change Request to be confirmed by AP Task Added a new column for giving a more precise description of the error New description of SII Adapted description of SII Error correction in source code example 4.5 0 - 6.1.21 6.3.1 – 6.3.4 6.3.15 6.3.27 6.3.6 6.3.7 6.3.1 – 6.3.4 4.3 6.1.14 6.1.14 5.2.4 6.1.9, 6.1.10 6.3.6 EtherCAT Slave | Protocol API DOC050701API17EN | Revision 17 | English | 2012-02 | Released | Public © Hilscher, 2005-2012
Introduction 7/389 Name Chapter Rev 15 (cont.) Date 2011-03-21 RG, GG, UJ, EO 16 2012-01-19 RG 6.3.6 6.3.7 6.3.1 – 6.3.4 4.3 6.1.14 6.1.14 5.2.4 6.1.9, 6.1.10 6.3.6 6.3.1 – 6.3.2 6.3.1 – 6.3.4 6.3.6 4.4, 4.9 4.4 4.3 4.3 4.3 4.3 Revision Corrections in ECAT_LOCAL_SDO_DOWNLOAD_EXP_REQ/CNF – Request a local SDO Download and ECAT_LOCAL_SDO_UPLOAD_EXP_REQ/CNF – Request a local SDO Upload Corrections in ECAT_DPM_SET_IO_SIZE_CNF and ECAT_OD_SDOINFO_REGISTER_REQ_T ECAT_OD_UNDEFINED_WRITE_DATA_IND_T: Incorrect length Revised text of section “Object Access Types” Extended description of ECAT_DPM_SET_UPDATE_CFG_MODE_MODE_FREERUN ECAT_LOCAL_SDO_UP/DOWNLOAD_EXP_REQ/CNF: description changed to new structures “R2” ECAT_OD_SET_(SUB)OBJECT_NAME_R2_REQ_T: description changed to new structures “R2” removed unused bits in UP/DOWNLOAD(_EXP) descriptions ECAT_OD_CREATE_SUBOBJECT_REQ: explained backward compatibility for some variables Text “How to configure Sync0 and Sync1 Signals?” added and Sync PDI Config described Firmware/stack version V2.5.23 Reference to netX Dual-Port Memory Interface Manual Revision 9 Added section Standard and Vendor-specific AL Status Codes Extended section SII Description by description of categories Added links to Stack Configuration Flags and SII Configuration Flags Error corrections on the following sections: ECAT_ESM_ALSTATUS_INIT_IND/RES – ESM State changed to Init ECAT_ESM_ALSTATUS_PRE_OPERATIONAL_IND/RES – ESM State changed to Pre-Operational ECAT_ESM_ALSTATUS_SAFE_OPERATIONAL_IND/RES – ESM State changed to Safe-Operational ECAT_ESM_ALSTATUS_OPERATIONAL_IND/RES – ESM State changed to Operational Added missing description of ECAT_ESM_SETINIT_RES Added missing description of ECAT_ESM_SII_UPDATE_VENDOR_DATA_RES ECAT_ESM_CLR_QUEUE_CNF_AL_CONTROL_REQ: Corrected value of ulLen Additions and corrections in subsections ECAT_COE_SEND_EMERGENCY_REQ/CNF – Send CoE Emergency Message, ECAT_OD_CREATE_DATATYPE_REQ/CNF – Create new Data Type and ECAT_OD_DELETE_DATATYPE_REQ/CNF – Delete Data Type Added 3 missing SDO abort codes ECAT_OD_NOTIFY_WRITE_IND/RES – Write Notification of an Object -Description of response added ECAT_OD_UNDEFINED_WRITE_DATA_IND/RES - Data Write Indication for Undefined Object -Description of response added Added note to description of usSubObjAccess in subsection ECAT_OD_CREATE_SUBOBJECT_REQ/CNF – Create a Sub-Object Term "host ready bit" replaced by "BusOn/Off" Superfluous text removed Correction of wrong note regarding PDO mapping Correction of wrong description regarding creation of CoE objects Added hint for creating a fully individual object dictionary of ones own Correction of wrong description of sync output config flag Clarified: Flags D25 and D26 of SII Configuration Flags are currently not supported. Flag D24 is supported and evaluated. EtherCAT Slave | Protocol API DOC050701API17EN | Revision 17 | English | 2012-02 | Released | Public © Hilscher, 2005-2012
Introduction 8/389 Rev 16 (cont.) Date 2011-04-19 RG Name Chapter 4.3 6.3.28 6.3.1 – 6.3.4 6.2.1 6.3.1 5.2.4 6.3.28 6.3.27 5.3.2 5.5.3 5.2.2 4.3 5.2.3 6.3.17 5.1.3 1.6, 4.3 6.5 6.6 4.11 5.2.5 5.2.2 Revision SDO, AP, IDN, SoE Configuration flags currently not implemented Added missing definition of SSC Some smaller changes in section ECAT_OD_SDOINFO_GET_ENTRY_DESC_IND/RES – Object Directory Get Description Entry Indication Added missing description of response packets. Also description of data layout for complete object access added. Added missing info on time in which response packet needs to be sent. Subsection ECAT_COE_SEND_EMERGENCY_REQ/CNF – Send CoE Emergency Message has been extended. Corrected range of values Updated and enhanced description of SII. Added description of special case bValueInfo = 0 in ECAT_OD_SDOINFO_GET_ENTRY_DESC_IND. Corrected packet length of ECAT_OD_SDOINFO_GET_OBJ_DESC_IND updated ECAT_MBX_STARTUPPARAMETER_T updated ECAT_SDO_STARTUPPARAMETER_T updated ECAT_ESM_STARTUPPARAMETER_T Added section “Object dictionary behavior” Added remark: No indications are sent when switching downwards Added Table 184: Correspondence of SDO Abort Codes and Status/Error Code Added new section “Kinds of Object Access” on object handling for clarification Clarified Process Data Input and Output Data Length Specifications in sections “Specifications” and “Warmstart Parameters”. Firmware/stack version V2.5.24 Reference to netX Dual-Port Memory Interface Manual Revision 12 New section “The ECAT_FOE Task of the FoE Stack” New section “The ECAT_EOE Task of the EoE Stack” New section “Configuration Issues for LOM Mode” New subsection “Boot State Support/Configuration for Variable Mailbox Size” Additional information 17 2012-02-13 RG Table 1: List of Revisions EtherCAT Slave | Protocol API DOC050701API17EN | Revision 17 | English | 2012-02 | Released | Public © Hilscher, 2005-2012
分享到:
收藏