EtherCAT SubDevice
 
Loading...
Searching...
No Matches
Configuration of the Process Data

Process Data is exchanged cyclically with the EtherCAT MainDevice. Process Data Objects (PDO) are objects from the object dictionary mapped as process data. Therefore, the object dictionary must be configured before configuring the process data objects.

PDO configuration example

A PDO is an object filled with PDO entries. These entries are objects from the object dictionary which can be mapped as PDO. Therefore, there are few things to consider.

Therefore, it's not possible to map an object only with OBJACCESS_RXPDOMAPPING flag in a PDO with Index 0x1A00 to 0x1BFF and vice versa.

Examples

Create a RxPDO and map an entry from array object entry from CoE Examples to the PDO.

EC_API_SLV_SHandle_t* ptSlave = pApplicationInstance_p->ptEcSlvApi;
EC_API_SLV_SCoE_ObjEntry_t* ptObjEntry = NULL;
EC_API_SLV_SPdo_t* ptRxPdo1600 = NULL;
error = (EC_API_EError_t)EC_API_SLV_PDO_create(ptSlave, "RxPDO", 0x1600, &ptRxPdo1600);
error = (EC_API_EError_t)EC_API_SLV_CoE_getObjectEntry(ptSlave, 0x2100, 1, &ptObjEntry);
error = (EC_API_EError_t)EC_API_SLV_PDO_createEntry(ptSlave, ptRxPdo1600, "SubIndex 001", ptObjEntry);
uint32_t EC_API_SLV_CoE_getObjectEntry(EC_API_SLV_SHandle_t *pHandle, uint16_t index, uint8_t subIndex, EC_API_SLV_SCoE_ObjEntry_t **ppObjectEntry)
This function returns object entries from the Object Dictionary.
Definition ecSlvApi_CoE.c:661
@ EC_API_eERR_INVALID
Definition ecSlvApiDef_error.h:48
enum EC_API_EError EC_API_EError_t
uint32_t EC_API_SLV_PDO_create(EC_API_SLV_SHandle_t *pHandle, char *pName, uint16_t mapIndex, EC_API_SLV_Pdo_t **pOutPdo)
Creates an empty PDO.
Definition ecSlvApi_pdo.c:416
uint32_t EC_API_SLV_PDO_createEntry(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_Pdo_t *pPdo, char *pName, EC_API_SLV_SCoE_ObjEntry_t *pObjEntry)
This function maps an object entry from the Object Dictionary as a PDO.
Definition ecSlvApi_pdo.c:827
Definition ecSlvApiInternal.h:129
Definition ecSlvApiInternal.h:331

Help functions

The EtherCAT SDK provides with a set of functions to access the process data. These help functions are available with the _PDO_ suffix. For further information please refer to the documentation.

Function Description
EC_API_SLV_PDO_get Get object from PDO list
EC_API_SLV_PDO_getOffset Get PDO offset in process data
EC_API_SLV_PDO_getLength Get PDO length
EC_API_SLV_getInputProcDataLength Get input process data length
EC_API_SLV_getOutputProcDataLength Get output process data length
EC_API_SLV_PDO_getEntryCount Get PDO entry count
EC_API_SLV_PDO_getEntryDataLength Get entry data length
EC_API_SLV_setInputData Write input process data
EC_API_SLV_getOutputData Read output process data
EC_API_SLV_PDO_setData Set PDO data
EC_API_SLV_PDO_getData Get PDO data
EC_API_SLV_PDO_setEntryData Set PDO entry data
EC_API_SLV_PDO_getEntryData Get PDO entry data
EC_API_SLV_PDO_setFixed Define if PDO entries adjustable or not
EC_API_SLV_PDO_enable Enable PDO from process data mapping
EC_API_SLV_PDO_disable Disable PDO from process data mapping
EC_API_SLV_PDO_enabled Check PDO status
EC_API_SLV_PDO_setAssignment Define if SyncManager content is adjustable or not
EC_API_SLV_PDO_addPadding Add padding to process data to avoid alignment issues
EC_API_SLV_PDO_registerAssignmentChanges Process data reconfiguration after change on SyncManager assignments
EC_API_SLV_PDO_registerMappingChanges Process data reconfiguration after changes on PDO mapping
EC_API_SLV_PDO_getMappingInfo Get PDO mapping information
EC_API_SLV_PDO_getAssignmentInfo Get SyncManager assignment information
EC_API_SLV_PDO_setMaxSubIndex Set maximum subIndex for unfixed PDOs
EC_API_SLV_PDO_setSyncManMaxSubIndex Set SyncManager maximum subIndex if assignment is allowed

Process Data Size

By default the process data size is limited to 1024 bytes. Below are the steps to be followed to increase the process data size to 2048 bytes as an example.

  • Update the maximum process data size in the project.h file.
#define EC_MAX_PD_LEN 2048
  • Update the user memory address of the ESC in ecat_def.h.
#define MAX_PD_WRITE_ADDRESS        0x4FFF
#define MAX_PD_READ_ADDRESS         0x4FFF
// Process Data Size
#define MAX_PD_INPUT_SIZE           0x800
#define MAX_PD_OUTPUT_SIZE          0x800
#define MAX_MBX_WRITE_ADDRESS       0x4FFF
#define MAX_MBX_READ_ADDRESS        0x4FFF
  • Update the ESI file.
<Sm StartAddress="#x1800" ControlByte="#x64" Enable="1">Outputs</Sm>
<Sm StartAddress="#x3000" ControlByte="#x20" Enable="1">Inputs</Sm>
  • Add the required TxPDOs/RxPDOs in ecSlvSimple.c and ecSlvSimple.h files.
  • Increase the heap memory size in syscfg if necessary.