Ethercat EL5152 encoder reading

More
7 years 1 month ago - 7 years 1 month ago #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: 7 years 1 month ago by chimeno.
The following user(s) said Thank You: Nico2017

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

More
7 years 1 month ago #146751 by Nico2017
Hi @chimeno,
my network card is identified when using
Code:
lspci
as
Code:
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
Code:
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? download.beckhoff.com/download/document/...rminals/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
7 years 1 month ago - 7 years 1 month ago #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: 7 years 1 month ago by chimeno.
The following user(s) said Thank You: Nico2017

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

More
7 years 1 month ago #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
7 years 1 month ago #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
The following user(s) said Thank You: Nico2017

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

More
7 years 3 weeks ago - 7 years 3 weeks ago #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
    Code:
    <master idx="0" appTimePeriod="1000000" refClockSyncCycles="4">
    in my ethercat.xml configuration file loaded by
    Code:
    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:
  • Code:
    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
    Code:
    BASE_PERIOD = 100000
    and
    Code:
    SERVO_PERIOD = 100000
    in my ini EMCMOT section
  • Code:
    loadrt threads name1=very-fast-thread period1=50000 fp1=0
    is my fastest non floating point thread for
    Code:
    addf encoder.update-counters very-fast-thread
  • Code:
    loadusr -W lcec_conf lam-ethercat-v1.xml
    where in my xml code I have
    Code:
    <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: 7 years 3 weeks ago by Nico2017.
The following user(s) said Thank You: chimeno

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

Moderators: PCW, jmelson
Time to create page: 0.307 seconds
Powered by Kunena Forum