Ethercat EL5152 encoder reading

More
10 Sep 2019 03:24 - 10 Sep 2019 03:26 #144655 by Nico2017
Hi all,

I was wondering in the etherCAT .xml file what exactly means the <master idx="0" appTimePeriod="2000000" refClockSyncCycles="4"> part. I guess this a given period to scan the etherCAT cards but not sure of the unit. Moreover is there a limitation like the jitter max limitation on linuxcnc depending of the hardware. If such a limitation exist how can I find it.For now I just found: max. 400,000 increments/s (with 4-fold evaluation) but nothing about the appTimePeriod from the lcec point of view.

I am asking this as I have one EL5152 card connected to an encoder and the encoder signal is kind of weird.
I made sure that my linuxcnc thread period used for encoder.update−counters component was at least twice as fast than my encoder count-rate but I still got a strange signal. My lcec encoder channel A and B from the EL5152 is then connected to the channel A and B of the encoder hal component.

I am wondering if I should therefore play with the ethercat config file to speed up the reading thread if appTimePeriod refers to it.

Thanks for your help,
Nicolas
Last edit: 10 Sep 2019 03:26 by Nico2017. Reason: More precise question

Please Log in or Create an account to join the conversation.

More
10 Sep 2019 06:11 #144663 by pl7i92
the value are nanoseconds
so it is updated every 2ms
meaning 500 times per second
this is not a good value for encoders
you may run in packet loss if you take this doen
but 200kh may be a value that is ok for encoders readig
ethercat has been designed for non cnc desponce and hard envirerments that does not need 1milion ticks per second
The following user(s) said Thank You: Nico2017

Please Log in or Create an account to join the conversation.

More
10 Sep 2019 19:56 - 10 Sep 2019 20:37 #144737 by Nico2017
Hi thanks for your answer,
what about the refClockSyncCycles="4", not sure exactly how I should read and interpret it.
Also I am wondering if I am reading an encoder with the EL5152 card and lcec component, I should have
addf lcec.read-all servo-thread
addf lcec.write-all servo-thread
which are with a servo-thread fast enough to be at least twice the maximum expected count rate frequency. Is that it?
Thank you,
Nicolas
Last edit: 10 Sep 2019 20:37 by Nico2017.

Please Log in or Create an account to join the conversation.

More
11 Sep 2019 22:14 #144837 by Nico2017
Hi all,
so I am using the EL5152 ethercat card reading a quadrature encoder output. The lcec pins are then connected to the hal encoder pins. For my application I need to achieve both high and low velocity. I already figured out that at high speed my pulse rate was way too big for the thread period I had so I have been ordering new encoders with lower pulse rate. Lowering my faster non floating point thread period would end up being close to the max period jitter of the computer hardware so I already now that my hardware is not recommended for pulse generation nor encoder pulse reading. To me lower pulse rate encoders is the main option to tackle my velocity reading issue.

However I was expecting to still get relevant readings at really low speed of my encoder. However the velocity that the hal encoder component computes seems weird as at low speed it is oscillating, Jumping from negative to positive.

So I put my halscope to monitor the lcec pins and the encoder resulting velocity. You can find a screenshot attached with the log file.

In red, I measure the voltage going on to my EL5152 A channel (lcec.0.10.enc-0-ina in cyan) with a El3102 analog input.They both match. Then I got the channel A and channel B readings with the lcec.0.10.enc-0-ina and lcec.0.10.enc-0-inb (white). For some reasons those signals are not exactly an time shifted from one another. When I recorded this phase the rotation was steady. Am getting packet loss effect on the ethercat to get such a difference?

Then on the top is the resulting velocity of the encoder hal component having connected lcec.0.10enc-0-ina to encoder.0.phase-A and lcec.0.10enc-0-ina to encoder.0.phase-B. I guess the reason why this signal is jumping all around is because A and B signal are not an time shift of one another.

I already tried to create a fast thread with floating point to load the lcec read and write with it:
addf lcec.read-all fast-thread-fp
addf lcec.write-all fast-thread-fp
I also lowered the period value in the ethercat config xml file to match this period at 50000ns.
Doing so had some knock on effects such as unexpected behaviour of the ethercat bus output or the logic. Maybe it is too fast at this stage so I will probably have to work out a trade off.

Nicolas
Attachments:

Please Log in or Create an account to join the conversation.

More
11 Sep 2019 23:06 - 11 Sep 2019 23:06 #144841 by PCW
Replied by PCW on topic Ethercat EL5152 encoder reading
I would not expect that software encoder counter to be of much use
with Ethercat unless you are using a very low resolution encoder

If the Ethercat encoder hardware does not provide a velocity signal
(and I would almost expect that it does) the best bet would be to use a
high resolution encoder and then calculate the velocity in LinuxCNC with the
DDT component.
Last edit: 11 Sep 2019 23:06 by PCW.

Please Log in or Create an account to join the conversation.

More
12 Sep 2019 18:21 - 12 Sep 2019 18:24 #144979 by chimeno
Hi Nicolas,
I don't know if it is very helpful, I usually do this configuration:
appTimePeriod = "1000000" = SERVO_PERIOD = 1000000
refClockSyncCycles = "- 1" by applying Patch PLL (times when the hook cycle is restarted)
refClockSyncCycles = "1000" without patch
To sync devices with DC
<dcConf assignActivate = "730" sync0Cycle = "250000" sync0Shift = "50000" sync1Cycle = "750000" sync1Shift = "500000" />

regards
Chimeno
Last edit: 12 Sep 2019 18:24 by chimeno. Reason: Edit
The following user(s) said Thank You: Nico2017

Please Log in or Create an account to join the conversation.

More
12 Sep 2019 22:04 - 13 Sep 2019 04:33 #144993 by Nico2017
Hi,
thanks for the information, I had to make a bit more sense of it with the EtherCAT documentation. Not sure if this is exactly what I need as at the moment I just try to speed up the EtherCAT process to capture more reliably the encoder pulses without crashing the EtherCAT and my application. At the moment, not sure time synchronization would improve the encoder reading.

However I was wondering, on the EtherCAT point of view, if using a native Ethernet device driver instead of the generic ethernet device driver could increase the performance as indicated in the EtherCAT documentation. So I could decrease the appTimePeriod in the .xml configuration. When I do the lspci command I got:

01:00.0 Network controller: Intel Corporation Wireless 8260 (rev 3a)
02:00.0 Ethernet controller: Intel Corporation I211 Gigabit Network Connection (rev 03)
03:00.0 Ethernet controller: Intel Corporation I211 Gigabit Network Connection (rev 03)

But I cannot make any link with the list of drivers available on the Etherlab website driver list: https://etherlab.org/en/ethercat/hardware.php . If anyone could point me in the right direction, I could try the relevant native Ethernet device driver and run more test to see if I can lower the appTimePeriod without struggle.

Thank you,

Nicolas

PS: after testing lowering the appTimePeriod, under the generic ethernet device driver, I manage to go to 500000ns, under I got some data frame skipped when I do dmesg. I am still a bit far from what I could maybe expect from the EtherCAT manual: they take an example of 2GHz system where they reach 25KHz where I am standing at 2KHz for 1.5GHz system CPUs. The big difference might come from the generic ethernet device driver.
Last edit: 13 Sep 2019 04:33 by Nico2017.
The following user(s) said Thank You: chimeno

Please Log in or Create an account to join the conversation.

More
13 Sep 2019 19:39 #145077 by chimeno
Hi Nicolas,
As far as I know there is no igb driver available, it only works with generic but I could try this for a while.
install driver "igb-xxxtar.gz" and see if it works DEVICE_MODULES = "igb"
although I think it would be best to find a card with one of these chips "8139too, e100, e1000, e1000e, r8169"

I performed the tests in "8139too, e100, e1000e" for synchronism, I could not get more than appTimePeriod = "500000" since if I increased it every so often I lost the ethercat synchronization ring.
with generic driver and the pacth I get maximum appTimePeriod = "1000000"

If you are a good programmer, you should look at this example and create .comp only for your component.

regards
Chimeno
Attachments:
The following user(s) said Thank You: Nico2017

Please Log in or Create an account to join the conversation.

More
18 Sep 2019 19:43 #145537 by Nico2017
Hi,
at the moment I am still limited so I end up needing encoders with lower pulse rate. Would there be any official documentation about the formatting and all the parameters that can be adjusted in the EtherCAT .xml file?

Thank you,

Nicolas

Please Log in or Create an account to join the conversation.

Moderators: PCWjmelson
Time to create page: 0.115 seconds
Powered by Kunena Forum