Hi everyone,
we need to read (and write) acyclical CoE objects to configure some motion controllers.
In this example we try to read the object with index 0x6041 of type U16
First we tried a request via the GUI and received the expected response. The request looks like this:
{
"request": {
"addressType": "fixedphysical",
"address": 1003,
"objectIndex": 24641,
"subIndex": 0,
"flags": "noFlags",
"data": [],
"maxLength": 2
}
}
But when we try to do the apparently same request in our C++ application we always get a "DL_TYPE_MISMATCH". We build the flatbuffer as follows:
#include "comm/ethercat/master/fbs/sdo_generated.h"
// ...
flatbuffers::FlatBufferBuilder flatBufferBuilder = flatbuffers::FlatBufferBuilder();
std::vector<uint8_t> data;
data.resize(2);
auto requestData = flatBufferBuilder.CreateVector<uint8_t>(data);
auto sdoRequest = comm::ethercat::master::fbs::CreateSDORequest(flatBufferBuilder,
comm::ethercat::master::fbs::Addresstype::Addresstype_fixedphysical,
1003, // ethercat slave address
24641, // object index 0x6041
0, // sub index 0
comm::ethercat::master::fbs::SDOFlags::SDOFlags_noFlags,
requestData,
2);
auto sdo = comm::ethercat::master::fbs::CreateSDO(flatBufferBuilder, sdoRequest);
flatBufferBuilder.Finish(sdo);
comm::datalayer::Variant payload;
auto variantResult = payload.copyFlatbuffers(flatBufferBuilder);
// ...
and do an asynchronous read:
// DataLayerClient_ is an initialized comm::datalayer::IClient
auto result = DataLayerClient_->readAsync("fieldbuses/ethercat/master/instances/ethercatmaster/device_access/coe/sdo",
payload,
[](comm::datalayer::DlResult result, const comm::datalayer::Variant *data)
{
if (comm::datalayer::STATUS_FAILED(result)) // here we get the DL_TYPE_MISMATCH
{
TRACE_MSG("Datalayer Read failed: %s", result.toString());
}
else
{
// ...
}
});
We already tried several variations of the flatbuffer (e.g. different sized data, omitting the data, ..) but always get a DL_TYPE_MISMATCH.
What might be the reason for this Error? How can we fix it?
Is there any additional documentation of the Datalayer Interface of the EthercatMasterApp? All our information is based on the read-/write-type descriptions in the Datalayer itself.
Best Regards,
Chris
(The ctrlX is running on RM21.11 with SDK 1.12.0)