Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to connect to ELMxxxx EtherCAT measurement terminals? #67

Open
ToGoOrNotToGo opened this issue Apr 19, 2022 · 5 comments

Comments

@ToGoOrNotToGo
Copy link

Hi,

is it possible to connect to ELMxxxx EtherCAT measurement terminals and acquire signal samples with an application?
https://www.beckhoff.com/en-gb/products/i-o/ethercat-terminals/elmxxxx-measurement-technology/

regards

@Apollo3zehn
Copy link
Owner

In principle it should be possible, as long as you make the ESI file available to EtherCAT.NET.

@ToGoOrNotToGo
Copy link
Author

Hi, first of all thanks for your answer. It took a while, but now I have an ELM3602-0002 and was able to connect and load all PDOs. However, no samples are transmitted yet. I think it's due to lack of oversampling and IEPE settings.

I am aware of this SOEM issue comment, but it makes no sense (oversampling factor = sync1/syn0), at least when I look into the TwinCAT ELM3602 device configuration:
OpenEtherCATsociety/SOEM#142 (comment)

Do you know how the Beckhoff EtherCAT-Oversampling can be configured?

@Apollo3zehn
Copy link
Owner

It is long ago that I worked with EtherCAT so I am unfortunately not able to give to a clear solution. As far as I remember and as I can see from the code, there are oversampling settings defined in the ESI file which get loaded here (https://github.com/Apollo3zehn/EtherCAT.NET/blob/master/src/EtherCAT.NET/EcUtilities.cs#L243-L247) and then applied here (https://github.com/Apollo3zehn/EtherCAT.NET/blob/master/src/EtherCAT.NET/EcMaster.cs#L216-L238).

I think as a first step you should debug EtherCAT.NET and see what is happening there. Or you can try to set the SelectedOpModeId to the mode you like to have activated:

https://github.com/Apollo3zehn/EtherCAT.NET/blob/master/src/EtherCAT.NET/Extension/DistributedClocks/DistributedClocksExtension.cs#L28

@ToGoOrNotToGo
Copy link
Author

I have now finished the configuration part and tried out a few things. However, I came to the conclusion that it is not possible to run oversampling > 1 stably with normal Windows threading. A constant cycle time of 1ms is simply not possible for Windows, especially since you can only poll (EcMaster.UpdateIO). Is there a way to receive event-based process data in SOEM?

Here is a table for the oversampling commissioning for another ELxxxx:
https://infosys.beckhoff.com/content/1033/el3632/2376439691.html?id=1194465264984357731

@Apollo3zehn
Copy link
Owner

Apollo3zehn commented Feb 2, 2023

You can SpinWait and burn CPU cycles until 1 ms has passed. With Windows I am able to get 10 ms cycle time. But that needs a process with highest priority, thread with highest priority, Windows timer resolution set to 1 ms (https://learn.microsoft.com/en-us/previous-versions/ms713413(v=vs.85)) and an Intel NIC with disabled interrupt moderation.

Regarding your event based question: UpdateIO instructs SOEM to send an EtherCAT frame to collect process data from the slaves. When that frame returns, the master is updated. There is no other way to get process data. TwinCAT does the same, except that it patches the Windows kernel to become realtime capable for TwinCAT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants