I want to find...

Search

Shares

Table of Content

EthercatDevice.sdoUpload()

[Ethercat Device]

Description

Performs a CoE SDO upload to the specified object for such EtherCAT slave device.

Syntax

int sdoUpload(uint16_t od_index, uint8_t od_subindex, void * data, uint32_t size, uint32_t * abortcode = NULL, bool complete_access = false, uint32_t timeout_us = 100000);

Parameters

  • [in] uint16_t od_index
    Index of the object.
  • [in] uint8_t od_subindex
    Subindex of the object. 0 or 1 if Complete Access.
  • [out] void *data
    The data buffer for reading.
  • [in] uint32_t size
    The size of the data buffer for reading.
  • [out] uint32_t *abortcode
    The pointer of the variable used to store the A.5 SDO Abort Code.
  • [in] bool complete_access
    Use Complete Access or not. The default is false.
  • [in] uint32_t timeout_us
    Timeout in microseconds.

Return Value

Return an error code. If the returned value is zero, it indicates a successful execution of this function.

Comment

This function must be called after a successful execution of EthercatMaster::begin(). This function is blocking and cannot be called within the Cyclic Callback.

Example

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_Generic slave;

uint16_t value;

void setup() {
  Serial.begin(115200);
  
  master.begin();
  slave.attach(0, master);
  master.start(1000000);
}

void loop() {
  slave.sdoUpload(0x6040, 0x00, &value, sizeof(value));
  Serial.print("Value: ");
  Serial.println(value);
  delay(1000);
}

Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.

Leave a Comment

Scroll to Top