Jump to content
OMRON Forums

How do I know when an "ethercat rescan" system command has finished?


Recommended Posts

When configuring PDOs on my EtherCAT network, I'm often required to issue the system command "ethercat rescan". This rescans the EtherCAT network such that the new PDOs become mappable.


However, there is not a good mechanism that I'm aware of for determining when the rescan command has finished. Because of this, we are forced to put timers into our code that wait for some arbitrary amount of time before we try mapping the PDOs.


Using timers like this is obvious bad practice and slows down our start-up process, however, I don't know of another way to monitor when the rescan command has completed.


Is there a preferred method for determining when the rescan has finished?

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Is there a reason you need to programmatically perform an ecat reset (or ethercat rescan) before mapping PDOs? Normally we would save the project with this already done. Perhaps you mean enable ethercat with ECAT[0].Enable=1 and you just want to make sure the network is present first?


I support legacy code in which all EtherCAT variables are mapped in the following manner:


ECAT[master].IO[io_index].Slave = position;

ECAT[master].IO[io_index].Index = index;

ECAT[master].IO[io_index].SubIndex = $1;

ECAT[master].IO[io_index].BitLength = 1;

ECAT[master].IO[io_index].Input = 1;


However, some EtherCAT slave devices require their PDOs to be changed whenever a power cycle occurs. One of our drives for example doesn't broadcast certain information unless we write certain SDOs.


What this means for us is that certain PDOs are not mappable until we write new SDOs. Once we configure the SDOs, it is necessary to perform an "ethercat rescan", otherwise, the PMAC won't let us map to the new PDOs.


Essentially I need to wait for the ethercat rescan command to finish prior to trying to map certain PDOs when starting our machine.

Link to comment
Share on other sites

  • 2 weeks later...

The “ethercat” function is not a Power PMAC documented feature. This is provided by the “stack” manufacturer EtherLab. It was not intended for “direct” customer use.


Having said that, “exec”ing or “fork”ing to the function and waiting for its return value would be one way to do this. You could also use the Linux “time” command to wait for it to complete.

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Create New...