Skip to content
Snippets Groups Projects
Commit 74041c27 authored by armar-user's avatar armar-user
Browse files

added readable names in EtherCAT::readErrorCounters() for EtherCAT debugging

parent 53ade223
No related branches found
No related tags found
No related merge requests found
......@@ -722,6 +722,14 @@ void EtherCAT::readErrorCounters()
IceUtil::Time start = IceUtil::Time::now(IceUtil::Time::Monotonic);
for (uint16 slaveIndex = 1; slaveIndex <= *(ecx_context.slavecount); slaveIndex++)
{
std::string name = "Unknown";
AbstractSlavePtr slavePtr = getSlaveAtId(slaveIndex);
if (slavePtr)
{
name = slavePtr->getSlaveIdentifier().humanName;
}
auto ADPh = (uint16)(1 - slaveIndex);
uint16_t configAddr = ecx_APRDw(ecx_context.port, ADPh, ECT_REG_STADR, 100000);
for (int i = 0; i < 4; i++)
......@@ -740,8 +748,9 @@ void EtherCAT::readErrorCounters()
ecx_APRD(ecx_context.port, ADPh, 0x310 + i, 1, &linkLostCounter, 100000);
if (rxError > 0 || invalidFrameCounter > 0 || previousErrorCounter > 0 || linkLostCounter > 0)
{
ARMARX_INFO << "non zero frame error counter found: Slavenumber " << slaveIndex << "\tconfig addr: " << (int)configAddr << ": port " << i << ": "
<< VAROUT((int)rxError) << "\t" << VAROUT((int)invalidFrameCounter) << "\t" << VAROUT((int)previousErrorCounter) << "\t" << VAROUT((int)linkLostCounter);
ARMARX_ERROR << "non zero frame error counter found: Slavenumber " << slaveIndex << "\tname: " << name
<< "\tconfig addr: " << (int)configAddr << ": port " << i << ": "
<< VAROUT((int)rxError) << "\t" << VAROUT((int)invalidFrameCounter) << "\t" << VAROUT((int)previousErrorCounter) << "\t" << VAROUT((int)linkLostCounter);
}
}
if ((IceUtil::Time::now(IceUtil::Time::Monotonic) - start).toMilliSeconds() > 10)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment