ioctl blocked and Etherlab Ethercat Master Activate not working

49 views Asked by At

I'm trying to migrate my robot program based on ethercat system to another computer. I installed rt kernel, xenomai and ethercat master build by etherlab. I connected all the motor drivers with network cables. And I started my communication program. It started and work for a few steps. But when it try to activate master it was waiting for something infinitely. I tried to stop it by using ctrl+c and kill commands. But it didn't stop.

And I checked what the program is doing by htop and it said that the process is waiting for disk I/O.

PID   USER   PRI   NI   VIRT   RES   SHR   S   CPU%   MEM%   TIME+   Command
2248  root   20    0    14364  3304  3088  D   0.7    0.0    0:04.23 ./ethercatdaemon

I added some logs to find out where is the problem point, and I found that ioctl command blocked. I can't find the reason why it blocked.

This is the code where I called ioctl function.

int ecrt_master_activate(ec_master_t *master)
{
    fprintf(stderr,"function inside==================");
    ec_ioctl_master_activate_t io;
    fprintf(stderr,"io declare");
    int ret;
    fprintf(stderr,"before ioctl");
    ret = ioctl(master->fd, EC_IOCTL_ACTIVATE, &io);
    fprintf(stderr,"after ioctl");
    if (EC_IOCTL_IS_ERROR(ret)) {
        fprintf(stderr, "Failed to activate master: %s\n",
                strerror(EC_IOCTL_ERRNO(ret)));
        return -EC_IOCTL_ERRNO(ret);
    }

And this is the system log of my program. I skipped slave connection log. Because It's too long.

Shutting down EtherCAT master 1.5.2  done
Starting EtherCAT master 1.5.2  done
CEtherCATApp.cpp [Start] : ComponentManager Init...
[shared memory] Initialize nKey : 1975 nDataSize : 7296
[shared memory] Shared ID : 32802 Shared Pointer : 0x7f66f1a3f000
CEtherCATApp.cpp [CreateSharedMemory] : Component Count : 128, 0x5631416e7748
CEtherCATApp.cpp [Start] : Master Device Init...
CMaster.cpp [RequestDeviceIndexer] : request master...
requestmaster inside ===============================
CMaster.cpp [RequestDeviceIndexer] : master handle [0x5631416e8d38]
CMaster.cpp [ScanSlave] : scan slaves...
CMaster.cpp [ConnectSlave] : connect slave...
CSlaveManager.cpp [Run] : Run Thread...
CMaster.cpp [Activate] : Activate...
m_pmaster0x5631416e92d0
function inside==================
io declare
before ioct

I don't know why it blocked. Is there anything that I should configure or install?

0

There are 0 answers