libethercat - an embeddable realtime EtherCAT-master library
Communicate with EtherCAT slaves attached to a Network interface.
Loading...
Searching...
No Matches
Servodrive over EtherCAT (SoE)

Data Structures

struct  ec_soe
 
struct  ec_soe_idn_attribute
 ServoDrive attributes of an IDN. More...
 

Typedefs

typedef struct ec_soe ec_soe_t
 SoE mailbox struct type.
 
typedef struct PACKED ec_soe_idn_attribute ec_soe_idn_attribute_t
 ServoDrive attributes of an IDN.
 

Enumerations

enum  ec_soe_element {
  EC_SOE_DATASTATE = 0x01 , EC_SOE_NAME = 0x02 , EC_SOE_ATTRIBUTE = 0x04 , EC_SOE_UNIT = 0x08 ,
  EC_SOE_MIN = 0x10 , EC_SOE_MAX = 0x20 , EC_SOE_VALUE = 0x40 , EC_SOE_DEFAULT = 0x80
}
 ServoDrive elements of an IDN. More...
 

Functions

void ec_soe_init (ec_t *pec, osal_uint16_t slave)
 initialize SoE structure
 
void ec_soe_deinit (ec_t *pec, osal_uint16_t slave)
 deinitialize SoE structure
 
void ec_soe_enqueue (ec_t *pec, osal_uint16_t slave, pool_entry_t *p_entry)
 Enqueue SoE message received from slave.
 
int ec_soe_read (ec_t *pec, osal_uint16_t slave, osal_uint8_t atn, osal_uint16_t idn, osal_uint8_t *elements, osal_uint8_t *buf, osal_size_t *len)
 Read elements of soe ID number.
 
int ec_soe_write (ec_t *pec, osal_uint16_t slave, osal_uint8_t atn, osal_uint16_t idn, osal_uint8_t elements, osal_uint8_t *buf, osal_size_t len)
 Write elements of soe ID number.
 
int ec_soe_generate_mapping (ec_t *pec, osal_uint16_t slave)
 Generate sync manager process data mapping via soe.
 

Detailed Description

This modules contains EtherCAT SoE mailbox functions.

Enumeration Type Documentation

◆ ec_soe_element

ServoDrive elements of an IDN.

Enumerator
EC_SOE_DATASTATE 

idn data state

EC_SOE_NAME 

idn name

EC_SOE_ATTRIBUTE 

idn attributes

EC_SOE_UNIT 

idn unit

EC_SOE_MIN 

idn minimum value

EC_SOE_MAX 

idn maximum value

EC_SOE_VALUE 

idn value

EC_SOE_DEFAULT 

idn data/default

Function Documentation

◆ ec_soe_deinit()

void ec_soe_deinit ( ec_t pec,
osal_uint16_t  slave 
)

deinitialize SoE structure

Parameters
[in]pecPointer to ethercat master structure, which you got from ec_open.
[in]slaveNumber of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached).

◆ ec_soe_enqueue()

void ec_soe_enqueue ( ec_t pec,
osal_uint16_t  slave,
pool_entry_t p_entry 
)

Enqueue SoE message received from slave.

Parameters
[in]pecPointer to ethercat master structure, which you got from ec_open.
[in]slaveNumber of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached).
[in]p_entryPointer to pool entry containing received mailbox message from slave.

◆ ec_soe_generate_mapping()

int ec_soe_generate_mapping ( ec_t pec,
osal_uint16_t  slave 
)

Generate sync manager process data mapping via soe.

This calculates the sync managers size according to the slave's ServoDrive configuration. Therefore it reads IDN 16 and IDN 24 to calculate the sync manager 2/3 sizes.

Parameters
[in]pecPointer to ethercat master structure, which you got from ec_open.
[in]slaveNumber of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached).
Return values
EC_OKSoE transfer was successfull.
EC_ERROR_MAILBOX_TIMEOUTGot timeout waiting for message.
EC_ERROR_MAILBOX_NOT_SUPPORTED_SOENo SoE support on slave's mailbox.
EC_ERROR_MAILBOX_OUT_OF_WRITE_BUFFERSNo more free write buffer available.

◆ ec_soe_init()

void ec_soe_init ( ec_t pec,
osal_uint16_t  slave 
)

initialize SoE structure

Parameters
[in]pecPointer to ethercat master structure, which you got from ec_open.
[in]slaveNumber of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached).

◆ ec_soe_read()

int ec_soe_read ( ec_t pec,
osal_uint16_t  slave,
osal_uint8_t  atn,
osal_uint16_t  idn,
osal_uint8_t *  elements,
osal_uint8_t *  buf,
osal_size_t *  len 
)

Read elements of soe ID number.

This reads all ID number elements from given EtherCAT slave's drive number. This function enables read access to the ServoDrive dictionary on SoE enabled devices. The call to ec_soe_read is a synchronous call and will block until it's either finished or aborted.

Parameters
[in]pecPointer to ethercat master structure, which you got from ec_open.
[in]slaveNumber of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached).
[in]atnAT number according to ServoDrive Bus Specification. In most cases this will be 0, if you are using a multi-drive device this may be 0,1,... .
[in]idnID number according to ServoDrive Bus Specification. IDN's in range 1...32767 are described in the Specification, IDN's greater 32768 are manufacturer specific.
[in,out]elementsServoDrive elements according to ServoDrive Bus Specification.
[in,out]bufBuffer for where to store the answer.
[in,out]lenLength of buf, see 'buf' descriptions. Returns length of answer.
Return values
EC_OKSoE transfer was successfull.
EC_ERROR_MAILBOX_TIMEOUTGot timeout waiting for message.
EC_ERROR_MAILBOX_NOT_SUPPORTED_SOENo SoE support on slave's mailbox.
EC_ERROR_MAILBOX_OUT_OF_WRITE_BUFFERSNo more free write buffer available.

◆ ec_soe_write()

int ec_soe_write ( ec_t pec,
osal_uint16_t  slave,
osal_uint8_t  atn,
osal_uint16_t  idn,
osal_uint8_t  elements,
osal_uint8_t *  buf,
osal_size_t  len 
)

Write elements of soe ID number.

This writes all ID number elements from given EtherCAT slave's drive number. This function enables write access to the ServoDrive dictionary on SoE enabled devices. The call to ec_soe_read is a synchronous call and will block until it's either finished or aborted.

Parameters
[in]pecPointer to ethercat master structure, which you got from ec_open.
[in]slaveNumber of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached).
[in]atnAT number according to ServoDrive Bus Specification. In most cases this will be 0, if you are using a multi-drive device this may be 0,1,... .
[in]idnID number according to ServoDrive Bus Specification. IDN's in range 1...32767 are described in the Specification, IDN's greater 32768 are manufacturer specific.
[in]elementsServoDrive elements according to ServoDrive Bus Specification.
[in]bufBuffer with values to write to the given idn.
[in]lenLength of buf.
Return values
EC_OKSoE transfer was successfull.
EC_ERROR_MAILBOX_TIMEOUTGot timeout waiting for message.
EC_ERROR_MAILBOX_NOT_SUPPORTED_SOENo SoE support on slave's mailbox.
EC_ERROR_MAILBOX_OUT_OF_WRITE_BUFFERSNo more free write buffer available.