Beckhoff / CCAT

Beckhoff CCAT FPGA Kernel mode driver to run EtherCAT Master on CX devices
Other
34 stars 16 forks source link

Polling eats up significant cpu time #1

Closed zakharov closed 8 years ago

zakharov commented 8 years ago

Hello All.

Thanks a lot for linux implementation of ccat driver.

I noticed that the driver eats up a lot of resources because of polling (~30 - 40% on CX5020). Are there plans to add interrupts support instead of polling mechanism? Or may be there is a way to synchronize polling time with ethercat cycle? How do you do it in Twincat?

best regards, Alexey

HWilke commented 8 years ago

Hi Alexey,

currently we do not support interrupts because our architecture and the EtherCAT system in general is based on a cyclic interval which you should define during setup or initialization. The reason is that our system should be capable to run in deterministic real-time which is not possible if you have interrupts. So you should think about your minimum cycle time which your application needs and use this for cyclic update of the EtherCAT bus. Before your application code runs you should run an EtherCAT update (poll). Then your application code runs. Thereafter you can run an EtherCAT Update again or you just wait for the next cycle which updates the EtherCAT bus. That's how we do it in TwinCAT.

Regards Heiko

HWilke commented 8 years ago

Addition:

Take a look at EtherLab [1] and our driver patch [2], to see how polling is synchronized to the EtherCAT cycle.

[1] http://etherlab.org/en/ethercat/index.php [2] https://github.com/Beckhoff/CCAT/blob/master/etherlab.bundle

zakharov commented 8 years ago

Thanks a lot for your answer Heiko.

Sorry for dumb question, but what is this bundle file?

I already started to look into Etherlab master, it has another version of CCAT driver (probably earlier version), which is possible to use without network stack, but directly with etherlab master. This solution seems to reduce load significantly. Problem is that it doesn't start reliably. I was wondering if it makes sense to update your latest generic CCAT driver with etherlab api and check if it is more stable?

best regards, Alexey

pbruenn commented 8 years ago

Hi Alexey, you can use the bundle to upgrade your local etherlab repository

hg clone http://hg.code.sf.net/p/etherlabmaster/code ethercat-hg pushd ethercat-hg/ hg update stable-1.5 wget https://github.com/Beckhoff/CCAT/raw/master/etherlab.bundle hg unbundle etherlab.bundle hg update ./bootstrap

zakharov commented 8 years ago

Thank! I'll try that.