Ethercat EL5152 encoder reading

More
26 Sep 2019 02:32 #146214 by Nico2017
Hi,
what I mean is on my Ethercat parameter file for the linuxcnc-ethercat driver, I cannot go lower than the period I already set up which is appTimePeriod="1000000" refClockSyncCycles="4".

If I go lower I experience lagging and unexpected behaviour from the EtherCAT bus and my computer. I think this is probably a hardware limitation due to my Ethernet card being used by the EtherCAT drive as I am using the generic module for it. Also I am not sure how I can play with refClockSyncCycles="4".

In theory the EL5152 hardware itself can be set up to a higher frequency. But I think if I try TwinCAT reading from Windows, the performance will be once again limited by my Ethernet card and the false real time environment.

It could also be a limitation due to the other EtherCAT cards on my EtherCAT bus which show on their documentation a lower frequency for their input/output. One solution might be to have fast information system (fast domain) and a slower one for the other components but I need more practise and documentation about it from the linuxcnc-etherCAT point of view.

Regards,

Nicolas

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

More
30 Sep 2019 17:49 #146732 by chimeno
Hi Nico, refClockSyncCycles = "4" this meaning that once the cycle is restarted, if you have the PLL patch installed you have to leave it at -1 to work, then you can adjust the synchronism error with the parameters PLL-P and PLL- I.
Regarding the network card, what chip are you using?
Regards
Chimeno
The following user(s) said Thank You: Nico2017

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

More
30 Sep 2019 18:10 - 30 Sep 2019 18:12 #146735 by chimeno
Hi Nico,
The default setting in EL5152:
Manual:
Index 1C32 SM output parameter
C32: 01 Sync mode Current synchronization mode:
• 0: Free Run
• 1: Synchronous with SM 2 event
• 2: DC-Mode - Synchronous with SYNC0 Event
• 3: DC-Mode - Synchronous with SYNC1 event
UINT16 RW 0x0001 (1dec)
1C32: 02 Cycle time Cycle time (in ns):
• Free Run: Cycle time of the local timer
• Synchronous with SM 2 event: Master cycle
time
• DC-Mode: SYNC0 / SYNC1 Cycle Time
UINT32 RW 0x000F4240
(1000000dec)

default
C32: 01 Sync mode Current synchronization mode: • 1: Synchronous with SM 2 event
1C32: 02 Cycle time Cycle time (in ns) :( 1000000dec)

therefore if you do not configure the value for linuxcnc
cycle time is 1000000.

According to this it is:
<master idx = "0" appTimePeriod = "1000000" refClockSyncCycles = "1000">

you can configure this device in mode 3 not to go faster if not to have it synchronized with the clock
• 3: DC-Mode - Synchronous with SYNC1 event

 <slave idx = "1" type = "EL5152">
      <initCmds filename = "EL5152.xml" />
      <dcConf assignActivate = "730" sync0Cycle = "250000" sync0Shift = "50000" sync1Cycle = "750000" sync1Shift = "500000" />
    </slave>
 
I hope it helps you

Regards
Chimeno
Last edit: 30 Sep 2019 18:12 by chimeno.
The following user(s) said Thank You: Nico2017

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

More
30 Sep 2019 19:37 #146751 by Nico2017
Hi @chimeno,
my network card is identified when using
lspci
as
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)
At the moment I am using the generic device in the /etc/default/ethercat:
DEVICE_MODULES="generic"
Not sure if I could use any of the
Possible values: 8139too, e100, e1000, e1000e, r8169, generic, ccat, igb
to maybe increase the performance as I read in the Etherlab manual that using the generic might decrease performance.

Also not sure where you get all the information about the EL5152. Are you reading it from the pdf documentation on the Beckhoff website? https://download.beckhoff.com/download/document/io/ethercat-terminals/el515xen.pdf for instance page 116 117 , or are you using TwinCAT.

On a more general way I am just wondering if there is any documentation/explanation about the xml file formatting used while loading the EtherCAT bus topology and devices options for linuxcnc.
Thank you,
Nicolas

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

More
30 Sep 2019 19:58 - 30 Sep 2019 19:59 #146755 by chimeno
Hi Nico, with that network card, you can only use the generic one, but think that ethercat works for one band and linuxcnc for another, as long as you have it synchronized you don't have problems.
the 5152 I do not have it and I can not prove it, I was reading it from the manual, manuals of the .xml format I think there is not, I am learning to modify / error
Regards
Chimeno
Last edit: 30 Sep 2019 19:59 by chimeno.
The following user(s) said Thank You: Nico2017

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

More
30 Sep 2019 21:24 #146767 by Nico2017
Thanks Chimeno,
I have the EL5152 working, it is just that with my current encoder at high speed I am loosing steps because I am not able to decrease the etherCAT period. So I was really wondering if I could increase the thread frequency but apparently not due to the linuxcnc-etherCAT limitation or the fact that I am using the generix module for the ethercat drive.

So as a solution I ordered lower pulse rate encoder and that should fix it.

Ok, so I will have also to practise and try to find out example to be able to translate an ESI file format to complete a slave section in the required .xml format for the linuxcnc-ethercat.

Thanks again,

Nicolas

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

More
01 Oct 2019 19:10 #146819 by chimeno
Hi Nico, I don't understand how you can lose EL5152 steps, the manual indicates
Limit frequency max. 400,000 increments / s with 4-fold evaluation), corresponds to 100 kHz

- Have you tried the DC-MODE function?

- Have you tried any configuration other than the default of the 175 manual page?
80n0: 11 Frequency window
[} 124]
Measuring window: the minimum time over which the
frequency is determined [1 µs], default: 10 ms.
Measuring window <600 ms: Measurement takes
place in frequency mode A [} 125].
Measuring window> 600 ms: Measurement takes
place in frequency mode B [} 126].
The frequency determined is output in Frequency
value (index 0x60n0: 13 [} 176]).
UINT16 RW 0x2710
(10000dec)
80n0: 17 Frequency Wait Time
[} 124]
Waiting time [ms] for frequency measurement
Once the time specified in the frequency window
[} 175] has elapsed, the system waits for the next positive edge from track A. This enables the fastest possible update of the Frequency process data, depending
on the expected frequencies. At least double the period of the minimum frequency to be measured should
be entered here t> = 2 * (1 / fmin)
UINT16 RW 0x0640
(1600dec)
 
-The value 0x6000: 11 counter is also losing its position?

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

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

More
08 Oct 2019 19:49 - 08 Oct 2019 20:01 #147485 by Nico2017
Hi,

I have been testing the EL5152 under two configurations.
  • under the TwinCAT software, so under Windows. Unfortunately my Ethernet card hardware does not allow realtime performance. If I go in TWINCAT -> Show realtime Ethernet compatible devices, my Ethernet card is in

    Installed and ready to use devices (for demo use only)

    so it is not in the realtime capable section. As far as I have been using it, I was able to run the EL5152 without noticing loose of steps, so the EL5152 itself and if runned under TWINCAT seems to be fine.
  • under my linuxcnc application, under debian, with a different hardware. When I have been programming my files, I noticed that I could not go lower than
    <master idx="0" appTimePeriod="1000000" refClockSyncCycles="4">
    in my ethercat.xml configuration file loaded by
    loadusr -W lcec_conf lam-ethercat-v1.xml
    in my hal file

I am not too concerned about the first configuration under TwinCAT that I am just using to get more familiar with EtherCAT and to run Wireshark at the same time to observe the EtherCAT frames.

The second configuration is for my real time system and machine where I have in my hal:
  • loadrt motmod base_period_nsec=[EMCMOT]BASE_PERIOD base_thread_fp=0 servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]JOINTS num_dio=20 num_aio=20
    with
    BASE_PERIOD  =  100000
    and
    SERVO_PERIOD =  100000
    in my ini EMCMOT section
  • loadrt threads name1=very-fast-thread period1=50000 fp1=0
    is my fastest non floating point thread for
    addf encoder.update-counters very-fast-thread
  • loadusr -W lcec_conf lam-ethercat-v1.xml
    where in my xml code I have
    <master idx="0" appTimePeriod="1000000" refClockSyncCycles="4">
The base period, servo period and very-fast-thread have been defined according to my linuxcnc latency test (max jitter about 100000ns=0.1us), which by the way would classify my hardware as not good enough for step generation, so I guess not good enough too for reading my encoder with 1000ppr. However when I do the maths, with my 1000ppr encoder with an encoder wheel diameter of 200mm at my max speed of 253.6mm/s I get 1.178 rev/s so about 4712 counts/s so 1 count every 0.2ms. My servo / base thread period are twice as low and my very fast thread supposed to count for the encoder counts is called 4 times as fast as the expected encoder count period. So from the linuxcnc point of view that should be good to read my encoder signal correctly.

However, from the EtherCAT point of view, I was not able to decrease the appTimePeriod without observing really laggy/jittery unexpected behaviour from the EtherCAT card and the all hal logic. So I guess I have reach some kind of hardware or driver limits there. Using the appTimePeriod="1000000", which is 5 times the encoder count period at high speed, does not allow me to read correctly the quadrature signal at high speed and that is why I am loosing steps and the velocity given by the encoder .hal component gives really weird results.

I am just curious about where this linuxcnc-EtherCAT limitation appTimePeriod comes from:
  • is it the EtherCAT using the generic module? According to the EtherCAT user guide on the Etherlab website, using the generic driver is likely to decrease the performance
  • is it the EtherCAT bus topology that I am using which contains other components : EL 1008, EL2008, EL3102, EL4102, EL4004 and the EL5152 .I created the require files for the EL4004. Maybe the other components have a limitation on the period that I was not able to identify in any of their documentation

So here are my questions:
  1. Is there a way to determine what could be used for appTimePeriod at best?
  2. If the limitation is more related to the second case, then maybe I should have a fast EtherCAT frame exchange just dedicated to the EL5152 and on slower EtherCAT frame exchange for the other modules, where fast thread is not critical. Then the issue is I have no idea about how to parametrized that in the ethercat.xml file for the linuxcnc-ethercat driver.

Not sure what the DC (distributed clock) mode function is but will try to adapt the ethercat.xml file according to your previous posts.

Again my temporary solution is to go for a lower pulse rate encoder which should just be able to be read correctly with the appTimePeriod="1000000" at my maximum speed.

Thanks for your help,
Nicolas
Last edit: 08 Oct 2019 20:01 by Nico2017.
The following user(s) said Thank You: chimeno

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

More
08 Oct 2019 20:27 - 09 Oct 2019 01:21 #147493 by Nico2017
Hi Chimeno,
I went over your post again and tried to make more sense of it. When I try the DC mode the parser fails for the line :
<initCmds filename = "EL5152.xml" />
sending me back
lcec_conf: ERROR: unable to open config file EL5152.xml
lcec_conf: ERROR: Parse error at line 15: parsing aborted

So I got ride of this line, then it loads but the terminal is not sending information: leds on top of the terminal are blinking when the encoder spins but I have the lcec.0.10.slave-oper at false and none of the lcec.0.10 pins are responding. So I guess the initialization did not succeed.

Where would I be able to find or generate myself the EL5152.xml file?

Edit: Ok I gave it a try finding some example in the linuxcnc-ethercat for the initCmds, writing something like for my <initCmds filename = "EL5152Param.xml" /> file:
Warning: Spoiler! [ Click to expand ]


The program launch but I still get the EL5152 not going into OP mode and getting stuck into SAFEOP. Doing it under TWINCAT gives me the same error when I use the DC mode (see error bellow).



Nicolas
Attachments:
Last edit: 09 Oct 2019 01:21 by Nico2017.
The following user(s) said Thank You: chimeno

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

More
09 Oct 2019 17:52 - 09 Oct 2019 18:44 #147581 by chimeno
Hi Nico,
Thank you very much for the explanation, I see that you know much more than me, I will help you in whatever I can, I pass you a configuration file so you can try it if you can load it and put the EL5152 in OP mode, the files are made in windows, You may have to pass it for Linux to recognize it.

I attach the lam-ethercat-v1.xml file with the Ethercat devices
I enclose the EL5152Param.xml file with a value for each channel, if accepted.

Is there any way to determine what can be used for appTimePeriod at best?
  - I understand that "appTimePeriod = SERVO_PERIOD"

Is the EtherCAT bus topology that I am using the one that contains other components: EL 1008, EL2008, EL3102, EL4102, EL4004 and EL5152. I created the necessary files for EL4004. Perhaps the other components have a limitation in the period that I could not identify in any of their documents

- I had problems with other ethercat devices that were on the same bus due to problems of PDO configuration and initial configuration that affected me to the next module, but once everything well configured does not give problems between one device and another

Where could I find or generate the EL5152.xml file?

- The best thing for not having errors is to make them yourself, I pass you a template and you can where you can add any configuration you want to change, the configuration generated by TWINCAT3 is not compatible with LINUXCNC-ETHERCAT and usually gives errors, I what do is testing configuration by configuration, when you have many it is very difficult to know the problem-

DC mode (see error below).

- Error in synchronism is normal, I also found it many times, not having the device is a bit difficult to know how to configure the DC mode, many settings do not work and I guess you would have to modify the file lcec_el5152.c, it may be that PDOs do not correspond in that way.

If the limitation is more related to the second case, then perhaps you should have a fast EtherCAT frame exchange only dedicated to the EL5152 and a slower EtherCAT frame exchange for the other modules, where the fast thread is not critical. So the problem is that I have no idea how to parameterize that in the ethercat.xml file for the linuxcnc-ethercat controller.

- can you prove it if it works, do you have two network cards?
Attachments:
Last edit: 09 Oct 2019 18:44 by chimeno.
The following user(s) said Thank You: Nico2017

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

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