Sam Grove / Mbed 2 deprecated canopen_slavenode

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Service Data Object (SDO)

Service Data Object (SDO)
[Communication Objects]

SDOs provide the access to entries in the CANopen Object Dictionary. More...

Functions

UNS8 writeNetworkDict (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS32 count, UNS8 dataType, void *data)
 Used to send a SDO request frame to write the data at the index and subIndex indicated.
UNS8 writeNetworkDictCallBack (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback)
 Used to send a SDO request frame to write in a distant node dictionnary.
UNS8 writeNetworkDictCallBackAI (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 endianize)
 Used to send a SDO request frame to write in a distant node dictionnary.
UNS8 readNetworkDict (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType)
 Used to send a SDO request frame to read.
UNS8 readNetworkDictCallback (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, SDOCallback_t Callback)
 Used to send a SDO request frame to read in a distant node dictionnary.
UNS8 readNetworkDictCallbackAI (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, SDOCallback_t Callback)
 Used to send a SDO request frame to read in a distant node dictionnary.
UNS8 getReadResultNetworkDict (CO_Data *d, UNS8 nodeId, void *data, UNS32 *size, UNS32 *abortCode)
 Use this function after calling readNetworkDict to get the result.
UNS8 getWriteResultNetworkDict (CO_Data *d, UNS8 nodeId, UNS32 *abortCode)
 Use this function after calling writeNetworkDict function to get the result of the write.

Detailed Description

SDOs provide the access to entries in the CANopen Object Dictionary.

An SDO is made up of at least two CAN messages with different identifiers. SDO s are always confirmed point-to-point communications services.


Function Documentation

UNS8 getReadResultNetworkDict ( CO_Data d,
UNS8  nodeId,
void *  data,
UNS32 *  size,
UNS32 *  abortCode 
)

Use this function after calling readNetworkDict to get the result.

Parameters:
*dPointer to a CAN object data structure
nodeIdNode Id of the slave
*dataPointer to the datas
*sizePointer to the size
*abortCodePointer to the abortcode. (0 = not available. Else : SDO abort code. (received if return SDO_ABORTED_RCV)
Returns:
  • SDO_FINISHED // datas are available
  • SDO_ABORTED_RCV // Transfert failed (abort SDO received)
  • SDO_ABORTED_INTERNAL // Transfert failed (internal abort)
  • SDO_UPLOAD_IN_PROGRESS // Datas are not yet available
  • SDO_DOWNLOAD_IN_PROGRESS // Download is in progress

    example :
     UNS32 data;
     UNS8 size;
     readNetworkDict(0, 0x05, 0x1016, 1, 0) // get the data index 1016 subindex 1 of node 5
     while (getReadResultNetworkDict (0, 0x05, &data, &size) == SDO_UPLOAD_IN_PROGRESS);
    
Parameters:
d
nodeId
data
sizepointer to expected size, changed into returned size. Expected size will be truncated to transfered data size
abortCode
Returns:

Definition at line 1783 of file sdo.c.

UNS8 getWriteResultNetworkDict ( CO_Data d,
UNS8  nodeId,
UNS32 *  abortCode 
)

Use this function after calling writeNetworkDict function to get the result of the write.

It is mandatory to call this function because it is releasing the line used for the transfer.

Parameters:
*dPointer to a CAN object data structure
nodeIdNode Id of the slave
*abortCodePointer to the abortcode

  • 0 = not available.
  • SDO abort code (received if return SDO_ABORTED_RCV)
Returns:
:
  • SDO_FINISHED // datas are available
  • SDO_ABORTED_RCV // Transfert failed (abort SDO received)
  • SDO_ABORTED_INTERNAL // Transfert failed (Internal abort)
  • SDO_DOWNLOAD_IN_PROGRESS // Datas are not yet available
  • SDO_UPLOAD_IN_PROGRESS // Upload in progress

    example :
     UNS32 data = 0x50;
     UNS8 size;
     UNS32 abortCode;
     writeNetworkDict(0, 0x05, 0x1016, 1, size, &data) // write the data index 1016 subindex 1 of node 5
     while (getWriteResultNetworkDict (0, 0x05, &abortCode) == SDO_DOWNLOAD_IN_PROGRESS);
    
Parameters:
d
nodeId
abortCode
Returns:

Definition at line 1852 of file sdo.c.

UNS8 readNetworkDict ( CO_Data d,
UNS8  nodeId,
UNS16  index,
UNS8  subIndex,
UNS8  dataType 
)

Used to send a SDO request frame to read.

Parameters:
*dPointer to a CAN object data structure
nodeIdNode Id of the slave
indexAt index indicated
subIndexAt subIndex indicated
dataType(defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
Returns:
  • 0 is returned upon success.
  • 0xFE is returned when no sdo client to communicate with node.
  • 0xFF is returned when error occurs.
Parameters:
d
nodeId
index
subIndex
dataType
Returns:

Definition at line 1702 of file sdo.c.

UNS8 readNetworkDictCallback ( CO_Data d,
UNS8  nodeId,
UNS16  index,
UNS8  subIndex,
UNS8  dataType,
SDOCallback_t  Callback 
)

Used to send a SDO request frame to read in a distant node dictionnary.

The function Callback which must be defined in the user code is called at the end of the exchange. (on succes or abort).

Parameters:
*dPointer on a CAN object data structure
nodeIdNode Id of the slave
indexAt index indicated
subIndexAt subIndex indicated
dataType(defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
CallbackCallback function
Returns:
  • 0 is returned upon success.
  • 0xFE is returned when no sdo client to communicate with node.
  • 0xFF is returned when error occurs.
Parameters:
d
nodeId
index
subIndex
dataType
Callback
Returns:

Definition at line 1719 of file sdo.c.

UNS8 readNetworkDictCallbackAI ( CO_Data d,
UNS8  nodeId,
UNS16  index,
UNS8  subIndex,
UNS8  dataType,
SDOCallback_t  Callback 
)

Used to send a SDO request frame to read in a distant node dictionnary.

The function Callback which must be defined in the user code is called at the end of the exchange. (on succes or abort). First free SDO client parameter is automatically initialized for specific node if not already defined.

Parameters:
*dPointer on a CAN object data structure
nodeIdNode Id of the slave
indexAt index indicated
subIndexAt subIndex indicated
dataType(defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
CallbackCallback function
Returns:
  • 0 is returned upon success.
  • 0xFF is returned when error occurs.

Definition at line 1724 of file sdo.c.

UNS8 writeNetworkDict ( CO_Data d,
UNS8  nodeId,
UNS16  index,
UNS8  subIndex,
UNS32  count,
UNS8  dataType,
void *  data 
)

Used to send a SDO request frame to write the data at the index and subIndex indicated.

Parameters:
*dPointer to a CAN object data structure
nodeIdNode Id of the slave
indexAt index indicated
subIndexAt subIndex indicated
countnumber of bytes to write in the dictionnary.
dataType(defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
*dataPointer to data
Returns:
  • 0 is returned upon success.
  • 0xFE is returned when no sdo client to communicate with node.
  • 0xFF is returned when error occurs.
Parameters:
d
nodeId
index
subIndex
count
dataType
data
Returns:

Definition at line 1522 of file sdo.c.

UNS8 writeNetworkDictCallBack ( CO_Data d,
UNS8  nodeId,
UNS16  index,
UNS8  subIndex,
UNS32  count,
UNS8  dataType,
void *  data,
SDOCallback_t  Callback 
)

Used to send a SDO request frame to write in a distant node dictionnary.

The function Callback which must be defined in the user code is called at the end of the exchange. (on succes or abort).

Parameters:
*dPointer to a CAN object data structure
nodeIdNode Id of the slave
indexAt index indicated
subIndexAt subIndex indicated
countnumber of bytes to write in the dictionnary.
dataType(defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
*dataPointer to data
CallbackCallback function
Returns:
  • 0 is returned upon success.
  • 0xFE is returned when no sdo client to communicate with node.
  • 0xFF is returned when error occurs.
Parameters:
d
nodeId
index
subIndex
count
dataType
data
Callback
Returns:

Definition at line 1542 of file sdo.c.

UNS8 writeNetworkDictCallBackAI ( CO_Data d,
UNS8  nodeId,
UNS16  index,
UNS8  subIndex,
UNS32  count,
UNS8  dataType,
void *  data,
SDOCallback_t  Callback,
UNS8  endianize 
)

Used to send a SDO request frame to write in a distant node dictionnary.

The function Callback which must be defined in the user code is called at the end of the exchange. (on succes or abort). First free SDO client parameter is automatically initialized for specific node if not already defined.

Parameters:
*dPointer to a CAN object data structure
nodeIdNode Id of the slave
indexAt index indicated
subIndexAt subIndex indicated
countnumber of bytes to write in the dictionnary.
dataType(defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
*dataPointer to data
CallbackCallback function
endianizeWhen not 0, data is endianized into network byte order when 0, data is not endianized and copied in machine native endianness
Returns:
  • 0 is returned upon success.
  • 0xFF is returned when error occurs.

Definition at line 1548 of file sdo.c.