9.8. CAN application protocol over EtherCAT® (CoE)
The EC-Monitor can forward CoE transfers to the application in real time via the notifications emonNotify - eMbxTferType_COE_SDO_DOWNLOAD, emonNotify - eMbxTferType_COE_SDO_UPLOAD and emonNotify - eMbxTferType_COE_EMERGENCY.
There is also the option of storing the recorded data from the CoE transfers in an internal object dictionary.
This object dictionary is structured analogously to that from the slaves and can be read out via the functions emonCoeSdoUpload()
/ emonCoeSdoUploadReq()
and emonCoeGetODListReq()
.
The notifications for CoE can be deactivated using the EC_T_MBX_PARMS_COE::bDisableNotifications
parameter if they are not required or to save computing time.
In order to reduce memory consumption, the internal memory for the CoE data can be deactivated using the EC_T_MBX_PARMS_COE::bDisableODStorage
parameter.
If both parameters EC_T_MBX_PARMS_COE::bDisableNotifications
and EC_T_MBX_PARMS_COE::bDisableODStorage
are set, the CoE monitoring is completely deactivated.
9.8.1. emonNotify - eMbxTferType_COE_SDO_DOWNLOAD
SDO download transfer completion.
- emonNotify - eMbxTferType_COE_SDO_DOWNLOAD
- Parameter
pbyInBuf
: [in] Pointer to a structure of type EC_T_MBXTFER, this structure contains the corresponding mailbox transfer object.dwInBufSize
: [in] Size of the transfer object pbyInBuf in bytes.pbyOutBuf
: [out] Should be set to EC_NULLdwOutBufSize
: [in] Should be set to 0pdwNumOutData
: [out] Should be set to EC_NULL
The transfer result is stored in EC_T_MBXTFER::dwErrorCode
. The request parameters stored in element EC_T_MBX_DATA::CoE
of type EC_T_MBX_DATA_COE
are part of EC_T_MBXTFER::MbxData
.
The SDO data stored in EC_T_MBXTFER::pbyMbxTferData
.
9.8.2. emonNotify - eMbxTferType_COE_SDO_UPLOAD
SDO upload transfer completion.
- emonNotify - eMbxTferType_COE_SDO_UPLOAD
- Parameter
pbyInBuf
: [in] Pointer to a structure of type EC_T_MBXTFER, contains the corresponding mailbox transfer object.dwInBufSize
: [in] Size of the transfer object in bytes.pbyOutBuf
: [out] Should be set to EC_NULLdwOutBufSize
: [in] Should be set to 0pdwNumOutData
: [out] Should be set to EC_NULL
The transfer result is stored in EC_T_MBXTFER::dwErrorCode
. The request parameters stored in element EC_T_MBX_DATA::CoE
of type EC_T_MBX_DATA_COE
are part of EC_T_MBXTFER::MbxData
.
The SDO data stored in EC_T_MBXTFER::pbyMbxTferData
.
9.8.3. CoE Emergency (emonNotify - eMbxTferType_COE_EMERGENCY)
Indication of a CoE emergency request. A emonNotify - EC_NOTIFY_MBOXRCV is given with EC_T_MBXTFER::eMbxTferType
= EC_T_MBXTFER_TYPE::eMbxTferType_COE_EMERGENCY
.
- emonNotify - eMbxTferType_COE_EMERGENCY
- Parameter
pbyInBuf
: [in] Pointer to a structure of type EC_T_MBXTFER, contains the corresponding mailbox transfer object.dwInBufSize
: [in] Size of the transfer object in bytes.pbyOutBuf
: [out] Should be set to EC_NULLdwOutBufSize
: [in] Should be set to 0pdwNumOutData
: [out] Should be set to EC_NULL
In case of an emergency notification all registered clients will get this notification.
The corresponding mailbox transfer object will be created. EC_T_MBXTFER::dwTferId
is undefined as it is not needed by the client.
The transfer result is stored in EC_T_MBXTFER::dwErrorCode
.
The emergency data stored in element EC_T_MBX_DATA::CoE_Emergency
of type EC_T_COE_EMERGENCY
is part of EC_T_MBXTFER::MbxData
and may have to be buffered by the client.
Access to the memory area EC_T_MBXTFER::MbxData
outside of the notification caller context is illegal and the results are undefined.
See also
A more detailed description of the values can be found in the EtherCAT® specification ETG.1000, section 5.
9.8.4. emonCoeSdoUpload
-
EC_T_DWORD emonCoeSdoUpload(EC_T_DWORD dwInstanceID, EC_T_DWORD dwSlaveId, EC_T_WORD wObIndex, EC_T_BYTE byObSubIndex, EC_T_BYTE *pbyData, EC_T_DWORD dwDataLen, EC_T_DWORD *pdwOutDataLen, EC_T_DWORD dwTimeout, EC_T_DWORD dwFlags)
Execute a CoE SDO upload from an EtherCAT slave device to the master.
This function may not be called from within the JobTask’s context.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
dwSlaveId – [in] Slave ID
wObIndex – [in] Object index
byObSubIndex – [in] Object SubIndex. If Complete Access only 0 or 1 allowed
pbyData – [out] Buffer receiving transferred data
dwDataLen – [in] Buffer length in bytes
pdwOutDataLen – [out] Length of received data in bytes
dwTimeout – [in] Timeout [ms]
dwFlags – [in] Mailbox Flags. Bit 0: set if Complete Access (EC_MAILBOX_FLAG_SDO_COMPLETE).
- Returns
EC_E_NOERROR if successful
EC_E_INVALIDSTATE if master isn’t initialized
EC_E_INVALIDPARM if dwInstanceID is out of range, the input pointer is EC_NULL or contains EC_NULL pointer, or dwTimeout is EC_NOWAIT
EC_E_NOMEMORY if the mailbox protocol queue of the slave if full
EC_E_SLAVE_NOT_PRESENT if slave not present
EC_E_NOTFOUND if no slave matching dwSlaveId can be found
EC_E_NO_MBX_SUPPORT if slave has no mailbox support
EC_E_INVALID_SLAVE_STATE if slave is in an invalid state for mailbox transfer
EC_E_MASTER_RED_STATE_INACTIVE if Master Redundancy is configured and master is inactive
EC_E_ADS_IS_RUNNING if ADS server is running
Limitation
Only CoE entries which have been received by the EcMonitor can be retrieved
CoE objects read via complete access, can only be retrieved as complete access.
When switching between complete access and access via subindex the corresponding CoE object is overwritten.
See also
9.8.5. emonCoeSdoUploadReq
-
EC_T_DWORD emonCoeSdoUploadReq(EC_T_DWORD dwInstanceID, EC_T_MBXTFER *pMbxTfer, EC_T_DWORD dwSlaveId, EC_T_WORD wObIndex, EC_T_BYTE byObSubIndex, EC_T_DWORD dwTimeout, EC_T_DWORD dwFlags)
Initiates a CoE SDO upload from an EtherCAT slave device to the master and returns immediately.
The length of the data to be uploaded must be set in EC_T_MBXTFER.dwDataLen. A unique transfer ID must be written into EC_T_MBXTFER.dwTferId. EC_NOTIFY_MBOXRCV is given on completion.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
pMbxTfer – [in] Mailbox transfer object created with emMbxTferCreate
dwSlaveId – [in] Slave ID
wObIndex – [in] Object Index
byObSubIndex – [in] Object SubIndex. If Complete Access only 0 or 1 allowed
dwTimeout – [in] Timeout [ms]
dwFlags – [in] Mailbox Flags. Bit 0: set if Complete Access (EC_MAILBOX_FLAG_SDO_COMPLETE).
- Returns
EC_E_NOERROR if successful
EC_E_INVALIDSTATE if master isn’t initialized
EC_E_INVALIDPARM if dwInstanceID is out of range, the input pointer is EC_NULL or contains EC_NULL pointer, or dwTimeout is EC_NOWAIT
EC_E_NOMEMORY if the mailbox protocol queue of the slave if full
EC_E_SLAVE_NOT_PRESENT if slave not present
EC_E_NOTFOUND if no slave matching dwSlaveId can be found
EC_E_NO_MBX_SUPPORT if slave has no mailbox support
EC_E_INVALID_SLAVE_STATE if slave is in an invalid state for mailbox transfer
EC_E_MASTER_RED_STATE_INACTIVE if Master Redundancy is configured and master is inactive
EC_E_ADS_IS_RUNNING if ADS server is running
Limitation
Only CoE entries which have been received by the EC-Monitor can be retrieved
CoE objects read via complete access, can only be retrieved as complete access.
When switching between complete access and access via subindex, the corresponding CoE object is overwritten.
9.8.6. emonIoControl - EC_IOCTL_MONITOR_SET_COESDO_CLEAR_ON_READ
This IO control can be used to activate a clear on read of the CoE SDO data. If clear on read is activated, the data is automatically deleted after each read of the CoE SDO index, subindex via emonCoeSdoUpload()
or emonCoeSdoUploadReq()
. The IO-Control must be called after emonConfigureNetwork()
.
- emonIoControl - EC_IOCTL_MONITOR_SET_COESDO_CLEAR_ON_READ
- Parameter
pbyInBuf
: [in] Pointer to value of EC_T_BOOL. EC_TRUE: Enables clear on read.dwInBufSize
: [in] Size of the input buffer provided at pbyInBuf in bytes.pbyOutBuf
: [out] Should be set to EC_NULLdwOutBufSize
: [in] Should be set to 0pdwNumOutData
: [out] Should be set to EC_NULL
9.8.7. emonCoeGetODListReq
-
EC_T_DWORD emonCoeGetODListReq(EC_T_DWORD dwInstanceID, EC_T_MBXTFER *pMbxTfer, EC_T_DWORD dwSlaveId, EC_T_COE_ODLIST_TYPE eListType, EC_T_DWORD dwTimeout)
Gets a list of object IDs that have so far been transferred to a slave and received by the EC-Monitor.
This function may not be called from within the JobTask’s context.
Note
The mailbox transfer object will receive the slave response containing the list type followed by the list itself. Therefore the buffer must be 2 bytes bigger than the expected list size.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
pMbxTfer – [in] Mailbox transfer
dwSlaveId – [in] Slave ID
eListType – [in] which object types shall be transferred
dwTimeout – [in] Timeout [ms]. The function will block at most for this time. If the timeout value is set to EC_NOWAIT the function will return immediately.
- Returns
EC_E_NOERROR if successful
EC_E_INVALIDSTATE if master isn’t initialized
EC_E_INVALIDPARM if dwInstanceID is out of range, the input pointer is EC_NULL or contains EC_NULL pointer, or dwTimeout is EC_NOWAIT
EC_E_NOMEMORY if the mailbox protocol queue of the slave if full
EC_E_SLAVE_NOT_PRESENT if slave not present
EC_E_NOTFOUND if no slave matching dwSlaveId can be found
EC_E_NO_MBX_SUPPORT if slave has no mailbox support
EC_E_INVALID_SLAVE_STATE if slave is in an invalid state for mailbox transfer
EC_E_MASTER_RED_STATE_INACTIVE if Master Redundancy is configured and master is inactive
EC_E_ADS_IS_RUNNING if ADS server is running
See also
9.8.8. emonNotify - eMbxTferType_COE_GETODLIST
Notification of a detected CoE SDO information service transfer for a object dictionary list.
- emonNotify - eMbxTferType_COE_GETODLIST
- Parameter
pbyInBuf
: [in] Pointer to a structure of type EC_T_MBXTFER.dwInBufSize
: [in] Size of the transfer object in bytes.pbyOutBuf
: [out] Should be set to EC_NULLdwOutBufSize
: [in] Should be set to 0pdwNumOutData
: [out] Should be set to EC_NULL
The transfer result is stored in EC_T_MBXTFER::dwErrorCode
.
The object list stored in element EC_T_MBX_DATA::CoE_ODList
of type EC_T_COE_ODLIST
is part of EC_T_MBXTFER::MbxData
and may have to be buffered by the client.
Access to the memory area EC_T_MBXTFER::MbxData
outside of the notification caller context is illegal and the results are undefined.
-
struct EC_T_COE_ODLIST
Public Members
-
EC_T_COE_ODLIST_TYPE eOdListType
list type
-
EC_T_COE_ODLIST_TYPE eOdListType
9.8.9. emonNotify - eMbxTferType_COE_GETENTRYDESC
Notification of a detected CoE SDO information service transfer for a object entry description.
- emonNotify - eMbxTferType_COE_GETENTRYDESC
- Parameter
pbyInBuf
: [in] Pointer to a structure of type EC_T_MBXTFER.dwInBufSize
: [in] Size of the transfer object in bytes.pbyOutBuf
: [out] Should be set to EC_NULLdwOutBufSize
: [in] Should be set to 0pdwNumOutData
: [out] Should be set to EC_NULL
The transfer result is stored in EC_T_MBXTFER::dwErrorCode
.
The object entry description stored in element EC_T_MBX_DATA::CoE_EntryDesc
of type EC_T_COE_ENTRYDESC
is part of EC_T_MBXTFER::MbxData
and may have to be buffered by the client.
Access to the memory area EC_T_MBXTFER::MbxData
outside of the notification caller context is illegal and the results are undefined.
-
struct EC_T_COE_ENTRYDESC
Public Members
-
EC_T_BYTE byValueInfo
Bit mask which information is included in pbyData. See Value info flags
-
EC_T_BYTE byObAccess
Access rights. See Object access flags
-
EC_T_BYTE byValueInfo
Value info flags
Object access flags
See also
A more detailed description of the values can be found in the EtherCAT® specification ETG.1000, section 5 and 6.