Re: [etherlab-users] Synchronizing the EtherCAT application time to the DC reference clock

2018-02-01 Thread Gavin Lambert
Actually you typically shouldn’t have Sync0 simultaneous with your
communication cycle; that causes problems.  The goal is to get it into a
locked phase arrangement.

 

Sync0 is typically when the slave’s actions trigger – it asserts outputs and
captures inputs ideally both at that precise instant (though there might be
some delay if it needs to do one before the other).  However there is
generally some setup time before Sync0 required (so you have to provide the
next cycle’s outputs at least this amount of time before Sync0) and some
transfer time after Sync0 required (so you have to wait that long after
Sync0 before you can read the inputs).  The slave’s documentation should
tell you how long each of these times are, and you need to allow a little
bit of extra time to cope with jitter on the master’s end and the comms
delay of the network itself.  If you have no clue, aiming for somewhere in
the middle of your sync cycle is usually a fairly safe bet.

 

The most important aspect of the EtherCAT comms cycle is when you call
ecrt_master_send.  This is what actually sends (and receives back) the
datagrams and transfers all data to and from the slaves.  Your goal is
always to make this call happen consistently with as little latency and
jitter as possible.  None of the other calls matter in terms of timing.

 

ecrt_master_reference_clock_time retrieves the 32-bit time of the reference
slave as of when you called ecrt_master_send, provided that you called
ecrt_master_sync_slave_clocks at some previous point (each cycle).

 

ecrt_master_64bit_reference_clock_time retrieves the 64-bit time of the
reference slave as of when you called ecrt_master_send, provided that you
called ecrt_master_64bit_reference_clock_time_queue at some previous point
(each cycle).

 

(In principle doing both ecrt_master_64bit_reference_clock_time_queue and
ecrt_master_sync_slave_clocks on every cycle is a bit wasteful.  It would be
better if you could just do a 64-bit sync, but this is not supported at
present.  If you’re worried about bandwidth then you should call
ecrt_master_sync_slave_clocks on every cycle and
ecrt_master_64bit_reference_clock_time_queue only occasionally.  You cannot
omit calling ecrt_master_sync_slave_clocks.)

 

For maximum consistency, you should call ecrt_master_application_time
immediately prior to ecrt_master_send.  You should also call it on each
cycle, although in practice it matters most when it’s doing the slave DC
configuration, which will span several cycles across the slaves shortly
after activating the master.  Also rather than using a monotonically
increasing value as it appears you’re using at the moment, I think it’s more
typical to use the actual PC clock time, corrected for the offset between
the master clock and the reference clock.  I’m not sure which is “better”
though.

 

(Also note that most things work best when you always use the first
DC-capable slave as the reference clock, which is the default.  If you’re
explicitly designating a clock elsewhere on the network then there might be
complications.)

 

If you are trying to synchronise the reference clock to the master (which
you are not; it tends to be less accurate), you also have to call
ecrt_master_sync_reference_clock between ecrt_master_application_time and
ecrt_master_send.  It doesn’t matter when you call
ecrt_master_sync_slave_clocks as long as you do it periodically (typically
recommended once per cycle, unless you have a really fast cycle time).  If
you’re using ecrt_master_reference_clock_time then you have to sync slave
clocks at least as often as you ask for the time.

 

ecrt_master_receive can be called at any time after the packets arrive back,
which will be shortly after ecrt_master_send (exactly how long depends on
your network size) – but it’s most common to use this time to do a proper
idle sleep and process it at the start of the next cycle rather than the end
of the previous one.  That can cause higher jitter if your processing times
aren’t consistent, however (unless you have two smaller sleeps rather than
one large one), so the way you’re doing it isn’t a bad one.  You do have to
call it before anything else that uses the results of the datagrams, such as
the time calls above.

 

If you can hook a scope up to a slave’s SYNC0 and SOF pins (if accessible),
that will give you the best idea of how your timing cycle looks.

 

From: Matthias Bartsch
Sent: Friday, 2 February 2018 05:12
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Synchronizing the EtherCAT application time to the
DC reference clock

 

Hello everybody!

I‘m using the unofficial patch set from https://github.com/ribalda/ethercat
(2017-11-08).
My RTAI communication cycle is synchronized to the DC slave reference clock
(average jitter < 1µs). I need to extrapolate the position of servo drives
to the beginning of my cycle.

I’m not sure about the right use of the functions for reading the reference
clock.

I want to start my cycle at 

Re: [etherlab-users] yet another datagrams UNMATCHED - DC 0.2ms / 5kHz // igb kernel 3.18

2018-02-12 Thread Gavin Lambert
The ec_igb driver is relatively new (and only exists in 3.18 in the stable-1.5 
branch, although the unofficial default-branch patchset 
  
extends this to later kernels), so it’s certainly possible that it has some 
bugs.

 

But the most likely thing is that your hardware or kernel configuration can’t 
sustain that cycle time.  Sub-millisecond cycle times are possible with 
PREEMPT_RT (provided that you are not using ec_generic), but are highly 
dependent on your hardware (and its general latency) and require a very 
carefully written realtime loop.  You may have better luck using RTAI or 
Xenomai, however.

 

Another possibility is that you might need to specify a different shift time in 
your call to ecrt_slave_config_dc.  If you have the ability to hook a scope to 
your slave to measure the ECAT SOF vs. SYNC0, this can help to determine if the 
ECAT frame is arriving with the correct phase – you usually want SOF and 
SYNC0/SYNC1 to cleanly alternate, not letting it jitter sometimes on one side 
and sometimes the other.  Check your slave’s documentation for guidelines on 
specifying the shift time.

 

Another option, if your slave supports it or if you can switch to an alternate 
slave, is to use oversampling.  In one application I sample data at 4000 Hz 
with a 1ms ECAT cycle time (PREEMPT_RT with e1000e) by using a slave that is 
configured to capture 4 samples per ECAT cycle (triggered by the DC sync clock).

 

From: Jürgen Walter • DATATRONiQ
Sent: Tuesday, 13 February 2018 14:23
To: etherlab-users@etherlab.org
Subject: [etherlab-users] yet another datagrams UNMATCHED - DC 0.2ms / 5kHz // 
igb kernel 3.18

 

Hello list, 

I have been fighting with an ethercat slave (measurement device from imc) over 
the past week. I got it somewhat (mostly?) working but I am seeing really a lot 
of the dreaded "datagrams UNMATCHED" in syslog.

My setup is an APU2 (AMD Chipset but "Ethernet controller: Intel Corporation 
I210 Gigabit Network Connection (rev 03)" -   
https://pcengines.ch/apu2.htm) with Ubuntu 12.04 and a "low latency" kernel 
3.18 installed - to my delight (after doing ./bootstrap.sh) I found the option 
"--enable-igb" available with "./configure --help" (it was not available on the 
3.2 and 3.13 (or some earlier experiments with a newer distro and Kernel 4.4)). 
I enabled it and after "make && make modules && make install && make 
modules_install" I can do "/etc/init.d/ethercat start" and the module loads 
with:

ec_igb :01:00.0 eth0: igb: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow 
Control: RX/TX

Next, I have adapted the main.c in "examples/dc_user"

1.  customising the PDO section and inserting my output of "ethercat 
cstruct"

2.  changing the frequency to: "#define FREQUENCY 5000" (this is so I can 
get a DC cycle time of 200 microseconds (working fine in TwinCat 3)) 

3.  reading (some of the) mapped PDOs in the cyclic task

4.  customizing "ecrt_slave_config_dc" (fixed DC cycle time, nothing else 
works with this slave): ecrt_slave_config_dc(sc, 0x0300, 20, 0, 0, 0);

I can see from the logs that the DC setup succeeds and the slaves goes into OP 
(it is the only slave, a 1:1 direct connection).
I can also confirm that the PDO exchange works so far because the data I am 
reading makes sense.

Yet, my syslog essentially gets flooded with those two

EtherCAT WARNING 0: 58 datagrams UNMATCHED!
EtherCAT WARNING: Datagram f66b3b8c (domain0-0-main) was SKIPPED 29 times.

In addition - when leaving the "check_domain_state()" call enabled, I am seeing 
those (warnings?):

Domain1: WC 0.
Domain1: State 0.
Domain1: WC 1.
Domain1: State 2.
Domain1: WC 0.
Domain1: State 0.
Domain1: WC 1.

When I reduce the "FREQUENCY" back to 1000 the problems pretty much disappear; 
however, my problem is that I need to run the DC cycle at 200 microseconds 
(each channel uses PDOs with 10 real/float values - I need to read each channel 
5000x per second in order to get all 50.000 measurement samples).

I have also tried this setup on a newer Ubuntu with Kernel 4.4 and the generic 
driver - the results are essentially the same.

I am really not sure how to proceed from here - should I give the Xenomai a 
try? Or buy another PCI/Intel network card (PRO/GT - what model works still 
with the e1000/e drivers?) - or am I in general out of luck because 200us DC 
cycles are completely unrealistic with the ec_master? 

Any help would be greatly appreciated!! Jürgen 

___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] IgH Master License

2018-07-25 Thread Gavin Lambert
On 25 July 2018 22:46, quoth Mike O'Connor:
> The IgH Ethercat Master is GPL with parts being LGPL also mentioned so its
> not clear to me which set of rules would apply.
> 
> LGPL allows you to bind via a library and not have your own code be come
> `infected` by the GPL requirements of releasing your own code under the
> GPL also.
> 
> Code which is under GPL and your code build against it must be release to
> the public.
> 
> The only really safe way is to write parts which directly connect to Ethercat
> Master as OSS code but have this communicate to your private code.

That's not correct.

The kernel-mode parts of the master (and the user-mode command line tool) are 
GPL (just like most of the kernel itself).  You are required to make the source 
code available to anyone which you distribute binaries to (which does not 
necessarily mean the public in general).  If you have made changes to 
kernel-mode code (such as writing your own kernel-mode application), this is 
required to use the same license and thus again you must make the source for 
that available to anyone who receives the binaries.  (This includes even if 
they receive them as part of an "appliance" that they're not expected to 
modify.)  If you have not made any modifications to the kernel-mode code and 
you have not added a kernel-mode application then providing a link to where 
they can download the source from the etherlab.org website or SourceForge is 
sufficient for this purpose (although you must be prepared to supply the full 
source if requested, especially if those sites go down in future).

The user-mode library of the master is LGPL.  You are again required to make 
the source of the library itself available to anyone that you distribute the 
binaries to -- a link is adequate if you haven't modified the source.  You are 
not required to distribute the source for an application that merely 
dynamic-links to the user-mode library, but you can if you wish.  The key 
requirement is that someone should be able to modify and recompile the library 
and it should still work with your proprietary app (if they didn't break the 
interface).

Also note that in general, you can't "bypass" the GPL by releasing a GPL app 
that calls a proprietary app to do the "real work".  If the GPL app cannot 
operate without the proprietary app, then the proprietary app is still 
considered part of the same overall application and thus can't be proprietary 
and must be GPL instead.

___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Missing Vendor ID / Product Code

2018-08-07 Thread Gavin Lambert
There’s lots of things that can cause that.  Most often, I’ve seen this when 
packets get lost or corrupted, so the initial discovery datagrams get lost or 
fail.  Usually bad wiring or shielding is the culprit.

I think it might be possible to get something similar due to an unfortunate 
timing coincidence – if the devices are being connected “live” then a dodgy 
plug-in could make the device visible in the initial device count scan, but 
then disconnected before it finishes the identity discovery, but then 
reconnected again before it does the next device count scan (so it doesn’t try 
again).  Replugging the devices (with less unfortunate timing) or restarting 
the etherlab service should both recover from that case, however.

Or, of course, you might have found a bug. 

It's hard to say for sure what actually happened without seeing syslogs and/or 
reproducing it.

From: Graeme Foot
Sent: Wednesday, 8 August 2018 14:12
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Missing Vendor ID / Product Code

Hi,

I updated my EtherCAT system to use Gavin's patch set (revision 10, 20171108).  
It has been running fine on a few machines, but have just had a machine being 
commissioned where one of the slave modules had a zero Vendor ID and Product 
Code (and I suspect it failed to read any information from the slave).  
Unfortunately it occurred while I was not available so our engineers reverted 
to the previous version (which detected the module correctly) and shipped the 
machine, so I have very minimal information and no logs.

The module with the problem was the 17th module, the first EL2612 of 5.  It is 
directly after an EL9410 power module.  It has an explicit alias set.  The 
engineers had tried repowering the whole system and replacing the module.

Until I get a machine to test on with the same behaviour I was wondering if 
anyone else has had problems with slaves not initialising correctly.

Thanks,
Graeme Foot.
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Failed to execute SDO download: Protocol not supported

2018-07-05 Thread Gavin Lambert
Ok.  So after you do that and rescan, check the output of “ethercat cstruct”.  
This should have changed to reflect the new configuration of the assignment 
registers (assuming that the slave actually did accept the downloads), and this 
is the data that you need to include in your application code instead of trying 
to explicitly write to the assignment registers.  (Using the correct sequence 
in ecrt_domain_reg_pdo_entry_list makes Etherlab do those same downloads 
internally during configuration.)

From: Derrill Vezina [mailto:dvez...@caroneng.com]
Sent: Friday, 6 July 2018 02:03
To: Gavin Lambert ; Derrill Vezina 
; etherlab-users@etherlab.org
Subject: Re: [etherlab-users] Failed to execute SDO download: Protocol not 
supported

Hi Gavin.

I fully understand that this is a Beckhoff / integration issue and not anything 
to do with the master. I have been doing as you instructed and it has worked 
with different revisions with different PDO structures with a bunch of 
different cards up until this specific situation. Without getting too in depth 
with it, Beckhoff allowed setting two PDO’s originally including the period and 
duty cycle of the PWM wave output on the EL2502 for each channel. They decided 
on REV25+ that they were going to remove the period as a PDO and use it as an 
SDO. To fix this, Beckhoff has instructed a sequence of setting some startup 
SDO configuration registers that would set the PDO assignment back to the “old 
way” in which I have successfully done using the Etherlab tool using the 
following commands (only one card on the stack after starting the master):

./ethercat download --position 1 --type uint16 0x1C12 0x00 0x00
./ethercat download --position 1 --type uint8 0x1C13 0x00 0x00
./ethercat download --position 1 --type uint16 0x1C12 0x01 0x1602
./ethercat download --position 1 --type uint16 0x1C12 0x02 0x1603
./ethercat download --position 1 --type uint16 0x1C12 0x00 0x02
./ethercat rescan

Everything works great after that sequence.

I guess my confusion lies in the fact that the tool successfully downloads the 
PDO’s using the ioctl interface without getting a “Protocol not supported” 
error. Is there a reason why I would get a “Protocol not supported” error using 
the application interface library to do this (ecrt_master_sdo_download()) but 
not using the tool? Is the master state the problem?

From: etherlab-users 
mailto:etherlab-users-boun...@etherlab.org>>
 on behalf of Gavin Lambert 
mailto:gavin.lamb...@tomra.com>>
Date: Thursday, June 28, 2018 at 7:45 PM
To: Derrill Vezina mailto:vezin...@gmail.com>>, 
"etherlab-users@etherlab.org<mailto:etherlab-users@etherlab.org>" 
mailto:etherlab-users@etherlab.org>>
Subject: Re: [etherlab-users] Failed to execute SDO download: Protocol not 
supported

You don’t need to perform explicit downloads of the PDO assignment or 
configuration registers at all, ever; they are managed internally by the master 
library.  Simply use the combination of ecrt_slave_config_pdos and 
ecrt_domain_reg_pdo_entry_list as shown in the examples.  You can use “ethercat 
cstruct” to generate the required data structures for these calls.  (In some 
cases or for particular slaves, eg. with overlapping or repeated PDOs, you 
might need to do something a little more complicated, but that is rare.)

If you have slaves with different revisions, note that different structures may 
be required for each revision, if the PDO layout has been changed.

If the slave does not support CoE (which is what the “protocol not supported” 
error implies) then it is not possible to alter the slave’s PDO assignment – it 
has a manufacturer-defined fixed setup.  You must make sure that the 
configuration and assignment defined in your application matches this, by using 
those APIs mentioned above.

From: Derrill Vezina
Sent: Friday, 29 June 2018 01:40
To: etherlab-users@etherlab.org<mailto:etherlab-users@etherlab.org>
Subject: [etherlab-users] Failed to execute SDO download: Protocol not supported

Hi,

I am currently using a Beckhoff EL2502 PWM output card with the Etherlab 1.5.2 
master using the generic ethernet driver. On startup, I am trying to set a PDO 
assignment SDO register using ecrt_master_sdo_download() and am getting an 
error back “Failed to execute SDO download: Protocol not supported”.

I am not able to set a PDO assignment SDO registers using the 
ecrt_slave_config_sdoX() calls…which from my reading of other mailing list 
posts is only used for configuration registers.

In turn, I was able to use the Ethercat Etherlab tool and change the PDO 
mapping so I assumed it is available from the application interface since they 
use the same calls (ioctl interface)

Beckhoff changed the firmware on the card and I’m trying to reassign the PDO’s 
to the old mappings… this isn’t the first time I’ve run into this problem so 
I'm looking for a solution for all cards that would have this problem. Ideally, 
id like to do 

Re: [etherlab-users] Failed to execute SDO download: Protocol not supported

2018-07-08 Thread Gavin Lambert
No, you should never need to run downloads via a script.

As I said, you do the downloads once manually and then get the cstruct output, 
and put that into your application code.  After this, simply starting your 
application and activating the master should automatically do the same 
configuration just prior to switching to SAFEOP – you don’t need to have any 
explicit SDO download code in your app; you only have the 
ecrt_domain_reg_pdo_entry_list().

You can use “ethercat debug 1”, start up your application, and then observe the 
syslog to see that it will automatically configure the 0x1C12 and 0x1C13 
registers with just that.  If things still aren’t working then this might also 
give you some additional hints.

As for “protocol not supported”, I’m not really sure.  What’s the output of 
“ethercat slaves -v” on that specific slave?

From: Derrill Vezina [mailto:vezin...@gmail.com]
Sent: Saturday, 7 July 2018 06:34
To: Gavin Lambert 
Cc: Derrill Vezina ; etherlab-users@etherlab.org
Subject: Re: [etherlab-users] Failed to execute SDO download: Protocol not 
supported

The problem is that the downloads are not persistent and the PDO / Sync 
registers do not hold on power cycle…so the downloads need to happen every time 
on boot. Is it common practice to run the SDO downloads using the tool using a 
script on startup?

Going back to my original question, what is the difference is between running 
the etherlab tool to download SDO’s in which im not getting the “Protocol not 
supported” error (which I have done and it re-assigns the PDO entries correctly 
which changes the output of the cstruct to match the Rev25 and below), and 
trying to do it from my software using the application library using  
ecrt_master_sdo_download() (pre-cyclic task / ecrt_domain_reg_pdo_entry_list()) 
which essentially uses the same code using the ioctl interface which is where 
I'm getting the “Protocol not supported” error?


On Jul 5, 2018, at 7:30 PM, Gavin Lambert 
mailto:gavin.lamb...@tomra.com>> wrote:

Ok.  So after you do that and rescan, check the output of “ethercat cstruct”.  
This should have changed to reflect the new configuration of the assignment 
registers (assuming that the slave actually did accept the downloads), and this 
is the data that you need to include in your application code instead of trying 
to explicitly write to the assignment registers.  (Using the correct sequence 
in ecrt_domain_reg_pdo_entry_list makes Etherlab do those same downloads 
internally during configuration.)

From: Derrill Vezina [mailto:dvez...@caroneng.com]
Sent: Friday, 6 July 2018 02:03
To: Gavin Lambert mailto:gavin.lamb...@tomra.com>>; 
Derrill Vezina mailto:vezin...@gmail.com>>; 
etherlab-users@etherlab.org<mailto:etherlab-users@etherlab.org>
Subject: Re: [etherlab-users] Failed to execute SDO download: Protocol not 
supported

Hi Gavin.

I fully understand that this is a Beckhoff / integration issue and not anything 
to do with the master. I have been doing as you instructed and it has worked 
with different revisions with different PDO structures with a bunch of 
different cards up until this specific situation. Without getting too in depth 
with it, Beckhoff allowed setting two PDO’s originally including the period and 
duty cycle of the PWM wave output on the EL2502 for each channel. They decided 
on REV25+ that they were going to remove the period as a PDO and use it as an 
SDO. To fix this, Beckhoff has instructed a sequence of setting some startup 
SDO configuration registers that would set the PDO assignment back to the “old 
way” in which I have successfully done using the Etherlab tool using the 
following commands (only one card on the stack after starting the master):

./ethercat download --position 1 --type uint16 0x1C12 0x00 0x00
./ethercat download --position 1 --type uint8 0x1C13 0x00 0x00
./ethercat download --position 1 --type uint16 0x1C12 0x01 0x1602
./ethercat download --position 1 --type uint16 0x1C12 0x02 0x1603
./ethercat download --position 1 --type uint16 0x1C12 0x00 0x02
./ethercat rescan

Everything works great after that sequence.

I guess my confusion lies in the fact that the tool successfully downloads the 
PDO’s using the ioctl interface without getting a “Protocol not supported” 
error. Is there a reason why I would get a “Protocol not supported” error using 
the application interface library to do this (ecrt_master_sdo_download()) but 
not using the tool? Is the master state the problem?

From: etherlab-users 
mailto:etherlab-users-boun...@etherlab.org>>
 on behalf of Gavin Lambert 
mailto:gavin.lamb...@tomra.com>>
Date: Thursday, June 28, 2018 at 7:45 PM
To: Derrill Vezina mailto:vezin...@gmail.com>>, 
"etherlab-users@etherlab.org<mailto:etherlab-users@etherlab.org>" 
mailto:etherlab-users@etherlab.org>>
Subject: Re: [etherlab-users] Failed to execute SDO download: Protocol not 
supported

You don’t need to perform explicit do

Re: [etherlab-users] Slave goes to OP mode after Master starts

2018-07-11 Thread Gavin Lambert
In the current stable branch, the slave selected as the reference clock (which 
is the first slave that has a DC clock, by default) and also any EoE slaves, 
are forced to OP mode even when the application is not active.  I assume that 
this is a misunderstanding about their requirements to provide a clock.

The quick fix is to ensure that the first slave on your network is something 
that won't care about being in OP, such as an infrastructure component like an 
EK1100.

Another fix is to use the default code branch, which includes a change to stop 
that behaviour by default (though you can re-enable it if you wish).  (Although 
if you do switch to the default branch then I recommend using the non-official 
patchset at 
https://sourceforge.net/u/uecasm/etherlab-patches/ci/default/tree/#readme as 
well, as this contains other improvements and fixes.)

From: Giel Hermans
Sent: Wednesday, 11 July 2018 22:24
To: 'etherlab-users@etherlab.org' 
Subject: [etherlab-users] Slave goes to OP mode after Master starts

Hi,

We have a Elmo Solo Twitter drive connected to the Ethercat master on 3 
different systems (Ubuntu machine with RT kernel, OpenSuse machine with RT 
kernel and Beaglebone Black with RT kernel) and see different behaviour between 
the systems as soon as the master is started. An application is not running .
On one of the 3 systems the drive communication goes well and we can access and 
control (with a Simulink model application) the drive (and connected motor) 
over Ethercat.
When the drive is connected to either of the other systems the drive won't stay 
in the PREOP mode but goes to SAFEOP and then OP. Controlling the drive is 
blocked.

All 3 systems work perfect with Beckhoff modules and a Maxon Epos3 drive. So it 
looks like it has to do something with combination drive - system.
We've teste multiple Elmo Solo Twitter drives.

We can't figure out what causes this problem and hope one of you can give us a 
hint.

As you can see in the in the logs from the systems, system 2 and 3 start 
loading SM2 and SM3 immediately after entering PREOP as if there is an 
application active.

Giel Hermans
Delft University of Technology.

System details:
Drive: ELMO Solo Twitter Gold with Ethercat option

Ethercat 1.5.2 on all 3 systems (same sourcecode)

System 1 (this one works good)

  *   PC with Ubuntu 14.04LTS
  *   Kernel version: 3.8.13.14-rt31
  *   Realtek RLT-8139 ethernet controller
  *   8139too ethernet driver
  *   Generic ethercat driver

System 2:

  *   PC with OpenSuse LEAP
  *   Kernel 3.14.79-rt85-1-preempt-rt
  *   Intel 82578DM Ethernet controller
  *   E1000e Ethernet driver
  *   E1000e Ethercat driver (also tested generic driver)

System 3:

  *   Beaglebone Black with linux verion from machinekit
  *   Kernel version: 3.8.13-xenomai-r83
  *   Ethernet controller on chip (couldn't find info)
  *   Generic ethercat driver

The ethercat logs from the systems are:
System 1:
[20396.352242] EtherCAT DEBUG 0-0: Configuring...
[20396.354785] EtherCAT DEBUG 0-0: Now in INIT.
[20396.354787] EtherCAT DEBUG 0-0: Clearing FMMU configurations...
[20396.354832] EtherCAT DEBUG 0-0: Clearing sync manager configurations...
[20396.354872] EtherCAT DEBUG 0-0: Clearing DC assignment...
[20396.354911] EtherCAT DEBUG 0-0: Configuring mailbox sync managers...
[20396.354913] EtherCAT DEBUG 0-0: SM0: Addr 0x1800, Size 140, Ctrl 0x26, En 1
[20396.354914] EtherCAT DEBUG 0-0: SM1: Addr 0x1900, Size 140, Ctrl 0x22, En 1
[20396.357809] EtherCAT DEBUG 0-0: Now in PREOP.
[20396.357810] EtherCAT DEBUG 0-0: Finished configuration.
[20396.357812] EtherCAT DEBUG 0-0: Ready for requests.
[20396.360231] EtherCAT 0: Slave states on main device: PREOP.
[20399.351568] EtherCAT DEBUG 0-0: Fetching SDO dictionary.
[20399.353147] EtherCAT DEBUG 0-0: SDO list fragments left: 3
[20399.353923] EtherCAT DEBUG 0-0: SDO list fragments left: 2
[20399.354402] EtherCAT DEBUG 0-0: SDO list fragments left: 1
[20400.348642] EtherCAT ERROR 0-0: Timeout while waiting for SDO 0x1000 object 
description response.
[20573.274616] EtherCAT 0: Link state of ecm0 changed to DOWN.
[20573.278577] EtherCAT 0: 0 slave(s) responding on main device.
[20573.278579] EtherCAT DEBUG 0: Master state machine detected link down on 
main device. Clearing slave list.
[20573.278580] EtherCAT 0: Stopping EoE thread.
[20573.278601] EtherCAT DEBUG 0: EoE thread exiting...
[20573.278619] EtherCAT 0: EoE thread exited.

System 2:
[20942.362944] EtherCAT DEBUG 0-0: Configuring...
[20942.365724] EtherCAT DEBUG 0-0: Now in INIT.
[20942.365728] EtherCAT DEBUG 0-0: Clearing FMMU configurations...
[20942.365979] EtherCAT DEBUG 0-0: Clearing sync manager configurations...
[20942.366240] EtherCAT DEBUG 0-0: Clearing DC assignment...
[20942.366906] EtherCAT DEBUG 0-0: Configuring mailbox sync managers...
[20942.366910] EtherCAT DEBUG 0-0: SM0: Addr 0x1800, Size 140, Ctrl 0x26, En 1
[20942.366912] EtherCAT DEBUG 0-0: SM1: Addr 0x1900, Size 140, Ctrl 0x22, En 1
[20942.370558] 

Re: [etherlab-users] Call to ecrt_domain_process takes sometimes very long (10ms!)

2018-04-05 Thread Gavin Lambert
On 5 April 2018 21:19, quoth Michael Ruder:
> In fact, the function that takes the long time is ecrt_domain_process (and
> not ecrt_domain_queue). However, if I do no longer the call to
> ecrt_domain_queue, then the ecrt_domain_process will not take long (that
> is what got me on the wrong track yesterday).

If you don't queue the domain datagram then there's nothing to process, so that 
makes sense. 

It's peculiar for ecrt_domain_queue or ecrt_domain_process to take all that 
long, however.  Even with a large network with a complicated PDO layout I've 
never seen these take very long.

Have you issued an mlockall at the start of your process?  It can also help to 
explicitly prefault your stack so that you don't get a page fault later if your 
stack depth grows.

I have had issues in the past where ecrt_master_receive took unexpectedly long; 
the culprit was the e1000e network driver, which during the poll sometimes 
triggered watchdog processing directly on that thread instead of on a 
background thread.  There's some patches in the unofficial patchset 
(http://sourceforge.net/u/uecasm/etherlab-patches/ci/default/tree/#readme) to 
resolve the cases that were encountered there, among other things.

> This only happens on my Yocto system but not on a Gentoo system with the
> identical kernel (4.14.28-rt23). On the Gentoo, the calls never take long, 
> even
> during transitions.

What network driver and hardware are you using?

___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Απ: AL status message 0x0036: "DC Sync0 Cycle Time"

2018-04-11 Thread Gavin Lambert
On 12 April 2018 03:52, quoth Christoph Schroeder:
> reffering to the last question on this list regarding a driver for the RasPi 
> 3 and
> kernel 4.x, which driver are you actually using? I thought the native drivers
> don't work with newer kernels. I am currently using the native driver for
> e1000e Intel cards on Debian Jessie (kernel 3.16) and would like to upgrade
> to Debian Stretch (kernel 4.9).

I'm successfully using e1000e on Debian Stretch using the ported driver in the 
unofficial patchset.

https://sourceforge.net/u/uecasm/etherlab-patches/ci/default/tree/#readme

___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Switch to OP state in parallel

2018-04-22 Thread Gavin Lambert
On 21 April 2018 16:45, quoth Philippe Leuba:
> I noticed that when we activate the master it takes a time that is 
> proportional
> to the number of slaves to switch them to OP state.
> Is there any reason the master can not do it in parallel ?

You can try the unofficial patchset 
(https://sourceforge.net/u/uecasm/etherlab-patches/ci/default/tree/#readme).

While it can't do it completely in parallel without consuming a lot of 
bandwidth and risking breaking the realtime cycle, one of the feature patches 
that this includes allows scanning and configuration to occur in parallel up to 
the configured bandwidth limits.  With default settings this results in blocks 
of 16 slaves at a time being configured in parallel.

___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Please help newbie to etherlab with setting PDOs

2018-03-28 Thread Gavin Lambert
Most of the examples show both inputs and outputs.

There's two different kinds of configuration for PDOs that you set up in 
advance:


  *   You need the core master library and the slave to agree on what PDOs are 
enabled in their Sync Managers.
 *   This is what the examples refer to as "configuring PDOs" and is done 
via ecrt_slave_config_pdos.
 *   This will update the PDO Assign registers, and (for the rare case of a 
slave that has fully reconfigurable PDOs) the PDO registers themselves.
 *   This is somewhat optional for slaves with fixed PDO assignments, but 
it's still a good idea to do this as it allows defining a domain for slaves 
that aren't yet online for whatever reason.
  *   You need your master app to know where to actually read/write the data in 
cyclic operation, and to associate an SM with a domain.
 *   This is what the examples refer to as "registering PDOs" and is done 
via ecrt_domain_reg_pdo_entry_list.
 *   It is technically sufficient to register only one entry in each PDO, 
as the other entries in the same PDO should always have contiguous memory 
layout (which you already know since you had to specify it when configuring the 
PDOs).  However it can be convenient to register several or all since this will 
give you explicit pointers to each entry.
 *   It *is* required to register at least one entry in each PDO that you 
will be reading/writing, as it is not safe to assume that the PDOs will 
actually be received/transmitted in the order that you configured.
 *   It is harmless to not register some PDO that you will not actually be 
reading or writing - it will still end up in the SM and domain by virtue of the 
PDO configuration.
 *   This also lets you associate a PDO with a domain, although note that 
you have to take the SM into account as well.  All PDOs in one SM must be in 
the same domain; PDOs in separate SMs may be either in the same or separate 
domains.

The ETG documentation should give you a good grounding in the fundamentals of 
EtherCAT (such as SMs, PDOs, entries, DC), although it can be tricky to find 
the right documents - the official standards are mostly impenetrable and you 
may have better luck reading other more informal documents.  Beckhoff also has 
some fairly good documents to get a good grounding in EtherCAT in general.

Though you do need that initial grounding in EtherCAT to understand Etherlab, 
none of those documents will directly help you with the Etherlab library; while 
it does of course implement an EtherCAT master and so does share the same 
underlying fundamentals, the exact APIs involved and how to use them are unique 
to Etherlab.  There is, however, a fairly good manual included with the 
library; some places are a little out of date but it should still give you a 
good idea how to get started.

From: Montgomery-Smith, Stephen [mailto:step...@missouri.edu]
Sent: Thursday, 29 March 2018 10:15
Subject: Re: Please help newbie to etherlab with setting PDOs

Thank you for your response.  Sorry for the late response, but I was only able 
to try it out today because of life was so busy.

You were correct - all I had to do was activate the master, and then wait a 
while.

I looked at the dc_user example.  What is registering PDOs all about?  Do I 
just need to register one of the registers in a PDO mapping, or do I need to 
register all of them?  I noticed that registering just one from each PDO 
mapping made the domain_data_size correct.  I have one PDO mapping for input 
and one PDO mapping for output.  Should I create two different domains for each 
PDO mapping?  Or can I use both PDO mappings with one domain?

Is there an example program which involves both input and output?

Is there documentation on the Ethercat User Group website that could help me 
sort this all out?  (I have membership, so I can look at everything they have.)

On 03/18/2018 05:49 PM, Gavin Lambert wrote:
Your custom configuration is not applied to the slave until you activate the 
master.  After that you can confirm the settings using "ethercat pdos" or those 
methods (though note that it does not happen immediately - there will be some 
delay before the slave is actually configured).

Have a look at the dc_user and other example programs for examples of slave 
configuration.

From: Montgomery-Smith, Stephen
Sent: Saturday, 17 March 2018 09:21
To: etherlab-users@etherlab.org<mailto:etherlab-users@etherlab.org>
Subject: [etherlab-users] Please help newbie to etherlab with setting PDOs


I am trying out etherlab to connect my computer to a Parker Hannifin motor 
controller - you can read about it here: 
http://www.parker.com/Literature/Electromechanical%20North%20America/CATALOGS-BROCHURES/PSeries/PSeries_UG_EtherCAT_A.pdf



I am trying to tell it to use a certain PDO, which on page 68 of the manual is 
called 1st PDO mapping.  I use the ecrt_slave_config_pdos function to tell it 
what PDO to 

Re: [etherlab-users] Please help newbie to etherlab with setting PDOs

2018-03-18 Thread Gavin Lambert
Your custom configuration is not applied to the slave until you activate the 
master.  After that you can confirm the settings using "ethercat pdos" or those 
methods (though note that it does not happen immediately - there will be some 
delay before the slave is actually configured).

Have a look at the dc_user and other example programs for examples of slave 
configuration.

From: Montgomery-Smith, Stephen
Sent: Saturday, 17 March 2018 09:21
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Please help newbie to etherlab with setting PDOs


I am trying out etherlab to connect my computer to a Parker Hannifin motor 
controller - you can read about it here: 
http://www.parker.com/Literature/Electromechanical%20North%20America/CATALOGS-BROCHURES/PSeries/PSeries_UG_EtherCAT_A.pdf



I am trying to tell it to use a certain PDO, which on page 68 of the manual is 
called 1st PDO mapping.  I use the ecrt_slave_config_pdos function to tell it 
what PDO to use.  But whenever I run the program, and ask it to print out the 
PDO using ecrt_master_get_pdo and ecrt_master_get_pdo_entry, I get output that 
tells me it is using the 2nd PDO mapping (see below).  I feel like I am missing 
something.  Is there a good sample program that shows me how to set up 
something like this that I can copy?



(I have used EC-Master from Acontis, and I was able operate the controller 
using their software.  But I want to find an open source solution.)



Output of my program:
Output PDO 0x1601 with 4 entries:
  PDO entry 0: 0x6040 0 16
  PDO entry 1: 0x607a 0 32
  PDO entry 2: 0x60b8 0 16
  PDO entry 3: 0x60fe 1 32
Input PDO 0x1a01 with 6 entries:
  PDO entry 0: 0x6041 0 16
  PDO entry 1: 0x6064 0 32
  PDO entry 2: 0x60f4 0 32
  PDO entry 3: 0x60b9 0 16
  PDO entry 4: 0x60ba 0 32
  PDO entry 5: 0x60fd 0 32
Thanks, Stephen
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Handle slave reboots once the master has been activated

2018-03-21 Thread Gavin Lambert
On 21 March 2018 21:21, quoth Joye Laurent:
> Is there any chance to handle slave reboots during the realtime operation
> (ecrt_master_activate has already been called)?
> I've seen that, once a slave reboots, the master indicates a working counter
> change and the slave is automatically reset in OP mode.
> 
> Is it possible, from my master user space application, to continue to
> communicate with the freshly rebooted slave device, without deactivating
> the master?

Yes, that happens automatically -- it's why the slave returns to OP after 
reboot, because it gets reconfigured and then starts working normally again.  
The working counter should return to normal after this.

You do have to be careful to set up your slave configurations the correct way, 
however -- in particular you can only use pure position-based addressing if you 
have a simple chain network, such that when a slave is unplugged or rebooted 
everything with a higher position also disappears from the network until it 
returns.  If you have any tree branches in your network, such that some slaves 
will remain online but change positions when one slave reboots, then you need 
to use alias-based addressing instead (or a hybrid, where you use an alias 
address for the first slave in each "branch" and positional addressing for each 
slave after that in the same branch).

___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Failed to execute SDO download: Protocol not supported

2018-06-28 Thread Gavin Lambert
You don’t need to perform explicit downloads of the PDO assignment or 
configuration registers at all, ever; they are managed internally by the master 
library.  Simply use the combination of ecrt_slave_config_pdos and 
ecrt_domain_reg_pdo_entry_list as shown in the examples.  You can use “ethercat 
cstruct” to generate the required data structures for these calls.  (In some 
cases or for particular slaves, eg. with overlapping or repeated PDOs, you 
might need to do something a little more complicated, but that is rare.)

If you have slaves with different revisions, note that different structures may 
be required for each revision, if the PDO layout has been changed.

If the slave does not support CoE (which is what the “protocol not supported” 
error implies) then it is not possible to alter the slave’s PDO assignment – it 
has a manufacturer-defined fixed setup.  You must make sure that the 
configuration and assignment defined in your application matches this, by using 
those APIs mentioned above.

From: Derrill Vezina
Sent: Friday, 29 June 2018 01:40
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Failed to execute SDO download: Protocol not supported

Hi,

I am currently using a Beckhoff EL2502 PWM output card with the Etherlab 1.5.2 
master using the generic ethernet driver. On startup, I am trying to set a PDO 
assignment SDO register using ecrt_master_sdo_download() and am getting an 
error back “Failed to execute SDO download: Protocol not supported”.

I am not able to set a PDO assignment SDO registers using the 
ecrt_slave_config_sdoX() calls…which from my reading of other mailing list 
posts is only used for configuration registers.

In turn, I was able to use the Ethercat Etherlab tool and change the PDO 
mapping so I assumed it is available from the application interface since they 
use the same calls (ioctl interface)

Beckhoff changed the firmware on the card and I’m trying to reassign the PDO’s 
to the old mappings… this isn’t the first time I’ve run into this problem so 
I'm looking for a solution for all cards that would have this problem. Ideally, 
id like to do it through the application interface and avoid running a script 
on startup that uses the tool.

Has anyone has success with doing this type of transaction?
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Can I only apply gavinl's driver patches?

2018-10-11 Thread Gavin Lambert
You’ve misread that.

The patches are for 4.1, 4.4, 4.9, 4.13, and 4.14.  There aren’t any specific 
patches for minor versions of 4.1.

It is generally recommended (at least by me) to install all patches (the ones 
for future versions of the kernel simply won’t be used).  However, you can 
choose to apply only a subset of patches if you wish, particularly omitting 
some of the feature patches.  Instructions are given in the readme.

From: Mohsen Alizadeh Noghani 
Sent: Friday, 12 October 2018 04:52
To: etherlab-users@etherlab.org; Gavin Lambert 
Subject: Can I only apply gavinl's driver patches?

I'm using kernel 4.1.18 and RTAI 5.0.1.
Patched r8169 drivers are available in gavinl's 
<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fu%2Fuecasm%2Fetherlab-patches%2Fci%2Fdefault%2Ftree%2Fdevices%2F=02%7C01%7Cgavin.lambert%40tomra.com%7C495ec88ff0394fc4bd2d08d62f917982%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C636748699191576019=16pHkf3luaysLAGkwVH4iovr1Ct5Czm6ibKwI0fEKXM%3D=0>
 patchset for kernel 4.1, 4.1.13, and 4.1.14.
1- Considering my kernel version, which one do you suggest I use?
2- What do I have do to differently before and during EtherLab's installation 
process for this to work? Can I just apply the driver patches and proceed with 
the 
installation<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.etherlab.org%2Fpipermail%2Fetherlab-users%2F2015%2F002820.html=02%7C01%7Cgavin.lambert%40tomra.com%7C495ec88ff0394fc4bd2d08d62f917982%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C636748699191586036=ftt6DBv3Whf45BJWIsKX5RRiqx1juak%2B%2F5bQQUC0iVc%3D=0>
 as usual? Or do I, alternatively, have to apply the other patches?
Best,
Mohsen


___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Failed to get reference clock time: Input/output error

2018-10-28 Thread Gavin Lambert
This is normal for the first few cycles; it takes several cycles for the 
reference clock to “sync in”.  It should eventually start working.

This is why there’s a patch in the unofficial patchset to suppress the fprintf 
error when using the usermode library.

From: Mohsen Alizadeh Noghani
Sent: Friday, 26 October 2018 19:16
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Failed to get reference clock time: Input/output error

Hello everyone.
When I call ecrt_master_reference_clock_time -right after 
ecrt_master_sync_slave_clocks()- in my userspace code, I get the following 
error every cycle.
Failed to get reference clock time: Input/output error.
I'm using stable-1.5 branch.
Has anyone been able to resolve this issue?
Best,
Mohsen

___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Where, in the application cycle, should I call ecrt_master_64bit_reference_clock_time/queue?

2018-10-25 Thread Gavin Lambert
ecrt_master_64bit_reference_clock_time_queue must be called at any point prior 
to calling ecrt_master_send.

ecrt_master_64bit_reference_clock_time must be called following some previous 
calls to ecrt_master_64bit_reference_clock_time_queue, ecrt_master_send, and 
ecrt_master_recv (in that order), and before calling 
ecrt_master_64bit_reference_clock_time_queue a second time.  (It doesn’t have 
to be on the immediately subsequent cycle, but that usually makes the most 
sense.)  Interleaved calls to other functions are irrelevant (apart from 
closing the master, of course).

This should be fairly obvious, if you think about it.  (And it’s documented.)

As for how often to call them, that’s entirely up to how often you want the 
answer, either for internal diagnostics or to look at the datagram in the 
network trace.  It is purely informational and does not affect slave clock 
synchronisation.  If you’re not interested in the answer, then you don’t need 
to call it at all.

From: Mohsen Alizadeh Noghani 
Sent: Thursday, 25 October 2018 20:28
To: etherlab-users@etherlab.org; Gavin Lambert ; 
graeme.f...@touchcut.com
Subject: Where, in the application cycle, should I call 
ecrt_master_64bit_reference_clock_time/queue?

Hello everyone.
I would like to know where should I call
ecrt_master_64bit_reference_clock_time_queue()
and
ecrt_master_64bit_reference_clock_time()
1- with respect to each other (does it matter which one is called first?)
2- with respect the distributed clock function calls? i.e.
ecrt_master_application_time()
ecrt_master_sync_reference_clock()
ecrt_master_sync_slave_clocks()
3- with respect to
ecrt_domain_queue()
and
ecrt_master_send()

Best,
Mohsen



___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Difference between "default" and "stable-1.5" branches

2018-11-15 Thread Gavin Lambert
It’s mostly the other way around.

In theory, “stable-1.5” is the “release version” considered stable by IgH, and 
“default” is that plus some additional changes which will eventually become 1.6.

The patchset is based on “default” because some of the patches it used to 
contain have been integrated into the default branch already, and because 
hopefully at some point that will happen to more of them and it will become 1.6 
for real.  (But don’t hold your breath.)

Unfortunately, things are actually a little messier than that, because IgH are 
adding some additional features and fixes directly to stable-1.5 and not always 
porting them across to default as well, hence why I added the “stable” folder 
in the patchset to bring them back into alignment.

From: Mohsen Alizadeh Noghani 
Sent: Thursday, 15 November 2018 22:12
To: etherlab-users@etherlab.org; Gavin Lambert 
Subject: Difference between "default" and "stable-1.5" branches

Hello everyone.
What is the difference between "default" and "stable-1.5" branches of the 
SourceForge repository?
I know the"default" version is the one for applying Gavin's patchest to.
Is "stable-1.5" basically "default" + the patches in "stable" folder of the 
patchset?
Best,
Mohsen
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] AL status message 0x001B: "Sync manager watchdog" error with digital output module

2018-11-04 Thread Gavin Lambert
A "sync manager watchdog" error means that the slave did not receive an 
EtherCAT packet within the configured timeout.

You're specifying a 5ms cyclic period, which in itself may be ok, but it's a 
bit slower than is typical.  You might want to check what the default EtherCAT 
timeout is for the slave - perhaps it is expecting a faster cycle by default 
and is thus timing out because you're talking to it too slowly.  Consider 
either increasing the rate of your cyclic loop or calling 
ecrt_slave_config_watchdog to specify a longer timeout interval, if that is the 
case.

You're also not reading any of the slave's inputs.  This usually doesn't 
trigger a watchdog error, but again it might depend on the specific slave's 
defaults.

From: jiangjiang kai
Sent: Saturday, 3 November 2018 20:25
To: etherlab-users@etherlab.org
Subject: [etherlab-users] AL status message 0x001B: "Sync manager watchdog" 
error with digital output module


Dear all,



I have tried to bring up the Omron ethercat coupler with some digital inputs 
and outputs modules. With the help of the example code I can read out the value 
from digital input modules. But with the digital output module, I always get 
the error msg: "AL status message 0x001B: "Sync manager watchdog"."



I have read some messages from the other users, it looks like that related to 
the settings of SM2 sync manager watchdog, and I have tried to do  "PDO 
writting" in each cycle time. But I still get this error. Maybe some one can 
help me with this.



Thanks in advance.



Below is the code which is based on the "user" sample code and some debug Info:



(1)   PDO structure


[developer:~]$ sudo ethercat cstruct

  18:17
[sudo] password for developer:
/* Master 0, Slave 0, "NX-ECC201"
 * Vendor ID:   0x0083
 * Product code:0x0083
 * Revision number: 0x00010002
 */

ec_pdo_entry_info_t slave_0_pdo_entries[] = {
{0x7000, 0x01, 1},
{0x7000, 0x02, 1},
{0x7000, 0x03, 1},
{0x7000, 0x04, 1},
{0x, 0x00, 12}, /* Gap */
{0x3003, 0x04, 128},
{0x3006, 0x04, 128},
{0x300a, 0x02, 64},
{0x2002, 0x01, 8},
{0x, 0x00, 8}, /* Gap */
};

ec_pdo_info_t slave_0_pdos[] = {
{0x1600, 4, slave_0_pdo_entries + 0},
{0x17f6, 1, slave_0_pdo_entries + 4},
{0x1bf8, 3, slave_0_pdo_entries + 5},
{0x1bff, 1, slave_0_pdo_entries + 8},
{0x1bf4, 1, slave_0_pdo_entries + 9},
};

ec_sync_info_t slave_0_syncs[] = {
{0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
{1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
{2, EC_DIR_OUTPUT, 2, slave_0_pdos + 0, EC_WD_ENABLE},
{3, EC_DIR_INPUT, 3, slave_0_pdos + 2, EC_WD_DISABLE},
{0xff}
};





[developer:~]$ sudo ethercat pdos   

  18:19
SM0: PhysAddr 0x2800, DefaultSize  256, ControlRegister 0x26, Enable 1
SM1: PhysAddr 0x2a00, DefaultSize  256, ControlRegister 0x22, Enable 1
SM2: PhysAddr 0x1000, DefaultSize0, ControlRegister 0x64, Enable 1
  RxPDO 0x1600 ""
PDO entry 0x7000:01,  1 bit, ""
PDO entry 0x7000:02,  1 bit, ""
PDO entry 0x7000:03,  1 bit, ""
PDO entry 0x7000:04,  1 bit, ""
  RxPDO 0x17f6 ""
PDO entry 0x:00, 12 bit, "Gap"
SM3: PhysAddr 0x1c00, DefaultSize0, ControlRegister 0x20, Enable 1
  TxPDO 0x1bf8 ""
PDO entry 0x3003:04, 128 bit, ""
PDO entry 0x3006:04, 128 bit, ""
PDO entry 0x300a:02, 64 bit, ""
  TxPDO 0x1bff ""
PDO entry 0x2002:01,  8 bit, ""
  TxPDO 0x1bf4 ""
PDO entry 0x:00,  8 bit, "Gap"
/*/
/*/




(2)  The code:


#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include  /* clock_gettime() */
#include  /* mlockall() */
#include  /* sched_setscheduler() */


#include "ecrt.h"


/** Task period in ns. */
#define PERIOD_NS   (500)// 5ms

#define MAX_SAFE_STACK (8 * 1024) /* The maximum stack size which is
 guranteed safe to access without
 faulting */

//

/* Constants */
#define NSEC_PER_SEC (10)
#define FREQUENCY (NSEC_PER_SEC / PERIOD_NS)


//

// EtherCAT
static ec_master_t *master = NULL;
static ec_master_state_t master_state = {};

static ec_domain_t *domain1 = NULL;
static ec_domain_state_t domain1_state = {};

static ec_slave_config_t *sc_digit_out = NULL;
static ec_slave_config_state_t 

Re: [etherlab-users] Where should I call mlockall and setpriority in my code?

2018-10-02 Thread Gavin Lambert
They need to be called some time prior to activating the master.  It is not 
necessary to call them earlier than this, but it’s also not harmful to do so 
either (provided that the MCL_FUTURE option was specified).

From: Mohsen Alizadeh Noghani
Sent: Tuesday, 2 October 2018 22:39
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Where should I call mlockall and setpriority in my 
code?

In the example codes, for instance dc_user, mlockall is called after defining 
the slaveconfig and setpriority is called after ecrt_domain_data.
Is there a reason for not calling these functions earlier (for example in the 
first line of main)?
Best,
Mohsen
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Measuring the frequency of master sending the frames to network

2018-10-02 Thread Gavin Lambert
If you have hardware access to a slave then you can also hook a scope or other 
monitor to the ESC pins which indicate sync pulses or SOF/EOF (packet arrival). 
 This is probably easiest if you have a custom slave or if the particular slave 
you’re using exposes these for diagnostic purposes; otherwise I don’t recommend 
trying to crack an off-the-shelf slave open to try to access these signals. 

From: Graeme Foot
Sent: Wednesday, 3 October 2018 12:20
To: Mohsen Alizadeh Noghani ; etherlab-users@etherlab.org
Subject: Re: [etherlab-users] Measuring the frequency of master sending the 
frames to network

Two options:

1) You can use wireshark on another computer.

- Plug in a switch inline somewhere on your EtherCAT network, make sure it 
forwards without delay
- Also plug your second computer into the switch, make sure you disable all 
protocols on the network card (but not the card itself)

1a)
- In your application cycle call ecrt_master_sync_slave_clocks()
- Run your application and use wireshart to log your data
- Run the command:
"C:\Program Files\Wireshark\tshark.exe" -r data.pcap -T fields -e 
ecat.reg.dc.systimeL > data.txt
(replacing data.pcap and data.txt with your input and output filenames)

1b) If you have gavinl's patchset
- In your application cycle call ecrt_master_64bit_reference_clock_time_queue()
- Run your application and use wireshart to log your data
- Run the command:
"C:\Program Files\Wireshark\tshark.exe" -r data.pcap -T fields -e 
ecat.reg.dc.systime > data.txt
(replacing data.pcap and data.txt with your input and output filenames)

- Filter out the appropriate information from data.txt and analyse.  Note: 
wireshark will see each packet twice, once going out and once coming back in.  
If the switch is before your reference slave then the timestamp will only be in 
the returning packet, if it's after then it will be in both.


2) analyse the info within your app

2a)
- In your application cycle call ecrt_master_sync_slave_clocks()
- get the 32bit clock value using ecrt_master_reference_clock_time()

2b) If you have gavinl's patch set
- In your application cycle call ecrt_master_64bit_reference_clock_time_queue()
- get the 64bit clock value using ecrt_master_64bit_reference_clock_time()

- Analyse the results yourself in the app, or log to file


Notes:
- The wireshark message timestamp is not accurate enough by itself, hence using 
the distributed clock reference slave timestamp
- EtherCAT frames are broadcast messages so you don't need to do anything 
special on the switch for your wireshark PC to be able to see them
- See: 
https://www.wireshark.org/docs/dfref/e/ecat.html
 for a list of possible tshark ethercat fields
- The EtherCAT master syncs reference slave using the lower 32bits of the dc 
clock.  If your application is running at 1khz then this value rolls over every 
4.2 odd seconds, so gets more complicated to track long running time.  Gavinl's 
patchset adds the ability to read the whole 64bit timestamp using 
ecrt_master_sync_slave_clocks().

Regards,
Graeme Foot.



From: etherlab-users 
mailto:etherlab-users-boun...@etherlab.org>>
 On Behalf Of Mohsen Alizadeh Noghani
Sent: Tuesday, 2 October 2018 10:50 PM
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Measuring the frequency of master sending the frames 
to network

In motion control applications, smooth motion and small error often requires an 
update rate of at least 1 KHz.
When defining a task in RTAI, we can set its execution frequency. Therefore, if 
we set the frequency to 2 KHz, the master is expected to send EtherCAT frames 
every 0.5 ms + jitter.
Other than using a network probe (e.g. Beckhoff ET2000) connected to another PC 
and analyzing the timestamps, is there a reliable way for measuring this 
frequency? In other words, I want to stress test the master for a few hours and 
make sure that all frames are sent before the real-time deadlines.
Best,
Mohsen

___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] API for enabling/disabling sync managers of a slave

2018-10-01 Thread Gavin Lambert
That looks fine as far as it goes, but you do need to run the cyclic loop after 
calling ecrt_master_activate.  That kicks off the configuration process but it 
requires several cycles to complete and actually transition the slaves to OP.

And once your application exits, the master will automatically deactivate and 
return the slaves to PREOP.

From: Mohsen Alizadeh Noghani 
Sent: Monday, 1 October 2018 22:09
To: Gavin Lambert ; etherlab-users@etherlab.org
Subject: Re: [etherlab-users] API for enabling/disabling sync managers of a 
slave


I still haven't been able to enable sync managers (and thus change the state to 
SAFEOP)
Currently, I'm executing this 
code<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmohse-n%2FL7N_EtherLab%2Fblob%2Fmaster%2Fsimple_test.c=02%7C01%7Cgavin.lambert%40tomra.com%7Cde4676633de44877b14b08d6277d949a%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C636739817661893040=L9ZYnno%2FqdrZNpqI7Zp02Xglc8dUybnVKy%2BnXniYeik%3D=0>,
 which is basically the user example.
Output of $ethercat xml of the slave is:



  
  
30101
  
  

  
L7N






  #x1601
  2nd Receive PDO Mapping
  
#x6040
0
16
Controlword
UINT16
  
  
#x607a
0
32
Target Position
UINT32
  


  #x1a01
  2nd Transmit PDO Mapping
  
#x6041
0
16
Statusword
UINT16
  
  
#x6064
0
32
Position Actual Value
UINT32
  

  

  


On Wed, Sep 26, 2018 at 3:02 AM Gavin Lambert 
mailto:gavin.lamb...@tomra.com>> wrote:
You typically don’t need to explicitly disable a sync manager; you simply don’t 
refer to it or any PDOs it contains, and then it will not be included in the 
domain’s data.

Alternatively, you can configure the sync manager but then list zero PDOs for 
it, to explicitly set the PDO Assign register for that SM to 0 (for slaves that 
support flexible assignment).  Note that you should not enable the SM watchdog 
if you’re setting it to have zero PDOs.

It sounds like you should probably read the documentation for the EtherCAT 
protocol and for the Etherlab master in particular.

From: Mohsen Alizadeh Noghani 
mailto:m.aliza...@gmail.com>>
Sent: Wednesday, 26 September 2018 04:52
To: Gavin Lambert mailto:gavin.lamb...@tomra.com>>; 
etherlab-users@etherlab.org<mailto:etherlab-users@etherlab.org>
Subject: Re: [etherlab-users] API for enabling/disabling sync managers of a 
slave

Thanks Gavin.

1- Would
ecrt_slave_config_sync_manager(sc, 2, EC_DIR_OUTPUT, EC_WD_ENABLE )
enable Sync Manager 2 of slave sc?
2- How can I disable it then? I doesn't seems the function provides an option 
to enable/disable.

Best,
Mohsen


On Tue, Sep 25, 2018 at 2:40 AM, Gavin Lambert 
mailto:gavin.lamb...@tomra.com>> wrote:
You need to write an application, and then use ecrt_slave_config_sync_manager 
or ecrt_slave_config_pdos to configure the Sync Managers for each slave.

From: Mohsen Alizadeh Noghani
Sent: Tuesday, 25 September 2018 02:29
To: etherlab-users@etherlab.org<mailto:etherlab-users@etherlab.org>
Subject: [etherlab-users] API for enabling/disabling sync managers of a slave

Hello everyone.

Is there a function call that I can use for enabling a particular sync manager 
of a slave?
For example, I'd like to enable sync manager 2 of slave 1.

Best,
Mohsen

___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Requesting application layer state change in code

2018-10-01 Thread Gavin Lambert
Ordinarily you just call ecrt_master_activate to activate the master.  This 
will return slaves to PREOP (if they’re somehow in a different state – PREOP is 
the normal state when the master is not active however), configure them, then 
bring them to SAFEOP and then OP.

It will also do this again automatically if a slave reboots or otherwise falls 
out of OP while the master is active (which is why it’s important to use the 
slave_config_sdo methods instead of manually writing config SDOs).

See the example code.

(There is a way to manually request a different state, which is what the 
“ethercat state” command uses, but it is not intended for application use.)

From: messiah esfahani
Sent: Monday, 1 October 2018 22:05
To: ronaldo.merc...@diamond.ac.uk; etherlab-users@etherlab.org
Subject: Re: [etherlab-users] Requesting application layer state change in code

Thanks Ronaldo.
Now my question is, which function changes the state from PREOP to SAFEOP? Does 
"ecrt_master_activate" request this state transition too?
Sincerely,
Messiah

On Mon, Oct 1, 2018 at 12:24 PM 
ronaldo.merc...@diamond.ac.uk 
mailto:ronaldo.merc...@diamond.ac.uk>> wrote:
Hi,

It is the “ecrt_master_activate” call that causes the change from SAFEOP -> OP

Ronaldo


From: etherlab-users 
mailto:etherlab-users-boun...@etherlab.org>>
 On Behalf Of messiah esfahani
Sent: 01 October 2018 09:40
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Requesting application layer state change in code

Dear EtherLab users,
How can I request a change in application layer of a slave (e.g. SAFEOP -> OP) 
in code?
I have examined the examples and although they all eventually begin exchanging 
data with PDOs, I have not encountered an explicit function call that causes 
the transition from safe-operational to operational state.
Sincerely,
Messiah



--

This e-mail and any attachments may contain confidential, copyright and or 
privileged material, and are for the use of the intended addressee only. If you 
are not the intended addressee or an authorised recipient of the addressee 
please notify us of receipt by returning the e-mail and do not use, copy, 
retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not 
necessarily of Diamond Light Source Ltd.
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments 
are free from viruses and we cannot accept liability for any damage which you 
may sustain as a result of software viruses which may be transmitted in or with 
the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and 
Wales with its registered office at Diamond House, Harwell Science and 
Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom

___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] API for enabling/disabling sync managers of a slave

2018-09-24 Thread Gavin Lambert
You need to write an application, and then use ecrt_slave_config_sync_manager 
or ecrt_slave_config_pdos to configure the Sync Managers for each slave.

From: Mohsen Alizadeh Noghani
Sent: Tuesday, 25 September 2018 02:29
To: etherlab-users@etherlab.org
Subject: [etherlab-users] API for enabling/disabling sync managers of a slave

Hello everyone.

Is there a function call that I can use for enabling a particular sync manager 
of a slave?
For example, I'd like to enable sync manager 2 of slave 1.

Best,
Mohsen
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Error flag after requesting SAFEOP

2018-09-26 Thread Gavin Lambert
EC_WD_ENABLE enables the SM watchdog; it’s a separate thing from enabling the 
SM itself.  In general you should only activate it on one SM per slave – 
usually the output SM if the slave has outputs or the input SM otherwise.  If 
you don’t need the slave to drop from OP to SAFEOP when it loses communication 
with the master then you can leave the watchdog entirely disabled – though 
using the watchdog is usually recommended for output slaves for safety reasons.

Using erct_slave_config_sync_manager by itself is fairly pointless.  You need 
to specify the PDOs contained in the SM and then also actually use at least one 
PDO from each SM in your domain mapping.  Typically you use 
ecrt_slave_config_pdos to do the former and ecrt_domain_reg_pdo_entry_list for 
the latter.  See the example code.

From: Mohsen Alizadeh Noghani
Sent: Wednesday, 26 September 2018 22:32
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Error flag after requesting SAFEOP

Hello everyone.

When I request SAFEOP state for my slave (Mecapion L7N) using shell command

$ ethercat state --position 0 SAFEOP

the slave's flag changes from + to E, and the state stays at PREOP.

Additional Info:
In a previous project, I used SOEM library and had to deal with the same issue, 
which was fixed by manually enabling sync managers 2 & 3.

ec_slave[1].SM[2].SMflags |= 0x0001;
ec_slave[2].SM[3].SMflags |= 0x0001;

I tried to do the same by the adding following lines in my a simple code

ret1 = erct_slave_config_sync_manager(sc, 2, EC_DIR_INPUT, EC_WD_ENABLE)
ret2 =  erct_slave_config_sync_manager(sc, 3, EC_DIR_OUTPUT, EC_WD_ENABLE)

Both function calls are successful (ret1=ret2=0) but the slave won't reach 
SAFEOP.


___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] e1000e driver freeze on kernel 4.9.80 rtai 5.1

2018-09-25 Thread Gavin Lambert
One of the first things you should try is to triage the patches by rolling them 
back and then adding them one at a time and testing until you find which patch 
appears to introduce the problem (or whether it exists in the baseline without 
any patches).  In most cases you can then try skipping that patch and applying 
subsequent ones until you find more problematic patches or you successfully 
apply the remainder.

Please share your findings so that we know where to look for the culprit.

(Also, if it manages to write some information to the syslog before freezing 
then that could be helpful.)

FWIW, I’ve been using PREEMPT_RT kernel 4.9.51 with e1000e for a long while 
without issues.

From: René Reimann
Sent: Tuesday, 25 September 2018 19:28
To: Gianluca Medini ; etherlab-users@etherlab.org
Subject: Re: [etherlab-users] e1000e driver freeze on kernel 4.9.80 rtai 5.1

Hello,

we are experiencing the same problem with rtai 5.1 kernel 4.9.80 and rtai 5.0 
kernel.
The system freezes randomly after several minutes with the e1000e and the 
unofficial patches.
Does somebody have an idea how to fix this?

Best Regards
René Reimann
On 23.09.2018 22:29, Gianluca Medini wrote:
Hi all, I've tested the driver e1000e on rtai 5.1 kernel 4.9.80.
I'm using Gavin Lambert unofficial patches set that includes patched drivers 
for 4.9.80.
The system  freezes randomly after some  minutes.
The Igb driver on same configuration works perfectly.

Someone have experienced the same issue?
GM




___

etherlab-users mailing list

etherlab-users@etherlab.org<mailto:etherlab-users@etherlab.org>

http://lists.etherlab.org/mailman/listinfo/etherlab-users<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.etherlab.org%2Fmailman%2Flistinfo%2Fetherlab-users=02%7C01%7Cgavin.lambert%40tomra.com%7C4e061ec02fe04622d16708d622b86ca7%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C636734572828494098=qwxQi92RlqOAUXDeP8LWBp7c%2FASFzSt2gRtyX9Zkleo%3D=0>
[Logo]<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ialb.uni-bremen.de=02%7C01%7Cgavin.lambert%40tomra.com%7C4e061ec02fe04622d16708d622b86ca7%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C636734572828494098=s9xz8CutmxeWMNAcG0Oyxj9OJtb%2FFkou1q6Im8h51dc%3D=0>

René Reimann
Research Assistent

IALB - Institut for electrical drives, power electronics and devices
Otto-Hahn-Allee 1
28359 Bremen
Raum: S1390
Tel.: +49 421 218 62699
Fax: +49 421 218 98 62699
E-Mail: rreim...@ialb.uni-bremen.de<mailto:rreim...@ialb.uni-bremen.de>

www.ialb.uni-bremen.de<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ialb.uni-bremen.de=02%7C01%7Cgavin.lambert%40tomra.com%7C4e061ec02fe04622d16708d622b86ca7%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C636734572828494098=s9xz8CutmxeWMNAcG0Oyxj9OJtb%2FFkou1q6Im8h51dc%3D=0>


[https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.avast.com%2Fsig-email%3Futm_medium%3Demail%26utm_source%3Dlink%26utm_campaign%3Dsig-email%26utm_content%3Demailclient=02%7C01%7Cgavin.lambert%40tomra.com%7C4e061ec02fe04622d16708d622b86ca7%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C636734572828494098=pxczI6vpHQb9qT7nuL5OXDCxkTqM4Y5CJ3xrXKNCiu4%3D=0>

Virenfrei. 
www.avast.com<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.avast.com%2Fsig-email%3Futm_medium%3Demail%26utm_source%3Dlink%26utm_campaign%3Dsig-email%26utm_content%3Demailclient=02%7C01%7Cgavin.lambert%40tomra.com%7C4e061ec02fe04622d16708d622b86ca7%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C636734572828494098=pxczI6vpHQb9qT7nuL5OXDCxkTqM4Y5CJ3xrXKNCiu4%3D=0>


___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Read from/write to the slave's object dictionary using SDOs

2018-09-25 Thread Gavin Lambert
There’s a number of different ways to do it, depending on why and how you want 
to do it.

If this is a configuration setting (especially if it needs to be re-sent every 
time the slave reboots) that you can write (without needing to read anything), 
then you should use one of the ecrt_slave_config_sdo*() methods.  This will not 
do it immediately but will do it when you activate the master, and also if the 
slave reboots at any time while the master is active.

If it’s a one-off request/query which you only do before activating the master, 
then you should use one of the ecrt_master_sdo_*() methods.  This will execute 
immediately and wait for the response.

If you want to do it while the master is active, then you can either call 
ecrt_master_sdo_*() from a separate (non-realtime) thread (at the cost of a 
little extra latency on the realtime cycle), or you can use 
ecrt_slave_config_create_sdo_request() and related methods to perform polling 
on the realtime thread (for some extra code complexity).

If it’s just something you need to do during commissioning and then never again 
(eg. if you can save the setting to the slave permanently), then you can use 
the “ethercat download” command.

From: Mohsen Alizadeh Noghani
Sent: Wednesday, 26 September 2018 03:41
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Read from/write to the slave's object dictionary 
using SDOs

Hello everyone.

How can I read from or write to an entry of a slave's object dictionary using 
SDO? I'm going to do this before my real-time task.
For example, I would like to set the value of 0x6040 to 15 before my cyclic 
task.

Best,
Mohsen
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] API for enabling/disabling sync managers of a slave

2018-09-25 Thread Gavin Lambert
You typically don’t need to explicitly disable a sync manager; you simply don’t 
refer to it or any PDOs it contains, and then it will not be included in the 
domain’s data.

Alternatively, you can configure the sync manager but then list zero PDOs for 
it, to explicitly set the PDO Assign register for that SM to 0 (for slaves that 
support flexible assignment).  Note that you should not enable the SM watchdog 
if you’re setting it to have zero PDOs.

It sounds like you should probably read the documentation for the EtherCAT 
protocol and for the Etherlab master in particular.

From: Mohsen Alizadeh Noghani 
Sent: Wednesday, 26 September 2018 04:52
To: Gavin Lambert ; etherlab-users@etherlab.org
Subject: Re: [etherlab-users] API for enabling/disabling sync managers of a 
slave

Thanks Gavin.

1- Would
ecrt_slave_config_sync_manager(sc, 2, EC_DIR_OUTPUT, EC_WD_ENABLE )
enable Sync Manager 2 of slave sc?
2- How can I disable it then? I doesn't seems the function provides an option 
to enable/disable.

Best,
Mohsen


On Tue, Sep 25, 2018 at 2:40 AM, Gavin Lambert 
mailto:gavin.lamb...@tomra.com>> wrote:
You need to write an application, and then use ecrt_slave_config_sync_manager 
or ecrt_slave_config_pdos to configure the Sync Managers for each slave.

From: Mohsen Alizadeh Noghani
Sent: Tuesday, 25 September 2018 02:29
To: etherlab-users@etherlab.org<mailto:etherlab-users@etherlab.org>
Subject: [etherlab-users] API for enabling/disabling sync managers of a slave

Hello everyone.

Is there a function call that I can use for enabling a particular sync manager 
of a slave?
For example, I'd like to enable sync manager 2 of slave 1.

Best,
Mohsen

___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] (configuring pdo and sdo for a slave motion controller)

2019-01-15 Thread Gavin Lambert
On 16 January 2019 01:52, quoth Samiha Islam:
> I was a bit confused so as to how to modify the SDO data for the 'ethrcat 
> xml' command. I am concerned that the commands 'ethercat config' and 
> 'ethercat domain' yields nothing. I am working on a modified version of the 
> 'user' example for my slave. It contains the cyclic task.

The "ethercat xml" command displays an SII XML document inferred from the 
slave's SII EEPROM and/or CoE; it should be similar (but less detailed) to the 
one supplied by the slave vendor.  It's not something that you can modify.

It is normal for "ethercat config" and "ethercat domain" to display nothing 
when no application is running.  They provide information about the config and 
data requested by the running application.

> So the PDO cyclic control loop only works in OP state? Not in PREOP? Do I 
> change the state and then run the code? 

The cyclic loop in the application will execute while slaves are in any state.  
Slaves only provide valid PDO inputs in SAFEOP or OP, and only follow PDO 
outputs in OP.  The master will automatically try to transition the slaves from 
PREOP to OP over several cycles after you've called ecrt_master_activate, based 
on the configuration you supplied before calling that.  It's up to your 
application logic to detect when the slaves are in a good state to perform 
whatever task is required (and to detect if they encounter an error or other 
abnormal state).

It sounds like you should have a read of both the documentation for the 
EtherLab master itself and for the EtherCAT protocol in general.


Gavin Lambert
Senior Software Developer

Direct dial: +64 (9) 929 2632 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] (no subject)

2019-01-09 Thread Gavin Lambert
If you just want to test reading/writing SDO data in PREOP, you can use the 
download and upload commands of the ethercat command line tool.

To actually bring the slave to OP state and get it to do anything interesting, 
however, you have to write an application with a PDO cyclic control loop; it’s 
not possible to keep a slave in OP from the command line alone.

The “ethercat xml” command is not particularly useful.  What are you imagining 
that you might want to use it for?


Gavin Lambert
Senior Software Developer

Direct dial:+64 (9) 929 2632

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: Samiha Islam
Sent: Thursday, 10 January 2019 01:29
To: etherlab-users@etherlab.org
Subject: [etherlab-users] (no subject)

Hello,
I have installed etherlab 2.1 successfully with Ubuntu 12.04 LTS and rt preempt 
kernel 3.4.69. I am using command line tools and with only one slave Faulhaber 
motion controller mc 5005. I have installed most things using the bundle 
provided in etherlab website. May I please get some guidance how I can handle 
the sdo data for the slave? Also how to use the ethercat xml command for the 
slave info? Thanks.

With regards,
Samiha Islam
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] etherlab-users Digest, Vol 140, Issue 4 EtherCAT slave B X20 IF 10G3

2019-02-20 Thread Gavin Lambert
Note that there are two different kinds of PDO reconfiguration:

1. Configuration of the PDO Assign objects, to specify which PDO objects are 
included in each Sync Manager.
2. Configuration of the PDO objects themselves, to specify which individual 
data elements are included in each PDO.

Some slaves support neither.  Most slaves (where they support CoE at all) 
support #1 only.  Very few support #2.

Etherlab handles both through the same ecrt_slave_config_pdos configuration 
call; the distinction between the two is simply that for slaves that don't 
support #2 you have to be careful to specify the layout of the PDO objects 
exactly identical to what the slave itself specifies (including order and 
padding).  Etherlab will log a warning when it notices that the slave doesn't 
support altering the configuration but as long as the configuration matches 
then it doesn't need to, and overall configuration will proceed successfully.

If it works with TwinCAT then it is unlikely that the slave is buggy (although 
it is possible that there is some important difference between the SII XML and 
SII EEPROM contents); it is more likely that your configuration code has an 
error.

With your app not running, try hard-rebooting the slave and letting Etherlab 
re-detect it (this is important to clear any configuration set in error), then 
run the "ethercat cstruct" command to get the code for the slave's default 
configuration, then compare this with your existing code and with your desired 
configuration.

You can also use the "ethercat download" command to manually assign new values 
to the PDO Assign objects to match your desired configuration.  Verify your 
selection with "ethercat pdos -v", and then use "ethercat cstruct" to get the 
corresponding code to put into your application to select the same 
configuration in the future.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
> -Original Message-
> From: Matthias Bartsch
> Sent: Thursday, 21 February 2019 06:02
> To: 'etherlab-users@etherlab.org' 
> Subject: Re: [etherlab-users] etherlab-users Digest, Vol 140, Issue 4 EtherCAT
> slave B X20 IF 10G3
> 
> Hello Gavin,
> thank you very much for your answer, The slave doesn't support the
> reconfiguration of the PDOs. I have tried it anyway but the slave gives an
> error. I tried also the configure only the sync managers but it didn't resolve
> the problem. I also use different input and output domains as the slave
> doesn't support LRW command.
> I assume the slave implementation is buggy but as it's working with Twincat
> it's difficult to convince the supplier of the module.
> 
> Best regards
> Matthias
> 
> -Ursprüngliche Nachricht-
> Von: etherlab-users [mailto:etherlab-users-boun...@etherlab.org] Im
> Auftrag von etherlab-users-requ...@etherlab.org
> Gesendet: Montag, 18. Februar 2019 23:25
> An: etherlab-users@etherlab.org
> Betreff: etherlab-users Digest, Vol 140, Issue 4
> 
> Send etherlab-users mailing list submissions to
>   etherlab-users@etherlab.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>   https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F
> %2Flists.etherlab.org%2Fmailman%2Flistinfo%2Fetherlab-
> usersdata=02%7C01%7Cgavin.lambert%40tomra.com%7C511fad447e8
> d4ad7c95a08d6975517d4%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0
> %7C636862789071638451sdata=UJOWUhHX2rg8ZuZQFHmJa8lbkUTMo
> 1vqHDre%2FX8mz%2F0%3Dreserved=0
> or, via email, send a message with subject or body 'help' to
>   etherlab-users-requ...@etherlab.org
> 
> You can reach the person managing the list at
>   etherlab-users-ow...@etherlab.org
> 
> When replying, please edit your Subject line so it is more specific than "Re:
> Contents of etherlab-users digest..."
> 
> 
> Today's Topics:
> 
>1. Re: EtherCAT slave B X20 IF 10G3 goes into operatonal mode
>   but doesn't update the process image (Gavin Lambert)
> 
> 
> --
> 
> Message: 1
> Date: Mon, 18 Feb 2019 22:24:54 +
> From: Gavin Lambert 
> To: Matthias Bartsch ,
>   "'etherlab-users@etherlab.org'" 
> Subject: Re: [etherlab-users] EtherCAT slave B X20 IF 10G3 goes into
>   operatonal mode but doesn't update the process image
> Message-ID:
>820.eurprd03.prod

Re: [etherlab-users] Userspace application.

2019-02-13 Thread Gavin Lambert
You have to write a little state machine (or budget equivalent using flags), to 
keep track of which step in the process you’re up to.

I hope you’re not confusing register requests with process data.  Process data 
can be read and written in a single cycle.  Register requests (and other 
request types) require multiple cycles.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: Shiva V M C 
Sent: Thursday, 14 February 2019 15:52
To: Gavin Lambert 
Subject: Re: [etherlab-users] Userspace application.

Hi Gavin
Can you please help me with a mentioned set of statements in a flow for writing 
value  to a register and then reading again from the same register.

Thanks in advance

On Thu, 14 Feb, 2019, 3:50 AM Gavin Lambert 
mailto:gavin.lamb...@tomra.com> wrote:
That’s not how you do register requests.

For a write request, you first call ecrt_reg_request_data() to get a pointer 
and then write the data to be written into that buffer.  Then you call 
ecrt_reg_request_write() once to start the request.  The request occurs 
asynchronously in the background and you have to call ecrt_reg_request_state() 
once per cycle to tell when it is completed.  You must not try to start another 
read or write or alter the data in the write buffer until after the request has 
completed (with success or failure).

Reads are similar; you call ecrt_reg_request_read() once to start the request, 
then ecrt_reg_request_state() once per cycle until it reports success (or 
failure) and only then read the resulting data out of the 
ecrt_reg_request_data() buffer.

Both operations may take an arbitrary number of cycles to complete, since they 
can be queued behind other requests.

You can start a read and write in the same cycle but only on separate request 
objects, and they will get queued anyway so there’s not much point.  You 
absolutely should not try to sleep in the cyclic loop – the only sleep allowed 
in there is the “main” sleep to wait for the next cycle.


Gavin Lambert
Senior Software Developer


[cid:image001.png@01D4C47E.7406C0B0]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.compacsort.com=02%7C01%7Cgavin.lambert%40tomra.com%7C8f85145cbfbc4bfc2e6808d692277b9c%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C636857095619216153=ZGYuhxT9VvGN%2B3koc%2F9s9qGia93yeagah5HAUhMj8YI%3D=0>[cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png]<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.facebook.com%2FCompacsort=02%7C01%7Cgavin.lambert%40tomra.com%7C8f85145cbfbc4bfc2e6808d692277b9c%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C636857095619226161=x8lovsaT3Axiqp8GmJZE87VzSNmThwzkobGG79%2FBV1c%3D=0>[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png]<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Fcompac-sorting-equipment%2F=02%7C01%7Cgavin.lambert%40tomra.com%7C8f85145cbfbc4bfc2e6808d692277b9c%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C636857095619236170=IDxfsailKdPtUKGPYsbLWFYnHhxcLio3crkvSicDL4s%3D=0>[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png]<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fvimeo.com%2Fcompacsort=02%7C01%7Cgavin.lambert%40tomra.com%7C8f85145cbfbc4bfc2e6808d692277b9c%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C636857095619236170=vzMJLRS2EVJk3nEVtskdlnXP5JC7dScRIJFrjuMgoac%3D=0>[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png]<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2Fcompacsort=02%7C01%7Cgavin.lambert%40tomra.com%7C8f85145cbfbc4bfc2e6808d692277b9c%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C636857095619246175=phq1lRRrWL4nttfRqMia3CKf6ZVySQEuXd7K%2FQ%2FFeTM%3D=0>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | 
tomra.com<https://emea01.safelinks.protection.outlook

Re: [etherlab-users] Userspace application.

2019-02-13 Thread Gavin Lambert
That’s not how you do register requests.

For a write request, you first call ecrt_reg_request_data() to get a pointer 
and then write the data to be written into that buffer.  Then you call 
ecrt_reg_request_write() once to start the request.  The request occurs 
asynchronously in the background and you have to call ecrt_reg_request_state() 
once per cycle to tell when it is completed.  You must not try to start another 
read or write or alter the data in the write buffer until after the request has 
completed (with success or failure).

Reads are similar; you call ecrt_reg_request_read() once to start the request, 
then ecrt_reg_request_state() once per cycle until it reports success (or 
failure) and only then read the resulting data out of the 
ecrt_reg_request_data() buffer.

Both operations may take an arbitrary number of cycles to complete, since they 
can be queued behind other requests.

You can start a read and write in the same cycle but only on separate request 
objects, and they will get queued anyway so there’s not much point.  You 
absolutely should not try to sleep in the cyclic loop – the only sleep allowed 
in there is the “main” sleep to wait for the next cycle.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: etherlab-users  On Behalf Of Shiva V 
M C
Sent: Thursday, 14 February 2019 00:59
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Userspace application.

Hi all,
I have done with my user space application and I m able to run the application 
too.
Now I want to perform 2 exercise i.e.,
1.ecrt_reg_request_write();
2.ecrt_reg_request_read();
I m able to read the particular register,but couldn't able to write on any of 
the register.
So,could any one help me whats happening?.

This is my code snippet.
 #define DigInSlavePos  0, 0
#define Beckhoff_EL1240 0x0002, 0x02312862
I m doing this before activating master,

if(!(sc_dig_in = 
ecrt_master_slave_config(master,DigInSlavePos,Beckhoff_EL1240)))
{
fprintf(stderr, "Failed to configure BeckHoff  Salve.\n");
return -1;
 }
regis=ecrt_slave_config_create_reg_request(sc_dig_in,127);

Then called cyclic_task as below
void cyclic_task()
  {
  ec_reg_request *regis;
  ecrt_master_receive(master);
   ecrt_domain_process(domain1);
   check_domain1_state(); //optional
   if (counter) counter--;
   else
{   counter = FREQUENCY;
 blink = !blink;
 check_master_state(); //optional
 check_slave_config_states(); //optional;
 ecrt_reg_request_write(regis,0xf80, 64);
 sleep(1);
 ecrt_reg_request_read(regis,0xf80, 64);
// send process data
 ecrt_domain_queue(domain1);
 ecrt_master_send(master);
  }
}


--
Thanks & Regards
Shiva V M C
09880153358
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] EtherCAT slave B X20 IF 10G3 goes into operatonal mode but doesn't update the process image

2019-02-18 Thread Gavin Lambert
I'm not familiar with that specific slave, but if a slave has reconfigurable 
PDOs then you may be required to actually configure them before you can 
successfully communicate with it.

This requires calling ecrt_slave_config_pdos with the appropriate PDO 
definitions, which must be compatible with some configuration that the slave 
supports (check the syslog when you activate the master to see if there are any 
errors occurring during configuration, possibly with "ethercat debug 1" active 
before running your app).  See the example code included with Etherlab.

(If you don't call this, then Etherlab assumes the slave's default PDO layout, 
which might be empty for some slaves.  If you do call it with invalid 
arguments, then depending on the slave it may be left with its original 
configuration, an empty configuration, or some subset of your intended 
configuration.)

Some slaves may also require specific SDO setup before entering OP state - you 
can use ecrt_slave_config_sdo* functions to register these.  (Note that you 
should not use this to configure the PDO Config/Assign objects; that's what the 
previous function takes care of for you.)

The slave device's manual should explain the supported PDO layouts and other 
configuration options.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: etherlab-users  On Behalf Of 
Matthias Bartsch
Sent: Monday, 18 February 2019 23:47
To: 'etherlab-users@etherlab.org' 
Subject: [etherlab-users] EtherCAT slave B X20 IF 10G3 goes into operatonal 
mode but doesn't update the process image

Hello @all!

I'm trying to use a "B X20 IF 10G3" EtherCAT  interface device with the IgH 
1.5.2 EtherCAT master and Gavin's patch set 20171102.
The B device use the Hilscher EtherCAT slave implementation.
The configuration and startup  of the device seems OK and the device is going 
into operational state. But the working counter for the device isn't increased 
and no cyclic (PDO) communication is possible.
Access via SDO in preoperational state works.
I have checked the communication with TwinCAT and it's working. TwinCAT doesn't 
set any special SDO at startup and the addresses of the sync managers seems to 
be the same as the IgH stack uses.
I have also created a new SII eeprom image from the slaves ESI file but no 
success.
Has somebody faced already a similar situation?
I have logged the startup sequence with wireshark and itlooks like that TwinCAT 
configures every parameter each time  when it starts but the IgH stack doesn't 
do that (maybe because the settings from the SII memory are the same used for 
the communication?). I'm not so familiar in interpreting the wireshark log so 
maybe somebody can give me an advice what's maybe the problem.

Best regards
Matthias

___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] INFO: task EtherCAT-EoE:4263 blocked for more than 120 seconds

2019-05-21 Thread Gavin Lambert
Try reconfiguring Etherlab with --enable-rtmutex.  This performs better in 
PREEMPT_RT mode anyway, and certainly will alter that particular code path.

Otherwise, be careful with your threading.  IIRC in RTAI mode you had to supply 
your own mutex callbacks; in user mode these should usually be removed because 
it will use standard Linux mutexes instead.  But you still need to be careful 
to use some APIs only from the RT cyclic thread and some APIs only when that 
thread is not running.

Unfortunately, I don’t use EoE myself, so I can't provide much further help.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Bilko AS, Oguz Dilmac
Sent: Tuesday, 21 May 2019 21:26
To: etherlab-users@etherlab.org
Subject: [etherlab-users] INFO: task EtherCAT-EoE:4263 blocked for more than 
120 seconds

Hi,

We are moving from RTAI kernel space (2.6.32 32 bit kernel) application to 
PREEMPT-RT user space application. We are using Gavin's patch set on kernel 
4.9.130 64bit kernel.

After around 15 hours of testing with servo drives, we see these kernel 
messages and our cyclic task hangs:

[62495.878833] INFO: task EtherCAT-EoE:4263 blocked for more than 120 seconds.
[62495.878848]   Tainted: G   OE   4.9.130-rt125 #2 [62495.878855] 
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" 
disables this message.
[62495.878861] EtherCAT-EoE    D    0  4263  2 0x [62495.878872]  
8a26b5b24200 8a26b5b24200 8a26bfc9cd40
8a26b7175a00
[62495.878885]  8a26b3da5a00 af52019bfd48 ba6cb64b
00ffaf52019bfd70
[62495.878923]  8a26bfc9cd40 af52019bfd50 8a26b3da5a00
8a26b3e56080
[62495.878934] Call Trace:
[62495.878949]  [] ? __schedule+0x24b/0x580 [62495.878956]  
[] schedule+0x3d/0xd0 [62495.878962]  [] 
schedule_timeout+0x29b/0x420 [62495.878969]  [] 
__down+0x76/0xc0 [62495.878977]  [] ? 
cpu_cgroup_can_attach+0x80/0xb0 [62495.878984]  [] 
down+0x41/0x50 [62495.879014]  [] 
ec_master_eoe_thread+0xb6/0x210 [ec_master] [62495.879039]  
[] ? ecrt_master_reset+0x40/0x40 [ec_master] [62495.879045]  
[] kthread+0xe8/0x100 [62495.879052]  [] ? 
kthread_park+0x60/0x60 [62495.879057]  [] 
ret_from_fork+0x57/0x70

We didn't have such an error with RTAI.

What can I check?

Best regards,

Oguz.

--
Oguz Dilmac
ARGE Bolumu

Bilko AS, R Department

Perpa Ticaret Merkezi B Blok Kat 11 Nr. 1740
TR-34384 Okmeydani Istanbul Turkey
Tel : +90 212 220 07 40  Fax :   +90 212 210 47 01
e-mail : odil...@bilko-automation.com
web site : 
https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.bilko-automation.comdata=02%7C01%7Cgavin.lambert%40tomra.com%7C1ad9a4aedf5548404edf08d6ddce5636%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C636940275611306196sdata=7g5uRE0%2F%2B4482iwmFHeMcKTWGmWEcp6SeuKC11VBnT4%3Dreserved=0


___
etherlab-users mailing list
etherlab-users@etherlab.org
https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.etherlab.org%2Fmailman%2Flistinfo%2Fetherlab-usersdata=02%7C01%7Cgavin.lambert%40tomra.com%7C1ad9a4aedf5548404edf08d6ddce5636%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C636940275611306196sdata=ldCnKiKWk4%2BeIg7U2d0A4fyjEJOEuzlIzri1Duju5oU%3Dreserved=0
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Random Datagram Unmatched

2019-05-20 Thread Gavin Lambert
ec_generic can be a mixed bag at 1kHz, depending on your hardware and other 
processing load.  It usually works, but not always.

If you haven’t already, you can try using ec_igb with a PREEMPT_RT kernel; 
that’s usually more stable than ec_generic.  (Xenomai would be even more 
stable, but is usually not required at 1kHz.)

Another possibility to consider is that it might be your cables; they could be 
getting a noise spike from somewhere and corrupting the packet.  Check the 
error counters in the slaves (“ethercat crc” and/or “ethercat diag”) and try 
using STP cable if you can rather than UTP, and avoid running it alongside 
power or motor cables.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: Viola Roberto
Sent: Tuesday, 21 May 2019 02:39
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Random Datagram Unmatched

Hi everybody,
  i’m playing with this great library and it’s just works!
I’m running it on a Intel Atom E3930 Dual Core 1.3GHz with 4.14.109 preemptive 
+ xenomai 3.1.

So i started compiling the xenomai example over the ec_generic module. It 
works, but sometimes (randomly) i saw a classic “datagram UNMATCHED”

[ 4187.708617] EtherCAT WARNING 0: 1 datagram UNMATCHED!
[ 4187.844433] EtherCAT WARNING: Datagram 89b4783bc798 (domain0-0-main) was 
SKIPPED 1 time.
[ 4188.392447] EtherCAT 0: Domain 0: Working counter changed to 3/3

The error is not deterministic but it occurs often if i increase the load of 
the system.
Reading the ML i understood that at 1KHz everything should run fine even with 
the ec_generic (i have 2 igb port BTW), isn’t it?
I’ve tried 1KHz, 500Hz, 100Hz but the issue is always there (stepping down the 
frequency of the main loop causing the issue be less visible).

I’ve also tried to playing with the ethernet IRQ throttling but they make no 
differences.

ifname="enp2s0"
ifconfig $ifname up
ethtool -L $ifname combined 1
ethtool -C $ifname rx-usecs 0 # default 3
ethtool -C $ifname tx-usecs 0 # default 3

I’ve tried to change the thread RT priority with 50-82-… but the issue is 
always there.

When it happens, looking the stats from “ifconfig”, there aren’t any drop of 
packages (rx and tx go together correctly).

I have no other idea except compiling with –enable-rtdm: i’ve tried but the 
compiling/linking process fails.
Here are my steps:

./bootstrap
CFLAGS=`/usr/xenomai/bin/xeno-config --alchemy --rtdm --compat --cflags`
LDFLAGS=`/usr/xenomai/bin/xeno-config --alchemy --rtdm --compat --ldflags`
./configure --enable-kernel --enable-generic --enable-ccat --disable-8139too 
--disable-e100 --disable-e1000 --disable-e1000e --disable-r8169 
--enable-sii-assign --enable-hrtimer --enable-igb 
--with-linux-dir=/usr/src/linux-headers-4.14.109/ --prefix=/usr --enable-rtdm 
--with-xenomai-dir=/usr/xenomai/
make all modules

/usr/xenomai/lib/xenomai/bootstrap.o: In function `xenomai_main':
bootstrap.c:(.text+0x0): multiple definition of `xenomai_main'
/usr/xenomai/lib/xenomai/bootstrap.o:bootstrap.c:(.text+0x0): first defined here
/usr/xenomai/lib/xenomai/bootstrap.o:(.rodata+0x0): multiple definition of 
`xenomai_auto_bootstrap'
/usr/xenomai/lib/xenomai/bootstrap.o:(.rodata+0x0): first defined here
/root/ethercat/lib/.libs/libethercat_rtdm.so: undefined reference to `rt_printk'
/root/ethercat/lib/.libs/libethercat_rtdm.so: undefined reference to 
`rt_dev_ioctl'
/root/ethercat/lib/.libs/libethercat_rtdm.so: undefined reference to 
`rt_dev_open'
/root/ethercat/lib/.libs/libethercat_rtdm.so: undefined reference to 
`rt_dev_close'
collect2: error: ld returned 1 exit status
Makefile:421: recipe for target 'ec_xenomai_example' failed
make[4]: *** [ec_xenomai_example] Error 1
make[4]: Leaving directory '/root/ethercat/examples/xenomai'
Makefile:454: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/root/ethercat/examples'
Makefile:406: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving di

Re: [etherlab-users] ecrt_slave_config_reg_pdo_entry() returns "No such file or directory"

2019-09-16 Thread Gavin Lambert
There is no "switch".  If you specify the same configuration as the slave 
already contains, then it just uses that configuration.  If you specify a 
different configuration, then it will try to remap it, which may fail if the 
slave doesn't support remapping or if you specify something incorrect.  But 
it's not even getting that far below -- it's failing sooner than that because 
your configuration is inconsistent.

Dump the actual contents of the arrays that you're passing to 
ecrt_slave_config_pdos and to ecrt_domain_reg_pdo_entry_list.  If the master is 
doing something different between the two cases, it's because you're passing 
different data, or you're trying to configure the wrong slave.

It's hard to say anything concrete without seeing the code, but for example if 
you look at the trace output below, you are trying to register index 0x562A in 
the domain, but that index isn't in the SM configuration.  (It's also bit 
length 0, which is peculiar in itself, and strongly suggests a bug in your 
code.)

FWIW, it is normal in an application to hard-code the content of the SM 
mappings for a particular device type -- or to mostly-hard-code it, if there 
can be some variations between actual devices such as different installed 
modules or different oversampling configurations requiring different input 
layouts.  Usually the discovery/flexibility is only at the addressing level, 
and if the I/O layout changes or support for a new device is required then you 
have to update other code anyway.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Gary Grobe
Sent: Saturday, 14 September 2019 12:28
To: etherlab-users@etherlab.org
Subject: Re: [etherlab-users] ecrt_slave_config_reg_pdo_entry() returns "No 
such file or directory"

"When you call ecrt_slave_config_pdos, you are telling Etherlab either what 
PDOs the slave already uses in its default PDO assignment, or which ones you 
*want* the slave to use."

In my case, I'm calling ecrt_slave_config_pdos telling Etherlab about the PDO's 
using the default assignments, and also expecting to use them. 
Is there a difference code-wise between both sides of that "or" in your 
response?

Using just a single device, I have a test program which works perfectly. 
None of the PDO's are remapped and so when
ecrt_domain_reg_pdo_entry_list() is called, it finds the entries and all is 
good. The order of calls is:

  * ecrt_request_master()
  * ecrt_master_create_domain()
  * ecrt_ecrt_master_slave_config()
  * ecrt_slave_config_pdos()
  * ecrt_domain_reg_pdo_entry_list()

I have a second program that makes the exact same calls, and in this case, the 
PDO's are being remapped and so I'm trying to understand the "switch" that 
causes one piece of code to NOT remap entries, and another with the exact same 
calls to remap entries. In this case, the call to
ecrt_domain_reg_pdo_entry_list() is failing because it's not finding the 
expected entries as shown in the output below of the previous post.

Having said that, there is one difference between the two programs that I'm 
pretty certain is causing the issue, but not understanding the why. 
The second program up-front, before calling ecrt_request_master(), performs an 
auto-discovery of the devices on the network and using this info, rebuilds the 
exact same structures 'ethercat cstruct' outputs. 
This is then fed into the same call stack. To do this, it uses the same 
functionality as that of the ethercat tool. The other program (that works fine) 
has the syncs, pdos, entries, and domains hard-coded, basically with the output 
of 'ethercat cstruct' embedded.

Can you provide clarification about the "switch" that might cause one program 
to remap entries whereas the other does not while using the same call stack? 
I've also tried resetting sockets, and making ioctl calls to reboot and rescan 
the device between discover and configuration to no avail, but haven't quite 
exhausted these attempts yet, still may be doing something wrong time-wise.

Thanks,

On 9/12/19 7:09 PM, Gavin Lambert wrote:
> Each sync manager contains a set of PDOs, which are potentially exchanged in 
> the domain datagram.  A slave boots up with a typical configuration (and 
> basic slaves do not change it), but some slaves allow the master to select a 
> different set of PDOs for each SM, when they require an atypical 
> configuration.
>
> When you call ecrt_slave_config_pdos, you are telling Etherlab either what 
> P

Re: [etherlab-users] ecrt_slave_config_reg_pdo_entry() returns "No such file or directory"

2019-09-09 Thread Gavin Lambert
You will receive that error if you specify a PDO index/subindex that does not 
exist in the slave, according to the configuration that Etherlab is aware of at 
the time.

This either requires a slave to already be present in the network and scanned 
with that PDO already included in its default PDO set, or it requires you to 
have previously called ecrt_slave_config_pdos() with the slave's 
current/desired SM layout.

It's recommended to do the latter, as it also works when the slaves are not yet 
online -- and it gives you the ability to select PDOs which are not in the 
slave's default set.  Although of course some slaves have restrictions on which 
PDOs you can select together, and others do not let you change the default PDO 
set -- but you can still explicitly specify it via ecrt_slave_config_pdos() so 
that you can create a configuration without needing the slaves to be online.

See the example apps.  Also see the code generated by "ethercat cstruct".


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Gary Grobe
Sent: Tuesday, 10 September 2019 11:24
To: etherlab-users@etherlab.org
Subject: [etherlab-users] ecrt_slave_config_reg_pdo_entry() returns "No such 
file or directory"

I'm working a new userspace app with etherlab and have managed to discover 
slaves and configure PDO's and am now at the point of doing mass registrations 
of PDO's.

In domain.c is the ecrt_domain_reg_pdo_entry_list() function which iterates 
through an array of ec_pdo_entry_reg_t's. As it iterates through the array, the 
call stack is roughly ...

     ecrt_domain_reg_pdo_entry_list()
         ecrt_master_slave_config()
             ec_master_add_slave_config()
         ecrt_slave_config_reg_pdo_entry()
             ioctl()

The first of seven ec_pdo_entry_reg_t objects in the array was successful. 
However, on the second iteration of the input array, the result (errno) from 
the call to ioctl() in
ecrt_slave_config_reg_pdo_entry() of slave_config.c is failing with "No such 
file or directory".

I've triple checked the inputs which appear to be correct, but recall reading 
somewhere's that there may be checks to the capabilities of
ioctl() calls handling a device which I'm not clear on. I was hoping someone 
might be able to comment or explain if this is the case or have other ideas as 
to what might be going on?

The exact message is:
     "Failed to register PDO entry: No such file or directory"




--
_The contents of this email message and any attachments are intended solely for 
the addressee(s).  This message (including any attachments) may contain 
confidential, proprietary, privileged and/or private information. The 
information is intended to be for the use of the individual or entity 
designated above. If you are not the intended recipient of this message, please 
notify the sender immediately, and delete the message and any attachments.  
_Any disclosure, reproduction, distribution or other use of this message or any 
attachments by an individual or entity other than the intended recipient is 
prohibited. __ ___
etherlab-users mailing list
etherlab-users@etherlab.org
https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.etherlab.org%2Fmailman%2Flistinfo%2Fetherlab-usersdata=02%7C01%7Cgavin.lambert%40tomra.com%7C223e112ada8d4970aeb408d7357cd7d9%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637036682624195995sdata=3E5W5i5ZTQXthvKg%2Fi9iWylTvHsK3rzUOFy%2FE2bQLuA%3Dreserved=0
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] ecrt_slave_config_reg_pdo_entry() returns "No such file or directory"

2019-09-12 Thread Gavin Lambert
Where you should start:

1. Ensure that the Etherlab master is running, but that you do not have any 
applications running.
2. Reboot your slave to reset it to the default configuration; and wait a 
moment for it to be re-scanned.
3. Run "ethercat cstruct" to generate the code for this default configuration.

Normally, you should just use this as-is.  But (if the slave supports it) you 
can alternatively alter parts of it to select different PDOs, if you require 
something different from the defaults.  But you have to be consistent about it.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-----
From: Gavin Lambert
Sent: Friday, 13 September 2019 12:09
To: Gary Grobe ; etherlab-users@etherlab.org
Subject: Re: [etherlab-users] ecrt_slave_config_reg_pdo_entry() returns "No 
such file or directory"

Each sync manager contains a set of PDOs, which are potentially exchanged in 
the domain datagram.  A slave boots up with a typical configuration (and basic 
slaves do not change it), but some slaves allow the master to select a 
different set of PDOs for each SM, when they require an atypical configuration.

When you call ecrt_slave_config_pdos, you are telling Etherlab either what PDOs 
the slave already uses in its default PDO assignment, or which ones you *want* 
the slave to use.  This internally makes those ecrt_slave_config_sync_manager 
and ecrt_slave_config_pdo_assign_add calls that you see below.  And this will 
change the slave's "default mapping" until you reboot the slave.

You need to make sure that this is consistent both with the PDOs that the slave 
will allow you to configure and with the ones that you are intending to 
register in your domain.  As I said before.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Gary Grobe
Sent: Friday, 13 September 2019 04:37
To: etherlab-users@etherlab.org
Subject: Re: [etherlab-users] ecrt_slave_config_reg_pdo_entry() returns "No 
such file or directory"

Let me ask this ... master/slave_config.c has the following function.

     void ec_slave_config_load_default_mapping(
     const ec_slave_config_t *sc,
     ec_pdo_t *pdo
     )
     {

And just a few lines down there's this comment.

     // find PDO in any sync manager (it could be reassigned later)
     for (i = 0; i < sc->slave->sii_image->sii.sync_count; i++) {
     sync = >slave->sii_image->sii.syncs[i];

Can anyone comment as to why/how a PDO could possibly be reassigned at a later 
time?

I ask because with only one device online (master debug output below), notice 
that the 2nd subindex (after a proper "Entry") has changed and therefore not 
being found. I'd expect to see 0x60FE instead of 0x562A and 0x01 as the 
subindex.

---
[177023.668497] EtherCAT: Requesting master 0...
[177023.668503] EtherCAT DEBUG 0: IDLE -> OPERATION.
[177023.668506] EtherCAT: Successfully requested master 0.
[177023.668516] EtherCAT DEBUG 0: ecrt_master_create_domain(master =
0xc7ddebfa)
[177023.668519] EtherCAT DEBUG 0: Created domain 0.
[177023.668534] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 
0xc7ddebfa, alias = 0, position = 0, vendor_id = 0x009a, 
product_code = 0x00030924) [177023.668537] EtherCAT DEBUG 0: Creating slave 
configuration for 0:0, 0x009A/0x00030924.
[177023.668542] EtherCAT DEBUG 0 0:0: Attached slave main-0.
[177023.670926] EtherCAT DEBUG 0 0:0: ecrt_slave_config_sync_manager(sc = 
0xd8f76f5b, sync_index = 0, dir = 1, watchdog_mode = 2) [177023.670938] 
EtherCAT DEBUG 0 0:0: 
ecrt_slave_config_pdo_assign_clear(sc = 0xd8f76f5b, sync_index = 0) 
[177023.670945] EtherCAT DEBUG 0 0:0: ecrt_slave_config_sync_manager(sc = 
0xd8f76f5b, sync_index = 1, dir = 2, watchdog_mode = 2) [177023.670952] 
EtherCAT DEBUG 0 0:0: 
ecrt_slave_config_pdo_assign_clear(sc = 0xd8f76f5b, sync_index = 1) 
[177023.670959] EtherCAT DEBUG 0 0:0: ecrt_slave_config_sync_manager(sc = 
0xd8f76f5b, sync_index = 2, dir = 1, watchdog_mode = 1) [17

Re: [etherlab-users] ecrt_slave_config_reg_pdo_entry() returns "No such file or directory"

2019-09-12 Thread Gavin Lambert
Each sync manager contains a set of PDOs, which are potentially exchanged in 
the domain datagram.  A slave boots up with a typical configuration (and basic 
slaves do not change it), but some slaves allow the master to select a 
different set of PDOs for each SM, when they require an atypical configuration.

When you call ecrt_slave_config_pdos, you are telling Etherlab either what PDOs 
the slave already uses in its default PDO assignment, or which ones you *want* 
the slave to use.  This internally makes those ecrt_slave_config_sync_manager 
and ecrt_slave_config_pdo_assign_add calls that you see below.  And this will 
change the slave's "default mapping" until you reboot the slave.

You need to make sure that this is consistent both with the PDOs that the slave 
will allow you to configure and with the ones that you are intending to 
register in your domain.  As I said before.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Gary Grobe
Sent: Friday, 13 September 2019 04:37
To: etherlab-users@etherlab.org
Subject: Re: [etherlab-users] ecrt_slave_config_reg_pdo_entry() returns "No 
such file or directory"

Let me ask this ... master/slave_config.c has the following function.

     void ec_slave_config_load_default_mapping(
     const ec_slave_config_t *sc,
     ec_pdo_t *pdo
     )
     {

And just a few lines down there's this comment.

     // find PDO in any sync manager (it could be reassigned later)
     for (i = 0; i < sc->slave->sii_image->sii.sync_count; i++) {
     sync = >slave->sii_image->sii.syncs[i];

Can anyone comment as to why/how a PDO could possibly be reassigned at a later 
time?

I ask because with only one device online (master debug output below), notice 
that the 2nd subindex (after a proper "Entry") has changed and therefore not 
being found. I'd expect to see 0x60FE instead of 0x562A and 0x01 as the 
subindex.

---
[177023.668497] EtherCAT: Requesting master 0...
[177023.668503] EtherCAT DEBUG 0: IDLE -> OPERATION.
[177023.668506] EtherCAT: Successfully requested master 0.
[177023.668516] EtherCAT DEBUG 0: ecrt_master_create_domain(master =
0xc7ddebfa)
[177023.668519] EtherCAT DEBUG 0: Created domain 0.
[177023.668534] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 
0xc7ddebfa, alias = 0, position = 0, vendor_id = 0x009a, 
product_code = 0x00030924) [177023.668537] EtherCAT DEBUG 0: Creating slave 
configuration for 0:0, 0x009A/0x00030924.
[177023.668542] EtherCAT DEBUG 0 0:0: Attached slave main-0.
[177023.670926] EtherCAT DEBUG 0 0:0: ecrt_slave_config_sync_manager(sc = 
0xd8f76f5b, sync_index = 0, dir = 1, watchdog_mode = 2) [177023.670938] 
EtherCAT DEBUG 0 0:0: 
ecrt_slave_config_pdo_assign_clear(sc = 0xd8f76f5b, sync_index = 0) 
[177023.670945] EtherCAT DEBUG 0 0:0: ecrt_slave_config_sync_manager(sc = 
0xd8f76f5b, sync_index = 1, dir = 2, watchdog_mode = 2) [177023.670952] 
EtherCAT DEBUG 0 0:0: 
ecrt_slave_config_pdo_assign_clear(sc = 0xd8f76f5b, sync_index = 1) 
[177023.670959] EtherCAT DEBUG 0 0:0: ecrt_slave_config_sync_manager(sc = 
0xd8f76f5b, sync_index = 2, dir = 1, watchdog_mode = 1) [177023.670971] 
EtherCAT DEBUG 0 0:0: 
ecrt_slave_config_pdo_assign_clear(sc = 0xd8f76f5b, sync_index = 2) 
[177023.670981] EtherCAT DEBUG 0 0:0: 
ecrt_slave_config_pdo_assign_add(sc = 0xd8f76f5b, sync_index = 2, 
pdo_index = 0x1600) [177023.670984] EtherCAT DEBUG 0 0:0: Loading default 
mapping for PDO 0x1600.
[177023.670988] EtherCAT DEBUG 0 0:0: Entry 0x607A:00.
[177023.670990] EtherCAT DEBUG 0 0:0: Entry 0x60FE:01.
[177023.670993] EtherCAT DEBUG 0 0:0: Entry 0x6040:00.
[177023.671001] EtherCAT DEBUG 0 0:0: 
ecrt_slave_config_pdo_mapping_clear(sc = 0xd8f76f5b, pdo_index =
0x1600)
[177023.671013] EtherCAT DEBUG 0 0:0: 
ecrt_slave_config_pdo_mapping_add(sc = 0xd8f76f5b, pdo_index = 0x1600, 
entry_index = 0x607A, entry_subindex = 0x00, entry_bit_length = 32) 
[177023.671023] EtherCAT DEBUG 0 0:0: 
ecrt_slave_config_pdo_mapping_add(sc = 0xd8f76f5b, pdo_index = 0x1600, 
entry_index = 0x562A, entry_subindex = 0x00, entry_bit_length = 0) 
[177023.671098] EtherCAT DEBUG 0 0:0: 
ecrt_slave_config_pdo_mapping_add(sc = 0xd8f76f5b, pdo_index = 0x1600, 
entry_index = 0x0021, entry_subindex = 0x00, entry_bit_length = 0)

On 9/9/19 6:55 PM, Gavin Lambert wrote:
> You will receive that error if you specify a PDO inde

Re: [etherlab-users] application modules

2019-08-04 Thread Gavin Lambert
As I understand it, traditionally RT apps had to be kernel-mode because it 
simply wasn’t possible to write a userspace app with the latency guarantees 
that are required.  Hence also the use of RT co-kernels.  That has improved 
considerably in recent years, and it’s now easier to make a reliable userspace 
app – but for tight cycle times or if missed cycles can have safety 
consequences, it might still be better to use an RT co-kernel.

You can’t have multiple userspace processes sharing networks, however.  Once an 
application “claims” a master interface for realtime use (to bring slaves to OP 
and exchange PDOs), no other processes can do so.  It is, however, still 
possible for other processes to queue SDO requests and a few other non-realtime 
things, but even this is preferably gatewayed through the app so that it knows 
what is going on.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: William Zumwalt
Sent: Saturday, 3 August 2019 03:57
To: etherlab-users@etherlab.org
Subject: [etherlab-users] application modules

The only reason I can think of for wanting to write an app as a KM is if data 
weren't going to userspace, but back down the network stack (using another 
protocol?). My process data needs to go into userspace and I'm also curious how 
an app written as a KM would send it's data to userspace?

According to the docs, the only difference I see is external memory for 
domains. In the case of not having a single app mod instance, could there be 
issues in multi-threading, having multiple user-space processes write to the 
same PDO?

Can anyone think of any good reasons for writing the app as a KM?

Will
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Diagnostics, crc and phy errors

2019-11-04 Thread Gavin Lambert
Another thing to watch for is the physical layout of the cables.  It’s best to 
use shielded cables (and make sure that the devices at both ends are properly 
earthed).  But even then, pay close attention to where the cables are running 
and in particular keep the network cables physically separated from power 
cables or other cables that are likely to generate a lot of electrical noise.

It's also important to pay attention to the bend radius limits of the cables – 
and if a cable has *ever* had its limit broken, it may have damaged the shield, 
so you should replace the cable.

Regular ethernet networks tolerate lost packets with retransmits, so you can 
get away with sloppy wiring (although it does cause performance loss).  
EtherCAT networks are much less forgiving.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>  
[cid:insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png] 
<https://www.instagram.com/compacsort/>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: Graeme Foot
Sent: Tuesday, 5 November 2019 10:45
To: Ignacio Rosales Gonzalez ; etherlab-users@etherlab.org
Subject: Re: [etherlab-users] Diagnostics, crc and phy errors

Hi,

It looks like it is just a dodgy link between device 5 and device 6.

To resolve, try the following (depending on what you have handy and assuming 
your drives are linked by patch cables):
- Unplug and replug the patch cable at both ends a few times (to try and get 
better contact)
- Take out the patch cable and use contact cleaner on the ends and the ports
- Toss the patch cable and replace (and use contact cleaner if you have it)


The incoming port shows phy errors if the link to the prior component is lost 
for a long enough time that the phy can detect the drop.  If it’s slightly less 
dodgy than that, a bad cable, noise or other then it can just show up as crc 
errors.  I don’t know for sure, but if the transmit wires have a dodgy 
connection but the receive wires are OK, for example, it could only show up as 
a phy / crc error in one direction.

It is unlikely to be an error on device 5 itself (unless the eth port is 
damaged).  If the device itself has a problem I often see the two devices 
either side of it with errors, with no error on the problem device in the 
middle.  e.g. (modifying your example):


2019-10-31 16:24:08.476


P0

P1


crc

phy

fwd

crc

phy

fwd

0:D2 CoE Driv

0

0

0

0

0

25

1:D2 CoE Driv

0

0

25

0

0

25

2:D2 CoE Driv

0

0

25

0

0

25

3:D2 CoE Driv

0

0

25

0

0

25

4:D2 CoE Driv

0

0

25

0

93

25

5:D2 CoE Driv

0

0

0

0

0

0

6:D2 CoE Driv

0

98

25

0

0

25

7:D2 CoE Driv

0

0

25

0

0

25

8:D2 CoE Driv

0

0

25

0

0

25

9:D2 CoE Driv

0

0

25

0

0

25



This usually indicates that the device in the middle repowered / reset, so the 
devices either side report the error, but the device causing the problem loses 
its count when it repowered / reset.  This is the case I have often found with 
bad Beckhoff EL modules.


Regards,
Graeme

From: etherlab-users 
mailto:etherlab-users-boun...@etherlab.org>>
 On Behalf Of Ignacio Rosales Gonzalez
Sent: Monday, 4 November 2019 11:55 PM
To: etherlab-users@etherlab.org<mailto:etherlab-users@etherlab.org>
Subject: [etherlab-users] Diagnostics, crc and phy errors

Hello everybody,

I've suffering some errors in two machines.
In both of them the dmesg shows the same

 [ 2093.602142] EtherCAT 0: Domain 0: Working counter changed to 18/111.
 [ 2093.608661] EtherCAT 0: 6 slave(s) responding on main device.
 [ 2093.640855] EtherCAT 0: Scanning bus.
 [ 2094.939242] EtherCAT 0: Bus scanning completed in 1332 ms.
 [ 2094.939248] EtherCAT 0: Using slave main-0 as DC reference clock.
 [ 2097.856277] EtherCAT 0: Domain 0: Working counter changed to 0/111.
 [ 2097.876311] EtherCAT 0: 37 slave(s) responding on main device.
 [ 2097.876312] EtherCAT 0: Slave states on main device: SAFEOP, OP + ERROR.
 [ 2098.032585] EtherCAT 0: Scanning bus.

But logging the output of the new command ethercat crc I obtain differen

Re: [etherlab-users] Kollmorgen AKD drive doesn't like to be last

2019-11-06 Thread Gavin Lambert
Try running "ethercat slaves -v" against one specific AKD slave (in a working 
network) and see whether its ports are configured for auto-close or manual 
close.  Compare it with other slaves, if possible.

Usually slaves should default to fully auto, so that they will loop packets 
back when there's no other downstream slave.  But they can be configured to 
manually keep a port closed even when they detect a new downstream slave (to 
avoid disrupting the network until you're ready to configure it) or to keep it 
open even if there's no slave (which is normally a bad thing, but maybe there's 
some reason it might be useful?).  Perhaps this latter is the case for your 
drives?


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Hugh Sparks
Sent: Thursday, 7 November 2019 10:20
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Kollmorgen AKD drive doesn't like to be last

I have several Kollmogen AKD drives that work perfectly anywhere on my ring 
except the last position. If an AKD is at the end of the "row", it doesn't seem 
to be turning the frames around properly. Is this some configuration option I'm 
missing? I've never seen this behavior from other motor drives...

Thanks for any insights!

H. Sparks


___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] RV: AX5000 fault synchronism

2019-10-31 Thread Gavin Lambert
EtherCAT slaves only internally have three sync timing registers:

1. Sync0 cycle time
2. Sync0 shift time
3. Sync1 "cycle time" (but it's actually a shift time that can have the 
appearance of a cycle time depending on its value).

In the stable branch of Etherlab, the parameters you specify are directly 
passed to the slave's registers without any modification or interpretation.  
This means that the sync1_shift value is completely ignored, because there is 
no register for it to be sent to.  Instead, as documented in the slave register 
guide, the sync1_cycle can act as a cycle or a shift (or both) depending on its 
value relative to the sync0_cycle.

In the unofficial patchset, due to patch base/0032-dc-sync1-offset.patch (might 
be named differently in older versions), ecrt_slave_config_dc has the same 
behaviour as before only when sync1_shift is 0.  Otherwise, it performs a 
calculation between sync0_cycle, sync1_cycle, and sync1_shift to determine the 
value actually sent to the slave's "sync1 cycle time" register.  (Technically, 
it always does the calculation, but the result is the same as before when 
sync1_shift is 0.)

For example, I have a slave which wants SYNC0 at 250us intervals and SYNC1 at 
1ms intervals, with no shift between them (but a slight shift on SYNC0).  The 
correct values for this configuration are 25, 5000, 75, 0.  If I wanted 
to have 50us delay between the SYNC0 and SYNC1 pulses, this could either be 
written as 25, 5000, 80, 0 (old style) or 25, 5000, 75, 5 
(new style).  As you can see, the shift value is a little more obvious using 
the new format.  But also note that in both formats the 1ms interval appears 
nowhere -- it is derived from both the SYNC0 and SYNC1 cycle times.


You can't set the sync0 cycle to 0 though -- that just disables both DC syncs 
entirely.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Tom Wong-Cornall
Sent: Friday, 1 November 2019 10:33
To: Albert Chimeno garcia 
Cc: etherlab-users@etherlab.org
Subject: Re: [etherlab-users] RV: AX5000 fault synchronism

On Fri, Nov 01, 2019 at 07:28:12AM NZDT, Albert Chimeno garcia 
 wrote:
>This configuration works:
>"5" sync1Cycle = "75" sync1Shift = "0" />
>
>this is the old one
>   "5" sync1Cycle = "75" sync1Shift = "25" />
>
>So can syncxShift only be 0?

The AX5000 works a little differently to some other DC slaves. It takes its 
reference/PDO capture from Sync1, not Sync0 (as some other amplifiers do). The 
way this works is a little unintuitive, at least when reading the AX5000 system 
manual. Some of this only becomes clear when reading Beckhoff's EtherCAT Slave 
Controller "Hardware Data Sheet" (see section 9.2.3.5 in "Section 1 - 
Technology", link here: 
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdownload.beckhoff.com%2Fdownload%2Fdocument%2Fio%2Fethercat-development-products%2Fethercat_esc_datasheet_sec1_technology_2i2.pdfdata=02%7C01%7Cgavin.lambert%40tomra.com%7C07d89cc0838e4a9a509c08d75e49e2b7%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637081543752927305sdata=%2B76bHZUsi%2FL74JYZ%2FIvLoqZqJxGVsGmQGqZ%2BU43ObMg%3Dreserved=0


General principle:

 - You specify how often Sync0 is generated (happens internally inside drive).  
   There are fixed options for this. 250us is the slowest you can set it, but 
   perfectly fine for 1kHz. I have no idea how you're getting away with 
   Sync0=0, maybe in this case it defaults to 250us (I haven't read LinuxCNC's 
   source).

 - Sync1 cycle time is *not* actually a cycle time (as Beckhoff docs and 
   TwinCAT refer to it). It's actually a delay value for a timer. Sync1 timer 
   starts when the Sync0 pulse occurs. The timer won't restart while it's 
   still running (important!). A Sync1 "event" happens when the timer expires.

 - Sync0 + Sync1 timer values *must* add up to your cycle time (imposed and 
   checked by AX5000's internal logic).

 - You can shift the entire cycle forward and back relative to your 
   ecrt_master_application_time() call by changing the Sync0 shift value.


The result for Sync0 = 250us and Sync1 = 750us is the following:

   0us: Sync0 pulse, Sync1 timer started (750us remaining)
 250us: Sync0 pulse, Sync1 already running (500us remaining)
 500us: Sync0 pulse, Sync1 already running (250us remaining)
 750us: Sync0 pulse, Sync1 just finishing (0us remaining), Sync1 ev

Re: [etherlab-users] RV: AX5000 fault synchronism

2019-10-31 Thread Gavin Lambert
I'm not talking about the AX4000.  I'm talking about a different slave which 
does work happily with SYNC0 and SYNC1 occurring simultaneously.  (Though it 
too is expecting one SYNC1 pulse per SM packet.)

With the specific parameters 25, 5000, 75, 0; what (conceptually) 
happens is this:

1. time 5000   : SYNC0 #1  (we assume the zero time is the DC start base 
for the network; YMMV)
2. time 255000   : SYNC0 #2
3. time 505000   : SYNC0 #3
4. time 755000   : SYNC0 #4 and SYNC1 #1
5. time 1005000 : SYNC0 #5
6. time 1255000 : SYNC0 #6
7. time 1505000 : SYNC0 #7
8. time 1755000 : SYNC0 #8 and SYNC1 #2
...

With the parameters 25, 5000, 75, 5; the result would be more like:

1. time 5000 : SYNC0 #1
2. time 255000 : SYNC0 #2
3. time 505000 : SYNC0 #3
4. time 755000 : SYNC0 #4
5. time 805000 : SYNC1 #1
6. time 1005000   : SYNC0 #5
7. time 1255000   : SYNC0 #6
8. time 1505000   : SYNC0 #7
9. time 1755000   : SYNC0 #8
10. time 1805000 :SYNC1 #2
...

Negative shifts are also possible, for example 25, 5000, 100, -5 
would do:

1. time 5000 : SYNC0 #1
2. time 255000 : SYNC0 #2
3. time 505000 : SYNC0 #3
4. time 755000 : SYNC0 #4
5. time 955000 : SYNC1 #1
6. time 1005000   : SYNC0 #5
7. time 1255000   : SYNC0 #6
8. time 1505000   : SYNC0 #7
9. time 1755000   : SYNC0 #8
10. time 1955000 :SYNC1 #2
11. time 2005000 : SYNC0 #9
...
Note that the SYNC0 pulse timing is the same but we've moved SYNC1 so it 
happens 50µs before the next SYNC0 pulse instead of 50µs after the previous 
one.  (This also made the sync1 cycle time parameter look like its actual cycle 
time.)

What values are needed for each slave should be given in the slave's 
documentation -- they're all different, depending on what actions the slave 
performs on each SYNC event, and whether it needs some time allowance for 
capturing or processing delays.  And, of course, what SM cycle time you want to 
use.

But yes, essentially the "sync1 cycle time register" is the delay between the 
first SYNC0 and the first SYNC1.  Depending both on the dividend and the modulo 
of this vs. the SYNC0 cycle time it creates the pulse trains for both, but the 
numbers can be quite confusing at first glance.  The diagram from the ESC 
datasheets demonstrates this; you can also read more detail about it in ETG1020 
"Synchronization", in particular the part about "subordinated µC cycles".  
(Although parts of that might end up being more confusing than helpful.)

A simple rule of thumb (demonstrated above) is that if your sync1_shift is not 
negative then the sync1_cycle needs to be one sync0_cycle less than you think 
it "ought" to be, but if the sync1_shift is negative then you can set 
sync1_cycle to the "real" value.

Although I did misspeak a bit earlier.  The sync0 shift is not directly passed 
to the slave; it's used to calculate a value for the "Start Time Cyclic 
Operation" register (which is analogous to sync0 shift, but not quite 
identical) based on when the master is intending to send the first SM packet.

(I've never been entirely clear on the relative shift between the SM packet and 
the SYNC0 since it hasn't mattered for my slaves, but I *think* the expectation 
in all of the above is that the SM packet arrives at around time 0, 100, 
etc, allowing for master jitter.  So you may need to configure the sync0_shift 
and/or sync1_shift based on your maximum jitter.)


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Tom Wong-Cornall  
Sent: Friday, 1 November 2019 12:33
To: Gavin Lambert 
Cc: Albert Chimeno garcia ; etherlab-users@etherlab.org
Subject: Re: [etherlab-users] RV: AX5000 fault synchronism

On Fri, Nov 01, 2019 at 11:37:55AM NZDT, Gavin Lambert 
 wrote:
>For example, I have a slave which wants SYNC0 at 250us intervals and 
>SYNC1 at 1ms intervals, with no shift between them (but a slight shift 
>on SYNC0).  The correct values for this configuration are 25, 5000, 
>75, 0.

I can't quite square that up with the ET1100 docs, or the AX5000's behaviour in 
use.  Your description matches the high-level docs for the AX5000, which is to 
imply Sync0 will happen simultaneously with Sync1. However, the Beckhoff ESC 
docs describe the sequence occurring as my previous email, with Sync1 occurring 
at "sync1 cycle time" (0x09a4) nanoseconds after Sync0 (see extract fr

Re: [etherlab-users] ELM3004 (ADC) and SDOs requests

2019-10-30 Thread Gavin Lambert
It is normal for a slave to drop to SAFEOP+ERROR when it loses communication 
with the master app.

If a slave is remaining in OP+ERROR with the master app not running, that is 
almost certainly a fault in the slave itself.  (However: it's also worthwhile 
making sure that the slave is not the first one in the network -- try putting 
in an EK1100 as the first slave if you have nothing else.  In particular, the 
stock stable branch code will try to keep the first slave in OP all the time, 
which is usually not a good thing (but is relatively harmless when it's an 
infrastructure component such as the EK1100).

For your other questions (and also for the above), you may find it helpful to 
try the unofficial patchset at 
https://sourceforge.net/u/uecasm/etherlab-patches/ci/default/tree/.  This 
includes some feature and reliability improvements for CoE as well as a command 
allowing you to soft-reboot compatible slaves.  It also disables the 
first-slave-in-OP behaviour.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Romain Virot
Sent: Thursday, 31 October 2019 01:38
To: etherlab-users@etherlab.org
Subject: [etherlab-users] ELM3004 (ADC) and SDOs requests

Hi,

I'm quite new to EtherCAT and while I managed to run a simple system (2 EL2004 
modules), I'm facing two issues (maybe related) with a Beckhoff ELM3004 module 
(and SDOs in general). I already searched heavily for solutions and tried many 
things but I'm now kind of lost...

First issue is :

I can activate the master and enter the cylic task without issue, and the 
ELM3004 goes into OP state. If I now stop my master (getting out of the cyclic 
task loop and releasing the master), the ELM3004 is stuck in OP (with the Error 
tag) state, while the 2 EL2004 modules do properly return to the PREOP state. I 
do no understand this behavior nor have any idea of how to diagnosis the 
problem.

Second one :

I cannot make RT SDOs (using requests) work. The request creation, before 
master activation, does work. However calling a request, either read or write, 
always ends up with "busy' states only for the request until the timeout is 
reached, and then the request state naturally goes into 'error'. This is for 
various frequency checks (from 1kHz to 1 Hz). I tried to replicate the mini 
exemple, and behavior is similar. Note that everything related to the EtherCAT 
system is on the same thread, if it matters (I have a QT Gui on another 
thread). FYI, I want to use RT SDO to be able to test modules easily and also 
run diagnosis.


On a side note, is there any possibility to reset//reboot an EtherCAT module 
(or whole domain//master) from a software perspective only? When the ELM3004 is 
stuck the only way for me to clean thing is to reboot the system...

Thanks a lot,

Romain
___
etherlab-users mailing list
etherlab-users@etherlab.org
https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.etherlab.org%2Fmailman%2Flistinfo%2Fetherlab-usersdata=02%7C01%7Cgavin.lambert%40tomra.com%7C13c13d49111d45372eb608d75d35fb99%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637080358744179207sdata=urMi8xlYYC%2BIGYoMcMIN%2BO%2Fm5vyFy1%2Bie7XSnHfTo3w%3Dreserved=0
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Control loop at higher frequencies

2019-10-30 Thread Gavin Lambert
When you use the master debug interface (or the newly added “ethercat pcap” 
command, although you won’t have that in your version yet), the receive 
timestamps are the time that they are received by the master, which is the time 
that you called ecrt_master_receive.

You can get a better understanding of the “real” wire transfer time by 
connecting a separate monitoring device between the master and first slave – a 
proper network monitor is ideal, but you can made do with a standard Ethernet 
hub/switch with three ports connected (master, first slave, monitoring laptop 
running Wireshark), although for best results (especially if it’s a Windows 
laptop) you should disable all the network protocols on the laptop adapter 
other than the minimum it needs to do the Wireshark monitoring, so that it 
doesn’t inadvertently transmit packets of its own.  (These won’t hurt the 
network itself, since both the master and slave will drop non-EtherCAT packets, 
but it may worsen the latency.)  This will still be somewhat inaccurate since 
it’s still timestamping when the packet was processed rather than when it was 
actually received in hardware, but it’s likely to be more accurate than doing 
it on the master since it’s not waiting for the cycle delay.

As Graeme said, you can also put the monitoring device elsewhere in the network 
(all packets will always pass every point in the network – except the end), 
although then it becomes harder to meaningfully use the timestamps.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>  
[cid:insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png] 
<https://www.instagram.com/compacsort/>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: Graeme Foot
Sent: Thursday, 31 October 2019 11:49
To: Jordan Palacios 
Cc: etherlab-users@etherlab.org
Subject: Re: [etherlab-users] Control loop at higher frequencies

Hi,

It is sounding like the data time on the wire is taking too long (> 250us).

Besides doubling the "DC system time transmission delay" of the last slave, you 
can also check the "Diff [ns]" value of your first slave.  This may give you a 
more accurate idea if you have a star topology, as the return trip of the frame 
from the last slave bypasses the fingers of the stars.  e.g.:

ethercat slaves -v -p0

=== Master 0, Slave 0 ===
Alias: 10001
Device: Main
State: OP
Flag: +
Identity:
  Vendor Id:   0x0002
  Product code:0x04562c52
  Revision number: 0x0011
  Serial number:   0x
DL information:
  FMMU bit operation: no
  Distributed clocks: yes, 64 bit
  DC system time transmission delay: 0 ns
Port  Type  Link  LoopSignal  NextSlave  RxTime [ns]  Diff [ns]   NextDc 
[ns]
   0* EBUS  upopenyes -   3638440690   0   0
   1  MII   upopenyes 1   36384424101720 560
   2  N/A   down  closed  no  --   -   -
   3  N/C   down  closed  no  --   -   -

You will also need to add on 2 * "master to first slave transmission delay" 
which you will probably need to guess.  If you use a Beckhoff CX2020 (or 
similar) where the CX2100 is directly connected to the EBus this will likely be 
around 150us.  If your master has an ethernet port and the first slave is an 
amp or a coupler this may be around 550us or more (depending on cable length).  
You could also calc the frame transmission time.  Your frame length is 782 
bytes.  So that should take ~ 6 - 7us.  Plus whatever other overheads the 
ethernet card / driver has.

Reducing the number of configured slaves (even with them still physically 
plugged in) will reduce the ec_master_domain_queue() and ec_master_send() 
overhead time, getting the frame to the wire quicker.  It will also reduce the 
frame length and the related frame transmission time (especially if you remove 
slaves with bigger datagram overhead).  It looks like this is enough to result 
in the total frame ro

Re: [etherlab-users] Multiple Domains

2019-11-13 Thread Gavin Lambert
It shouldn't be difficult to "pick data out of a single domain destined for 
multiple endpoints".  When you register the domain, you'll get an offset to 
each entry in the ec_pdo_entry_reg_t -- this is where the data is read from or 
written to.  It's a simple byte offset from the domain's base data pointer, 
which in turn means that it's very easy to obtain pointers to each individual 
entry for each slave, as long as you save these offsets/pointers somewhere that 
you can get at when processing the domain.

Using a single domain reduces the overhead of the data transfer since it packs 
pure data into the byte-space, whereas multiple domains have some extra 
datagram metadata overhead.

Using a single domain can make it harder to deal with individual offline 
devices -- the domain state changes to EC_WC_INCOMPLETE but can't tell you 
which of the slaves' data is missing unless you can determine that from the 
data itself.  (Many slaves will provide an input that toggles or increments on 
every cycle to make that easier, however.)  With individual domains it becomes 
easier to tell which data is missing as each domain will typically either be 
EC_WC_ZERO or EC_WC_COMPLETE, without any incomplete domains.

Multiple domains also allow you to use different cycle times for some slaves, 
simply by not queuing/processing that domain in some cycles.  (It's also 
possible to use separate cyclic tasks, but that requires more care.)
Some (old) slaves actually require using separate domains for their input and 
output data, since they only support LRD and LWR datagrams and not LRW 
datagrams.

Usually though the guideline is to use a single domain for each "cluster" of 
slaves (where the whole set are likely to go online or offline together, such 
as an EK1100 group or a hotplug tree branch), to avoid the datagram overhead, 
or to use a single domain per cycle rate if you can otherwise determine when 
data is stale.

Multiple domains can be transferred in the same frame (assuming you make a 
single call to ecrt_master_send), but each one adds 12 bytes of overhead to the 
frame since each domain must be a separate datagram.  This increases the time 
required, and if you have many domains, it increases the chance that multiple 
frames will have to be sent due to the overhead size.

FWIW, my own app works in a similar dynamic-discovery fashion.  It uses a 
single large domain because the slaves do provide a way to detect when they 
haven't updated their data.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Gary Grobe
Sent: Thursday, 14 November 2019 12:59
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Multiple Domains

I have a user-space app that discovers slaves on the network and dynamically 
builds the ec_pdo_entry_reg_t struct to be used in registration of PDO's for a 
domain based on a mix of discovery and user configuration. I've since found 
that it's quite difficult to pick data out of a single domain destined for 
multiple endpoints which has led me to consider the use of multiple domains as 
an option.

If I did go with multiple domains, the data in this case would be exchanged at 
the same frequency. My reasoning for considering multiple domains is so that 
each endpoint receives only the data required for that endpoint.

I was hoping to get some recommended guidelines when it comes to implementing 
multiple domains, up to how many, what are the impacts on performance (whether 
same or different frequencies), etc...? Any suggestions/advice much appreciated.
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Kollmorgen AKD drive doesn't like to be last

2019-11-06 Thread Gavin Lambert
Yes, although if there is some slave with closed ports in the network then 
writing 00 will open that slave but not any slaves further downstream of it 
(the change doesn’t take effect until after the end of the current frame, and 
may take several more cycles to negotiate link after that too).

Having said that, all slaves should default to 00 (auto) anyway – that’s the 
reset state of the ESC.  Only if a slave has some other persistent 
firmware/configuration override (which hopefully would be documented) might 
that differ.  I’m not familiar with that particular slave, so I don’t know if 
that applies to it or not.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>  
[cid:insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png] 
<https://www.instagram.com/compacsort/>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: Hugh Sparks 
Sent: Thursday, 7 November 2019 11:33
To: Gavin Lambert ; etherlab-users@etherlab.org
Subject: Re: [etherlab-users] Kollmorgen AKD drive doesn't like to be last

Thanks for the quick answer. I'll try it ASAP. (I'm not at the customer site.)

I'm broadcasting a zero byte to register 0x101 (second byte of ESC DL Control) 
to all slaves. Shouldn't that make all ports automatic?
H. Sparks

On 11/6/2019 3:31 PM, Gavin Lambert wrote:

Try running "ethercat slaves -v" against one specific AKD slave (in a working 
network) and see whether its ports are configured for auto-close or manual 
close.  Compare it with other slaves, if possible.



Usually slaves should default to fully auto, so that they will loop packets 
back when there's no other downstream slave.  But they can be configured to 
manually keep a port closed even when they detect a new downstream slave (to 
avoid disrupting the network until you're ready to configure it) or to keep it 
open even if there's no slave (which is normally a bad thing, but maybe there's 
some reason it might be useful?).  Perhaps this latter is the case for your 
drives?





Gavin Lambert

Senior Software Developer









COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand

Switchboard: +49 2630 96520 | https://www.tomra.com



The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

-Original Message-

From: Hugh Sparks

Sent: Thursday, 7 November 2019 10:20

To: etherlab-users@etherlab.org<mailto:etherlab-users@etherlab.org>

Subject: [etherlab-users] Kollmorgen AKD drive doesn't like to be last



I have several Kollmogen AKD drives that work perfectly anywhere on my ring 
except the last position. If an AKD is at the end of the "row", it doesn't seem 
to be turning the frames around properly. Is this some configuration option I'm 
missing? I've never seen this behavior from other motor drives...



Thanks for any insights!



H. Sparks







___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Unmatched/Skipped Datagrams

2019-12-16 Thread Gavin Lambert
Another possible cause is if your cyclic loop timing is off somehow, and you're 
calling ecrt_master_receive too soon after ecrt_master_send so that the packet 
hasn't had time to make it back to the master yet.

The timing code you have below looks correct, but bear in mind that the way 
wakeup_time is incremented is designed to smooth latency jitter but can result 
in a zero-time sleep if the task is already running behind for some reason.  So 
adding some logging of your wakeup_time vs. current time and other performance 
metrics could be useful as well.

Also, double check the code you're using to change the process priority; you 
didn't include that part below.  Using SCHED_FIFO requires root permissions but 
even then there can be restrictions.  Verify it's not failing.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Gavin Lambert
Sent: Tuesday, 17 December 2019 11:09
To: Gary Grobe ; etherlab-users@etherlab.org
Subject: Re: [etherlab-users] Unmatched/Skipped Datagrams

There's a 4.19 version of all drivers (except r8169, because reasons), 
including igb, in the unofficial patchset 
(https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fu%2Fuecasm%2Fetherlab-patches%2Fci%2Fdefault%2Ftree%2Fdata=02%7C01%7Cgavin.lambert%40tomra.com%7Cd8107ac890f84bfecff508d782748ed6%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C63712130935878sdata=zYsu8AzSjFAjmgkqI8MS9xAa0r4Rsowadhwiu0yuel4%3Dreserved=0).

It can be normal to see a small number of unmatched datagrams when you're 
starting your app up (and it's transitioning from background mode to realtime 
mode), and when you're replugging the network, but otherwise no, they should 
never appear.  It means the EtherCAT packets aren't getting all the way around 
the network.

It's possible to watch the flow of packets, either by using one of the built-in 
debug interfaces or (usually easier) by connecting a small dumb switch between 
the master and the first slave, and then connecting a third laptop/PC running 
Wireshark to the switch as well (preferably in such a way that the laptop can't 
send packets, but it's not critical).  This can sometimes give you more hints 
about what's going on.

Using "ethercat debug 1" and observing the syslog can also help.


Gavin Lambert
Senior Software Developer

 -Original Message-
From: Gary Grobe
Sent: Tuesday, 17 December 2019 10:30
To: etherlab-users@etherlab.org
Subject: Re: [etherlab-users] Unmatched/Skipped Datagrams

The ec_igb doesn't seem to be available for 4.19. If nothing else works, I may 
try to roll back the kernel as a last resort, but according to recent mailings, 
it would appear that others are running 4.19 LTS w/o issue.

I did just give things a try on new hardware:
- Linux 4.19.82-rt30 #1 SMP PREEMPT RT x86_64 GNU/Linux
- IgH EtherCAT master 1.5.2 6258f7d85afb+
- Intel(R) Core(TM) i7-7700T CPU @ 2.90GHz
- ec_e1000e using the following NIC:

00:1f.6 Ethernet controller [0200]: Intel Corporation Ethernet Connection 
I219-LM [8086:156f] (rev 31)
     Subsystem: Intel Corporation Ethernet Connection I219-LM [8086:]
     Kernel driver in use: ec_e1000e
     Kernel modules: e1000e

Also replaced cables, but even at 50Hz, I'm still seeing the following with the 
e1000e.

[11576.944102] EtherCAT WARNING 0: 7 datagrams UNMATCHED!
[11577.940744] EtherCAT WARNING: Datagram 4e9cc6e1
(domain0-0-main) was SKIPPED 13 times.
[11577.944111] EtherCAT WARNING 0: 13 datagrams UNMATCHED!
[11578.944115] EtherCAT WARNING 0: 13 datagrams UNMATCHED!
[11578.944153] EtherCAT WARNING: Datagram 4e9cc6e1
(domain0-0-main) was SKIPPED 20 times.
[11579.944090] EtherCAT WARNING 0: 17 datagrams UNMATCHED!
[11580.940728] EtherCAT WARNING: Datagram 4e9cc6e1
(domain0-0-main) was SKIPPED 25 times.
[11580.944071] EtherCAT WARNING 0: 9 datagrams UNMATCHED!
[11581.944077] EtherCAT WARNING 0: 31 datagrams UNMATCHED!
[11581.944091] EtherCAT WARNING: Datagram 4e9cc6e1
(domain0-0-main) was SKIPPED 32 times.
[11582.944104] EtherCAT WARNING 0: 4 datagrams UNMATCHED!
[11583.940692] EtherCAT WARNING: Datagram 4e9cc6e1
(domain0-0-main) was SKIPPED 18 times.
[11583.944069] EtherCAT WARNING 0: 19 datagrams UNMATCHED!
[11584.944048] EtherCAT WARNING 0: 3 datagrams UNMATCHED!
[11584.944179] EtherCAT WARNING: Datagram 4e9cc6e1
(domain0-0-main) was SKIPPED 8 times.
[11585.944076] EtherCAT WARNING 0: 30 datagrams UNMATCHED!

I've also replaced the controllers w/ a few in-house as well as Elmo motion 
c

Re: [etherlab-users] Unmatched/Skipped Datagrams

2019-12-15 Thread Gavin Lambert
1kHz cycle is typically too fast for the generic driver.  Try using the ec_igb 
driver instead, or reduce your cycle to 250 Hz or less.

Otherwise, there may be some other issue with your network wiring, or your 
hardware.  Have you tried it on other hardware?


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Gary Grobe
Sent: Saturday, 14 December 2019 11:19
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Unmatched/Skipped Datagrams

My configuration is:
- Linux 4.19.82-rt30 #1 SMP PREEMPT RT x86_64 GNU/Linux
- IgH EtherCAT master 1.5.2 6258f7d85afb+
- Intel(R) Celeron(R) CPU  J1900  @ 1.99GHz
- ec_generic based on the following NIC:

03:00.0 Ethernet controller [0200]: Intel Corporation I211 Gigabit Network 
Connection [8086:1539] (rev 03)
     Subsystem: Intel Corporation I211 Gigabit Network Connection 
[8086:]
     Kernel driver in use: igb

The app is a user-space client. The following is the cyclic task cut down to a 
minimum, and yet still shows the issue.

{
     // ...

     struct sched_param param = { };

     param.sched_priority = sched_get_priority_max(SCHED_FIFO);

     if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) {
     std::cout << "Warning: Failed to lock memory: " <<
strerror(errno) <<
     std::endl;
     }

     stack_prefault();

     clock_gettime(CLOCK_MONOTONIC, _time);
     wakeup_time.tv_sec += 1;
     wakeup_time.tv_nsec = 0;

     while (running) {
     ret = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, _time,
     NULL);

     if (ret) {
     std::cerr << "clock_nanosleep(): " << strerror(ret) << std::endl;

     break;
     }

     task_cycle();

     wakeup_time.tv_nsec += PERIOD_NS;

     while (wakeup_time.tv_nsec >= NSEC_PER_SEC) {
     wakeup_time.tv_nsec -= NSEC_PER_SEC;
     wakeup_time.tv_sec++;
     }
     }
}

inline void TestChain::task_cycle()
{
     ecrt_master_receive(master);
     ecrt_domain_process(domain);

     ecrt_master_application_time(master, TIMESPEC2NS(wakeup_time));
     ecrt_master_sync_reference_clock(master);
     ecrt_master_sync_slave_clocks(master);

     if (counter) {
     counter--;
     }
     else {
     counter = FREQUENCY;
     }

     ecrt_domain_queue(domain);
     ecrt_master_send(master);
}

The following messages from dmesg were taken at 1kHz. Doesn't matter if it's 
doing 10Hz or 1kHz, the UNMATCHED and SKIPPED numbers are quite large. I've 
only seen 1Hz work w/o issue.

[ 4132.457210] EtherCAT 0: Domain 0: 268 working counter changes - now 1/2.
[ 4133.373743] EtherCAT WARNING 0: 657 datagrams UNMATCHED!
[ 4133.461587] EtherCAT WARNING: Datagram 2f1447da
(domain0-0-main) was SKIPPED 736 times.
[ 4133.461593] EtherCAT 0: Domain 0: 395 working counter changes - now 0/2.
[ 4134.374131] EtherCAT WARNING 0: 643 datagrams UNMATCHED!
[ 4134.465961] EtherCAT WARNING: Datagram 2f1447da
(domain0-0-main) was SKIPPED 776 times.
[ 4134.465968] EtherCAT 0: Domain 0: 232 working counter changes - now 0/2.
[ 4135.374332] EtherCAT WARNING 0: 850 datagrams UNMATCHED!
[ 4135.470468] EtherCAT WARNING: Datagram 2f1447da
(domain0-0-main) was SKIPPED 722 times.
[ 4135.470476] EtherCAT 0: Domain 0: 331 working counter changes - now 1/2.
[ 4136.374860] EtherCAT WARNING 0: 649 datagrams UNMATCHED!
[ 4136.475180] EtherCAT WARNING: Datagram 2f1447da
(domain0-0-main) was SKIPPED 858 times.
[ 4136.475187] EtherCAT 0: Domain 0: 282 working counter changes - now 1/2.
[ 4137.375178] EtherCAT WARNING 0: 757 datagrams UNMATCHED!
[ 4138.319869] EtherCAT WARNING: Datagram 2f1447da
(domain0-0-main) was SKIPPED 745 times.
[ 4138.319877] EtherCAT 0: Domain 0: 208 working counter changes - now 1/2.
[ 4138.375593] EtherCAT WARNING 0: 972 datagrams UNMATCHED!
[ 4139.324269] EtherCAT WARNING: Datagram 2f1447da
(domain0-0-main) was SKIPPED 911 times.

___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Unmatched/Skipped Datagrams

2019-12-16 Thread Gavin Lambert
There's a 4.19 version of all drivers (except r8169, because reasons), 
including igb, in the unofficial patchset 
(https://sourceforge.net/u/uecasm/etherlab-patches/ci/default/tree/).

It can be normal to see a small number of unmatched datagrams when you're 
starting your app up (and it's transitioning from background mode to realtime 
mode), and when you're replugging the network, but otherwise no, they should 
never appear.  It means the EtherCAT packets aren't getting all the way around 
the network.

It's possible to watch the flow of packets, either by using one of the built-in 
debug interfaces or (usually easier) by connecting a small dumb switch between 
the master and the first slave, and then connecting a third laptop/PC running 
Wireshark to the switch as well (preferably in such a way that the laptop can't 
send packets, but it's not critical).  This can sometimes give you more hints 
about what's going on.

Using "ethercat debug 1" and observing the syslog can also help.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Gary Grobe
Sent: Tuesday, 17 December 2019 10:30
To: etherlab-users@etherlab.org
Subject: Re: [etherlab-users] Unmatched/Skipped Datagrams

The ec_igb doesn't seem to be available for 4.19. If nothing else works, I may 
try to roll back the kernel as a last resort, but according to recent mailings, 
it would appear that others are running 4.19 LTS w/o issue.

I did just give things a try on new hardware:
- Linux 4.19.82-rt30 #1 SMP PREEMPT RT x86_64 GNU/Linux
- IgH EtherCAT master 1.5.2 6258f7d85afb+
- Intel(R) Core(TM) i7-7700T CPU @ 2.90GHz
- ec_e1000e using the following NIC:

00:1f.6 Ethernet controller [0200]: Intel Corporation Ethernet Connection 
I219-LM [8086:156f] (rev 31)
     Subsystem: Intel Corporation Ethernet Connection I219-LM [8086:]
     Kernel driver in use: ec_e1000e
     Kernel modules: e1000e

Also replaced cables, but even at 50Hz, I'm still seeing the following with the 
e1000e.

[11576.944102] EtherCAT WARNING 0: 7 datagrams UNMATCHED!
[11577.940744] EtherCAT WARNING: Datagram 4e9cc6e1
(domain0-0-main) was SKIPPED 13 times.
[11577.944111] EtherCAT WARNING 0: 13 datagrams UNMATCHED!
[11578.944115] EtherCAT WARNING 0: 13 datagrams UNMATCHED!
[11578.944153] EtherCAT WARNING: Datagram 4e9cc6e1
(domain0-0-main) was SKIPPED 20 times.
[11579.944090] EtherCAT WARNING 0: 17 datagrams UNMATCHED!
[11580.940728] EtherCAT WARNING: Datagram 4e9cc6e1
(domain0-0-main) was SKIPPED 25 times.
[11580.944071] EtherCAT WARNING 0: 9 datagrams UNMATCHED!
[11581.944077] EtherCAT WARNING 0: 31 datagrams UNMATCHED!
[11581.944091] EtherCAT WARNING: Datagram 4e9cc6e1
(domain0-0-main) was SKIPPED 32 times.
[11582.944104] EtherCAT WARNING 0: 4 datagrams UNMATCHED!
[11583.940692] EtherCAT WARNING: Datagram 4e9cc6e1
(domain0-0-main) was SKIPPED 18 times.
[11583.944069] EtherCAT WARNING 0: 19 datagrams UNMATCHED!
[11584.944048] EtherCAT WARNING 0: 3 datagrams UNMATCHED!
[11584.944179] EtherCAT WARNING: Datagram 4e9cc6e1
(domain0-0-main) was SKIPPED 8 times.
[11585.944076] EtherCAT WARNING 0: 30 datagrams UNMATCHED!

I've also replaced the controllers w/ a few in-house as well as Elmo motion 
controllers, but to no avail. Is it common/ok to have a small percentage of 
these messages to appear?

Any other thoughts?

On 12/15/19 3:55 PM, Gavin Lambert wrote:
> 1kHz cycle is typically too fast for the generic driver.  Try using the 
> ec_igb driver instead, or reduce your cycle to 250 Hz or less.
>
> Otherwise, there may be some other issue with your network wiring, or your 
> hardware.  Have you tried it on other hardware?
>
>
> Gavin Lambert
> Senior Software Developer
>
>   
>
>
> COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 
> 1061 | New Zealand
> Switchboard: +49 2630 96520 | https://www.tomra.com
>
> The information contained in this communication and any attachment is 
> confidential and may be legally privileged. It should only be read by the 
> person(s) to whom it is addressed. If you have received this communication in 
> error, please notify the sender and delete the communication.
> -Original Message-
> From: Gary Grobe
> Sent: Saturday, 14 December 2019 11:19
> To: etherlab-users@etherlab.org
> Subject: [etherlab-users] Unmatched/Skipped Datagrams
>
> My configuration is:
> - Linux 4.19.82-rt30 #1 SMP PREEMPT RT x86_64 GNU/Linux
> - 

Re: [etherlab-users] AX5000 fault synchronism

2019-10-29 Thread Gavin Lambert
If you're expecting anyone to give you some useful advice, you should do some 
minimal work yourself, such as noting what version you were using before, what 
version you're using now, and reading what's in the changelog between those two 
versions.

And then if you still can't figure it out, post related code (for example, what 
you mean by "synchronize sync1" in terms of both the code you're trying to call 
and what syslog output is different between the working and non-working cases).


Having said that: according to my magic crystal ball, your problem is that you 
were passing a non-zero value for sync1_shift in ecrt_slave_config_dc.  In some 
previous versions, that was ignored.  In current versions, it is not ignored.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>  
[cid:insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png] 
<https://www.instagram.com/compacsort/>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: Albert Chimeno garcia
Sent: Saturday, 26 October 2019 08:17
To: etherlab-users@etherlab.org
Subject: [etherlab-users] AX5000 fault synchronism

hello, I just installed the new version of EC-DEBINIZE from sittner and it 
doesn't allow me to synchronize sync1, but in the previous version if I could, 
someone know some orientation of why ?, thanks.
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] EtherCAT master command not found

2019-11-20 Thread Gavin Lambert
It sounds like you removed the = sign when you changed those lines.

If in doubt, post the contents of /etc/ethercat.conf.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>  
[cid:insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png] 
<https://www.instagram.com/compacsort/>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: BUSSIERES Vincent
Sent: Wednesday, 20 November 2019 23:05
To: etherlab-users@etherlab.org
Subject: [etherlab-users] EtherCAT master command not found

Hello everybody,

I try to use Ethercat Master for linux. Building and configuration seem to be 
OK.
I use systemd to run Ethercat master as a service. I configured « Ethercat.conf 
» by filling « MASTER0_DEVICE » with my MAC address and « DEVICE_MODULES » with 
« e1000 ».

But when I start service I get the following message :

root@MTSF:/lib/systemd/system# systemctl status etherlab.service
● etherlab.service - EtherCAT Master Kernel Modules
   Loaded: loaded (/lib/systemd/system/etherlab.service; enabled; vendor 
preset: enabled)
   Active: active (exited) since Wed 2019-11-20 10:26:11 CET; 33min ago
  Process: 1236 ExecStart=/opt/etherlab/sbin/ethercatctl start (code=exited, 
status=0/SUCCESS)
Main PID: 1236 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 4915)
   CGroup: /system.slice/etherlab.service

nov. 20 10:26:11 MTSF systemd[1]: Starting EtherCAT Master Kernel Modules...
nov. 20 10:26:11 MTSF ethercatctl[1236]: /etc/ethercat.conf: ligne 19: 
MASTER0_DEVICE : commande introuvable
nov. 20 10:26:11 MTSF ethercatctl[1236]: /etc/ethercat.conf: ligne 53: 
DEVICE_MODULES : commande introuvable
nov. 20 10:26:11 MTSF systemd[1]: Started EtherCAT Master Kernel Modules.


MASTER0_DEVICE and DEVICE_MODULES commands are not found.

Does someone have an idea to solve this issue ? I am working under VM.

Thanks
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] How to verify that my distributed clock setup correctly?

2019-10-06 Thread Gavin Lambert
I don't think it's normal, at least not unless you've only just started the 
master application.
The first (DC-capable) slave is selected as the reference clock by default.  
This could be a factor in the difference you're seeing.

What slaves do you have, and what DC clock method are you using?  And what 
version of the master library are you using?

You might want to try connecting an infrastructure slave (such as an EK1100) as 
your first slave to see if that improves things.


FYI, there's two different ways to sync master and reference clocks (as shown 
in the rtai_rtdm_dc example code):

1. If you're calling ecrt_master_sync_reference_clock_to, then you're 
pushing the master clock down to the reference slave.  Normally this should 
quickly step to the master clock on first update, but some slaves (especially 
if they were already in OP at the time) may require multiple cycles to "drift" 
the time to the correct point, to avoid too fast a transition.

2. If you're calling ecrt_master_reference_clock_time (and not the above), 
then you're reading the reference slave's clock and calculating an offset from 
the master's clock inside the master, separate from the network.

#1 is "easier" in the master code, because all the slaves will have the same 
idea of time as the master (eventually, at least) and so you don't need any 
complicated time-domain conversions.

#2 is "nicer" to the slaves, because they don't need to worry about syncing to 
a drifting master clock -- but also means that if any of the slaves care about 
the "real" full 64-bit DC time (eg. if it has some kind of clock display) then 
they won't have the real wall-clock time.  That's rarely important, however.  
It also means that the master has to manually convert any times it receives 
from slaves.

Also note that the stable-1.5 library version does some strange things with DC, 
such as keeping the reference slave in OP inappropriately.  You may want to try 
using the unofficial patchset 
(https://sourceforge.net/u/uecasm/etherlab-patches/ci/default/tree/ ) to see if 
that works better for you.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Louie Lu
Sent: Sunday, 6 October 2019 00:02
To: etherlab-users@etherlab.org
Subject: [etherlab-users] How to verify that my distributed clock setup 
correctly?

Hi all,

How do I verify that my distributed clock setup in EtherCAT is correct?

I use SDO 0x1C32/0x1C33 check that the slaves are in DC mode, and use 0x92C reg 
check the system time difference, here is the result of two slaves connected:

# ethercat -p0 -tuint16 upload 0x1C32 1; ethercat -p0 -tuint16 upload
0x1C33 1; ethercat -p0 reg_read 0x92C -t int32; ethercat -p1 reg_read 0x92C -t 
int32
0x0002 2
0x0002 2
0x007051ea 7361002
0x8002 -2147483646

The second slave seems to work well, only have 2ns difference, but why does the 
first slave always report with a large number of the time difference? Is that 
correct?


Thanks,
Louie.
___
etherlab-users mailing list
etherlab-users@etherlab.org
https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.etherlab.org%2Fmailman%2Flistinfo%2Fetherlab-usersdata=02%7C01%7Cgavin.lambert%40tomra.com%7C0450b2d7bad34cf99b5b08d7498390d5%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637058701739232218sdata=ii0EIghT2wdmVWYLSJqg2oe8RdzWqYLrchIXldNSInE%3Dreserved=0
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] How slow can a DC cycle time be?

2019-10-08 Thread Gavin Lambert
That's really up to the specific slave, so you'll have to check its 
documentation.  EtherCAT as a network transport has no particular limitation, 
other than it can't be slower than 1 Hz or you'll cause problems with 32-bit DC 
ambiguity.  Having said that, a 1ms cycle is considered "typical" and so most 
slaves are probably expecting something around the order of 0.1 - 10ms by 
default.

Even if your particular data pattern doesn't require a faster cycle time, the 
slave might be internally relying on a particular minimum rate for its own 
activity.  Some slaves also require multiple cycles to perform certain tasks or 
to communicate certain events, so a higher cycle time can cause significant 
delays.

Note that in addition to a possible minimum rate of DC sync activation, slaves 
typically have a watchdog that specifies a minimum rate for SM (receiving 
domain packets).  Again, the slave itself will have a particular default value, 
but you can reconfigure this using the ecrt_slave_config_watchdog method.  When 
this watchdog trips, the slave will drop from OP to SAFEOP+ERROR with an AL 
status code of 0x001B, indicating a loss of communication with the master.

Other AL status codes mean other things, such as not receiving SM-SYNC-SM-SYNC 
in strict phase (when in DC mode) or trying to configure sync timing parameters 
outside the acceptable range.  Check the logs and consult your slave's 
documentation to figure out what the limits are and what the status errors you 
should be seeing mean.


Regarding propagation delay, you can see that in the "ethercat slaves -v" view 
(provided that you do not have an erroneous topology); it shows each port, when 
the timing sync datagram was received, and the overall delay.  This does 
require a DC-capable slave, but it does not need to be running in DC mode.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Louie Lu
Sent: Tuesday, 8 October 2019 22:47
To: etherlab-users@etherlab.org
Subject: [etherlab-users] How slow can a DC cycle time be?

Hi all,

Usually, DC will need a cycle time at 1ms or lower, but we don't need a cycle 
time that fast, we only need 20Hz ~ 50Hz, is that possible for DC?

For what I test on my driver (LAN9252), if the cycle time drop below 200Hz, it 
will unable to make the driver bring up from PREOP to OP, although the frame is 
still exchanging.

Also, SM2 sync is possible to run at 20Hz ~ 50Hz, but can I measure the 
propagation delay between the drivers? Is the 0x900~ reg valid even if I'm 
using SM2 sync mode?

I'm using Linux 4.14.67-rt40, IgH 1.5.2 w/ all unofficial patches.

Thanks,
Louie.
___
etherlab-users mailing list
etherlab-users@etherlab.org
https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.etherlab.org%2Fmailman%2Flistinfo%2Fetherlab-usersdata=02%7C01%7Cgavin.lambert%40tomra.com%7C495c9e98e5274687d38b08d74bd47183%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637061248127120972sdata=MwIVHFqDgr3X%2FLoa1UvePOvMtI6gOF%2BYYqleVo9ZR9I%3Dreserved=0
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] SDO dictionary upload "Input/output error"

2020-02-25 Thread Gavin Lambert
You should also mention which version of the unofficial patchset you're using 
-- and you must be using it, since this function doesn't exist in the mainline 
release.

Setting "ethercat debug 1" prior to running "ethercat sdos" and then observing 
the syslog output might shed some more light on it.  If that's not enough, then 
observing the EtherCAT traffic with Wireshark or another method may also 
provide more insight.

Doing this from your master application is very strongly non-recommended, 
though -- the whole point of making the SDO dictionary upload not occur 
automatically any more in the patchset is that in almost no case (other than 
initial interactive commissioning, when you're deciding which PDOs you should 
code into your master application) should you actually need the dictionary 
data.  And as you've noted yourself, it's very slow.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Gary Grobe
Sent: Tuesday, 25 February 2020 11:47
To: etherlab-users@etherlab.org
Subject: [etherlab-users] SDO dictionary upload "Input/output error"

I'm trying to upload the SDO dictionary in order to compare user configurations 
against the dictionary before activating the master. 
Using Etherlab 1.5.2 with 4.19.90-rt35.

An SDO upload usually takes 10-15 seconds (Elmo's have large
dictionaries) and only after that time does the error get issued. 
Running the command again would quickly succeed and then continue on to the 
next slave. I get the feeling the second time around it would find that it 
already uploaded (cached in the master?) and then move on to the next slave. 
But lately it's gotten worse. I can issue commands via the ethercat tool just 
fine, with exception to "sdos." My app and the ethercat tool give the same 
results.

"Failed to upload dictionary: Input/output error"

In the past when working with /dev handles, an error such as this would cause 
me to look at hardware, but I'm just not seeing anything wrong w/ my 
connections.

I'm aware of the different ways of doing SDO transfers (e.g.,
ecrt_master_sdo_upload() for a single SDO, and others to configure or get after 
having activated the master). But what I'm doing is very similar to how the 
ethercat tool does it's uploads, via the ioctl interface and the results are 
the same.

     device_name = "/dev/EtherCAT";
     // ...

     if ((fd = ::open(device_name.c_str(), flags)) == -1) { /* ... */ }

     // mod info ... ioctl interface vers. ...

     // get master
     if (ioctl(fd, EC_IOCTL_MASTER, data.get()) < 0) { /* ... */ }

     // discovery happening here ...

     // upload SDO dictionary
     if (si->coe_details.enable_sdo_info) {
     // ...

     if (upload_sdo_dictionary(dict_upload) < 0)
     return nullptr;
     }

int EthercatDiscovery::upload_sdo_dictionary(
     std::shared_ptr data) {
     if (ioctl(fd, EC_IOCTL_SLAVE_DICT_UPLOAD, data.get()) < 0) {
     std::cerr << "Error: failed to upload dictionary: " <<
     strerror(errno) << std::endl;

     // The errno here will result in "Input/output error"

     return -1;
     }

     return 0;
}

So it would appear that the master is aborting the SDO upload. Can anyone offer 
advice as to what might be happening here?






-- 
_The contents of this email message and any attachments are intended solely 
for the addressee(s).  This message (including any attachments) may contain 
confidential, proprietary, privileged and/or private information. The 
information is intended to be for the use of the individual or entity 
designated above. If you are not the intended recipient of this message, 
please notify the sender immediately, and delete the message and any 
attachments.  _Any disclosure, reproduction, distribution or other use of 
this message or any attachments by an individual or entity other than the 
intended recipient is prohibited. __
___
etherlab-users mailing list
etherlab-users@etherlab.org
https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.etherlab.org%2Fmailman%2Flistinfo%2Fetherlab-usersdata=02%7C01%7Cgavin.lambert%40tomra.com%7Cf6eb9a0831a04acd097b08d7b97b85b8%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637181812484365122sdata=f%2B%2Bi%2B8tCLJiYFsyv%2B5g92xgRwMUxpv0QYPzoWSFChi4%3Dreserved=0
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Slave lost forever after power cycling

2020-02-16 Thread Gavin Lambert
Have you tried putting it in different positions on the slave network?  Perhaps 
it only vanishes when downstream of a particular slave; then the problem might 
be with that slave's configuration.

Etherlab typically assumes that all slaves are configured with DL auto-open 
mode (so that slaves that are connected or rebooted are automatically brought 
into the virtual ring network), but it's possible that one of your upstream 
slaves has been configured in the explicit open mode instead.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>  
[cid:insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png] 
<https://www.instagram.com/compacsort/>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: Joachim Sällvin
Sent: Friday, 14 February 2020 22:34
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Slave lost forever after power cycling

Hi all,

I loose contact with my TU4-ECT (freq inverter from Nord Drive) slave after 
power-cycling it when there are other slaves on the bus. This happens 
intermittently. Only a EEPROM reset (I use TwinCAT for this ) can make it 
accessible again. When it is the only slave on the bus it seems as I can 
power-cycle and always access again.

Has anyone experienced the same problem? What might cause this? Workarounds?

Example:

Before power-cycling the TU4-ECT (all slaves have been given alias addresses):


$ sudo ethercat slaves

0  1:0  PREOP  +  EK1100 EtherCAT-Koppler (2A E-Bus)

1  2:0  PREOP  +  EL2004 4K. Dig. Ausgang 24V, 0.5A

2  3:0  PREOP  +  ifm IO-Link Master AL1332

3  4:0  INIT   E  TU4-ECT



After power-cycling the TU4-ECT:



$ sudo ethercat slaves

0  1:0  PREOP  +  EK1100 EtherCAT-Koppler (2A E-Bus)

1  2:0  PREOP  +  EL2004 4K. Dig. Ausgang 24V, 0.5A

2  3:0  PREOP  +  ifm IO-Link Master AL1332

3  8:0  PREOP  +  ifm IO-Link Master AL1332



Lost!!!



I'm using Linux kernel 4.13.13-rt5, Ubuntu 18.04 and EtherCAT master 1.5.2.







Joachim Sällvin












___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] DC drift issue

2020-01-08 Thread Gavin Lambert
You should probably start with instrumentation -- try adding performance 
counters around your cyclic loop and verify that you're not getting any timing 
blowouts (post them to another thread to actually process/log, though).

You can also enable the debug interface or insert a switch with another PC 
between the master and first slave, and then use Wireshark to log your packets 
and verify the timing of the LWR datagrams in particular.

Be careful with things like slots/signals -- depending on particular 
implementation, they can execute on the same thread or a separate thread, and 
often use mutexes in their implementations.  Mutexes are very dangerous to the 
performance of RT cyclic loops, especially when their "other end" is a non-RT 
thread.  Prefer using lock-free queues (eg. a simple circular buffer) to 
communicate between RT and non-RT threads.

Also, using CLOCK_REALTIME is not recommended -- this is the wall-clock time, 
which is affected by things like NTP resyncing and OS suspend.  Prefer using 
CLOCK_MONOTONIC instead.  (Some people recommend CLOCK_MONOTONIC_RAW, as this 
is also immune to NTP drift compensation, but so far at least I think it's 
better to keep that so that you're less subject to the whims of your clock 
hardware.  And the raw clock is slower as well, counterintuitively.)


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Romain Virot
Sent: Thursday, 9 January 2020 01:55
To: etherlab-users@etherlab.org
Subject: [etherlab-users] DC drift issue

Hi,

After lurking on the list and trying many different things, I'm looking for 
some help.

I have issues with DC syncing in my setup. I'm using a Beckhoff CX5140, 
4.4.112-rt127-lp151-rt kernel with all the patches from Gavin and 64-bit DC 
modules (so far one EL7041 and one ELM3004- both from Beckhoff) at 1kHz 
(I've also tested 200Hz and 400 Hz with similar behavior).

I can successfully enter my cyclic loop, with the system being synchronized, 
but after some time (typ. few hundred seconds) the dmesg indicates many 
unmatched datagrams :


[14364.891659] EtherCAT WARNING: Datagram 88003f81d6d8 (domain0-0-main) was 
SKIPPED 1004 times.
[14365.712234] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14365.897276] EtherCAT WARNING: Datagram 88003f81d6d8 (domain0-0-main) was 
SKIPPED 1004 times.
[14366.713842] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14366.902893] EtherCAT WARNING: Datagram 88003f81d6d8 (domain0-0-main) was 
SKIPPED 1004 times.
[14367.715453] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14367.908512] EtherCAT WARNING: Datagram 88003f81d6d8 (domain0-0-main) was 
SKIPPED 1004 times.
[14368.717066] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14368.914130] EtherCAT WARNING: Datagram 88003f81d6d8 (domain0-0-main) was 
SKIPPED 1003 times.
[14369.718690] EtherCAT WARNING 0: 2 datagrams TIMED OUT!
[14369.718700] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14369.919746] EtherCAT WARNING: Datagram 88003f81d6d8 (domain0-0-main) was 
SKIPPED 1004 times.
[14370.720285] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14370.925364] EtherCAT WARNING: Datagram 88003f81d6d8 (domain0-0-main) was 
SKIPPED 1004 times.
[14371.721901] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14371.930982] EtherCAT WARNING: Datagram 88003f81d6d8 (domain0-0-main) was 
SKIPPED 1004 times.
[14372.723535] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14372.936607] EtherCAT WARNING: Datagram 88003f81d6d8 (domain0-0-main) was 
SKIPPED 1003 times.
[14373.725111] EtherCAT WARNING 0: 2 datagrams TIMED OUT!




My code is roughly set-up like this:

- Before RT -
ecrt_slave_config_dc(module->getSlaveConfig(ELM3004), 0x0700, 100, 50, 
2, 0);   // ELM3004
ecrt_slave_config_dc(module->getSlaveConfig(EL7041), 0x0300, 100, 50,, 
0, 0); // EL7041

ecrt_master_select_reference_clock(master, network->getModule(EL7041); // 
Defines the EL7041 as the ref clock


- Before the cyclic task -

ecrt_master_set_send_interval(ethercatHandler->getMaster(), 
TIMESPEC2NS(cycletime) / 1000); // set the send interval to 1000 us 
clock_gettime(CLOCK_REALTIME, ); 
ecrt_master_application_time(ethercatHandler->getMaster(), 
TIMESPEC2NS(wakeupTime)); 
ecrt_master_sync_slave_clocks(ethercatHandler->getMaster());

- Cyclic task -

wakeupTime = timespec_add(wakeupTime, cycletime); 
clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, , nullptr); // sleep 
until next cycle

ecrt_master_receive(ethercatHandler->ge

Re: [etherlab-users] ec_igb memory leak?

2020-03-12 Thread Gavin Lambert
The IGB driver is relatively new and probably hasn't been as well tested as the 
other drivers.

Any chance you can try it with kernel 4.4?  This is the only (4.x) version 
provided by upstream Etherlab, so it'd be good to work out whether the leak is 
present in that version as well or if I've somehow managed to introduce it 
during the course of trying to patch it for newer kernel versions.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Gary Grobe
Sent: Friday, 13 March 2020 09:57
To: etherlab-users@etherlab.org
Subject: [etherlab-users] ec_igb memory leak?

Has anyone else noticed memory leaks when loading the ec_igb mod?

I'm running a 4.19.106 LTS release with RT 44 and Etherlabs 1.5.2 with patch 
20190904. I've tested every RT release as far back as 4.19.82 with the same 
results. I have had days of running the master without issue when used with 
ec_generic and ec_e1000e.

In this case, it appears to be the ec_igb driver.

I'll boot the kernel without any of the Etherlab modules and watch the used 
memory in top while performing no other tasks. It'll stay quite stable for as 
long as I run it. Then I'll add in the ec_master module and other than a slight 
bump, it'll stay quite stable for as long as I run it.

Then I'll add the ec_igb module and that's when the used mem will continuously 
increase. Within 5 minutes I noticed an increase of 55320KiB.

I find it strange I've not heard other reports about this happening, but would 
like to know if anyone else has thoughts on this.

Thanks,


--
_The contents of this email message and any attachments are intended solely for 
the addressee(s).  This message (including any attachments) may contain 
confidential, proprietary, privileged and/or private information. The 
information is intended to be for the use of the individual or entity 
designated above. If you are not the intended recipient of this message, please 
notify the sender immediately, and delete the message and any attachments.  
_Any disclosure, reproduction, distribution or other use of this message or any 
attachments by an individual or entity other than the intended recipient is 
prohibited. __ ___
etherlab-users mailing list
etherlab-users@etherlab.org
https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.etherlab.org%2Fmailman%2Flistinfo%2Fetherlab-usersdata=02%7C01%7Cgavin.lambert%40tomra.com%7C16903dc803c34ab50f4408d7c6c7df8e%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637196434059087003sdata=ko9CgkIEyUJfgEhoNeqYNUf9307tKwCkG8EJ%2BzTUoTI%3Dreserved=0
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] reg_read ==> Failed to read register

2020-04-14 Thread Gavin Lambert
Register 0x6004 doesn't exist.  All registers have addresses < 0x1000.  Perhaps 
you meant to use "download" instead of "reg_read"?


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>  
[cid:insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png] 
<https://www.instagram.com/compacsort/>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: Joachim Sällvin
Sent: Tuesday, 14 April 2020 21:55
To: etherlab-users@etherlab.org
Subject: [etherlab-users] reg_read ==> Failed to read register

Hi, what could cause this? What should I try to do next, ideas?

$ ethercat -p1 reg_read 0x6004 4
Failed to read register: Input/output error

dmesg
[417280.571018] Datagram received.
[417280.571024] EtherCAT ERROR 0-main-1: Register request failed (working 
counter is 0).

My application fails to exchange process data so I figured I'd try the command 
line tool. What could cause this kind of problem?

Some info about my system:

$ ethercat version
IgH EtherCAT master 1.5.2 35e7f0841303


$ ethercat slaves
0  701:0  PREOP  +  EP3174-0002 4K. Ana. Eingang +/-10V, 0-10V, 0/4-20mA 
konfigurie
1  601:0  PREOP  +  LeineAndLinde Encoder


$ ethercat -p1 cstruct
/* Master 0, Slave 1, "LeineAndLinde Encoder"
 * Vendor ID:   0x0194
 * Product code:0x0600
 * Revision number: 0x0001
 */

ec_pdo_entry_info_t slave_1_pdo_entries[] = {
{0x6004, 0x00, 32},
{0x1001, 0x00, 16},
{0x6503, 0x00, 16},
{0x6505, 0x00, 16},
{0x2060, 0x00, 32},
{0x6030, 0x00, 16},
{0x6040, 0x00, 16},
{0x2100, 0x00, 16},
};

ec_pdo_info_t slave_1_pdos[] = {
{0x1a00, 8, slave_1_pdo_entries + 0}, /* Configurable TxPDO map with max 8 
PDO */
};

ec_sync_info_t slave_1_syncs[] = {
{0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
{1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
{2, EC_DIR_OUTPUT, 0, NULL, EC_WD_ENABLE},
{3, EC_DIR_INPUT, 1, slave_1_pdos + 0, EC_WD_DISABLE},
{0xff}
};

 Thanks in advance,

Joachim Sällvin

___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] reg_read ==> Failed to read register

2020-04-14 Thread Gavin Lambert
Err, "upload", I mean.  Uploading is reading from the device.  I always get 
those ones mixed up.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>  
[cid:insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png] 
<https://www.instagram.com/compacsort/>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: Gavin Lambert
Sent: Wednesday, 15 April 2020 10:19
To: Joachim Sällvin ; 
etherlab-users@etherlab.org
Subject: Re: [etherlab-users] reg_read ==> Failed to read register

Register 0x6004 doesn't exist.  All registers have addresses < 0x1000.  Perhaps 
you meant to use "download" instead of "reg_read"?


Gavin Lambert
Senior Software Developer


[cid:image001.png@01D6131B.D84518A0]
[cid:image002.png@01D6131B.D84518A0]<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.compacsort.com%2F=02%7C01%7Cgavin.lambert%40tomra.com%7C9323629b714e493269ec08d7e0c1e589%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637224995699680702=hP1tqYmJd1HpvkGbckxldzGUAWXuIecxUL9TzOHK8Po%3D=0>[cid:image003.png@01D6131B.D84518A0]<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.facebook.com%2FCompacsort=02%7C01%7Cgavin.lambert%40tomra.com%7C9323629b714e493269ec08d7e0c1e589%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637224995699680702=plHesJhh12oiukMTw2DVbcPaZbKxMmUECQmJhMscYR4%3D=0>[cid:image004.png@01D6131B.D84518A0]<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Fcompac-sorting-equipment%2F=02%7C01%7Cgavin.lambert%40tomra.com%7C9323629b714e493269ec08d7e0c1e589%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637224995699690694=vMCuikpZenxP7idOFcwhqu%2FioAWTIV7r51%2B%2F27uWk3c%3D=0>[cid:image005.png@01D6131B.D84518A0]<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fvimeo.com%2Fcompacsort=02%7C01%7Cgavin.lambert%40tomra.com%7C9323629b714e493269ec08d7e0c1e589%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637224995699690694=400fmao%2FjOiMbR9B18p8amPElwNTaOwE%2F3TykZoyBd4%3D=0>[cid:image006.png@01D6131B.D84518A0]<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2Fcompacsort=02%7C01%7Cgavin.lambert%40tomra.com%7C9323629b714e493269ec08d7e0c1e589%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637224995699690694=GLABUfRXWz1FJ2G9IeBqPUGwReI4EchE65itaEIwlBA%3D=0>[cid:image007.png@01D6131B.D84518A0]<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.instagram.com%2Fcompacsort%2F=02%7C01%7Cgavin.lambert%40tomra.com%7C9323629b714e493269ec08d7e0c1e589%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637224995699700687=hVCwb6RKESpc9p4fJgR%2BKdHurbWDlQXDVSj5v0fRzko%3D=0>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | 
tomra.com<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.tomra.com%2F=02%7C01%7Cgavin.lambert%40tomra.com%7C9323629b714e493269ec08d7e0c1e589%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637224995699700687=udYFWAMLuZKxo1uO0DwhFsDbqsfXiyECHmnX4o1s0Mc%3D=0>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: Joachim Sällvin
Sent: Tuesday, 14 April 2020 21:55
To: etherlab-users@etherlab.org<mailto:etherlab-users@etherlab.org>
Subject: [etherlab-users] reg_read ==> Failed to read register

Hi, what could cause this? What should I try to do next, ideas?

$ ethercat -p1 reg_read 0x6004 4
Failed to read register: Input/output error

dmesg
[417280.571018] Datagram received.
[417280.571024] EtherCAT ERROR 0-main-1: Register request failed (working 
counter is 0).

My application fails to exchange process data so I figured I'd try the command 
line tool. What could cause this kind of problem?

Some info about my system:

$ ethercat version
Ig

Re: [etherlab-users] Problem at unplug and reconnection of network cable with Etherlab master patchset 20190904

2020-04-16 Thread Gavin Lambert
The udev rule is intended for motherboards with onboard e1000e only, due to an 
adverse interaction between the MEI power-saving and E1000E.  I don't think it 
will help with add-in cards - but then, in my testing none of the add-in cards 
that I had were affected by the issue either, since they shouldn't be 
interacting with the MEI.

As noted in the docs, restarting the ethercat service (thereby reloading the 
driver) should also recover from the fault, though obviously that's not an 
acceptable workaround in practice.

The good news is that (if it's the same issue) if you switch to the generic 
driver then the problem should go away.  The bad news is that this may limit 
your real-time performance.  Another option is to drop back to Debian 8, or at 
least a pre-4.4 Linux kernel.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>  
[cid:insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png] 
<https://www.instagram.com/compacsort/>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: BUSSIERES Vincent
Sent: Friday, 17 April 2020 11:23
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Problem at unplug and reconnection of network cable 
with Etherlab master patchset 20190904

Dear Etherlab users,

I am developing a software using Etherlab master patchset 20190904 for recent 
kernels.
My environment is Linux Debian 9.5 with 4.9.0-8-amd64 kernel. I am using a 
add-in network card, Kernel driver in use is ec_e100e.
I connect only one slave to the master.

I noticed strange behaviours when I unplug and reconnect network cable. First 
times everythings is OK, I can see state link jump from up to down and down to 
up, communication resumes.
But sometimes my software doesn't respond neither ethercat tools. Communication 
is break down, command etherlab master doesn't work too.
I must reboot computer to make it works again.

As advised in the patch documentation, I add a rule with the following content 
: ACTION=="add",KERNEL=="mei0",ATTR{../../power/control}="on" but that didn't 
solve the problem.

I didn't notice something wrong in dmesg log below.

[  171.720209] EtherCAT DEBUG: 0C D1 00 00 00 00 1D 00 00 00 00 00 00 00 00 00
[  171.720214] EtherCAT DEBUG: 00 00 00 00 00 00 0F 00 00 00 00 00 00 00 00 00
[  171.720218] EtherCAT DEBUG: 00 08 00 38 C0 37 06 00 00 00 00 00
[  171.721186] EtherCAT DEBUG 0: Datagram 8cb3d35a93d8 already queued 
(skipping).
[  171.721187] EtherCAT DEBUG 0: ec_master_send_datagrams(device_index = 0)
[  171.721187] EtherCAT DEBUG 0: Adding datagram 0xD2
[  171.721188] EtherCAT DEBUG 0: frame size: 46
[  171.721188] EtherCAT DEBUG 0: Sending frame:
[  171.721188] EtherCAT DEBUG: FF FF FF FF FF FF 68 05 CA 8B CE EB 88 A4 29 10
[  171.721192] EtherCAT DEBUG: 0C D2 00 00 00 00 1D 00 00 00 00 00 00 00 00 00
[  171.721196] EtherCAT DEBUG: 00 00 00 00 00 00 0F 00 00 00 00 00 00 00 00 00
[  171.721200] EtherCAT DEBUG: 00 08 00 38 C0 37 06 00 00 00 00 00
[  171.722184] EtherCAT DEBUG 0: Datagram 8cb3d35a93d8 already queued 
(skipping).
[  171.722185] EtherCAT DEBUG 0: ec_master_send_datagrams(device_index = 0)
[  171.722185] EtherCAT DEBUG 0: Adding datagram 0xD3
[  171.722186] EtherCAT DEBUG 0: frame size: 46
[  171.722186] EtherCAT DEBUG 0: Sending frame:
[  171.722186] EtherCAT DEBUG: FF FF FF FF FF FF 68 05 CA 8B CE EB 88 A4 29 10
[  171.722190] EtherCAT DEBUG: 0C D3 00 00 00 00 1D 00 00 00 00 00 00 00 00 00
[  171.722194] EtherCAT DEBUG: 00 00 00 00 00 00 0F 00 00 00 00 00 00 00 00 00
[  171.722198] EtherCAT DEBUG: 00 08 00 38 C0 37 06 00 00 00 00 00
[  171.723188] EtherCAT DEBUG 0: Datagram 8cb3d35a93d8 already queued 
(skipping).
[  171.723189] EtherCAT DEBUG 0: ec_master_send_datagrams(device_index = 0)
[  171.723189] EtherCAT DEBUG 0: Adding datagram 0xD4
[  171.723190] EtherCAT DEBUG 0: frame size: 46
[  171.723190] EtherCAT DEBUG 0: Sending frame:
[  171.723190] EtherCAT DEBUG: FF FF FF FF FF FF 68 05 CA 8B CE EB 88 A4 29 10
[  171.723194] EtherCAT DEBUG: 0C D4 00 00 00 00 1D 00 00 00 00 

Re: [etherlab-users] Beckhoff EL2809 (16 digital outputs) initialization issue

2020-04-22 Thread Gavin Lambert
If ecrt_domain_reg_pdo_entry_list returns an error, it has nothing to do with 
the slave itself, it means you're passing inconsistent data.

Having said that, at a glance I don't see any obvious issues with the code 
you've posted (except that you probably should have the watchdog enabled, but 
that's an unrelated issue).  When the error occurs, have a look at the syslog 
output; it should tell you more.  If that's not enlightening enough, then set 
"ethercat debug 1" before running your code and check the syslog again.

There is an EC_WRITE_BIT as well.  In addition to the byte offset (which is 
stored in [x] in your example), you need to pass a second pointer in 
ec_pdo_entry_reg_t to capture the bit offset, when using data smaller than 1 
byte.

(Alternatively, while this is technically not robust and may potentially break 
due to other network layout, given the total size of the SMs it's reasonably 
safe to assume that the 16 outputs will be mapped to two physical bytes, so you 
can just use EC_WRITE_U8 at the byte address of outputs 1 and 9, respectively.  
Or even EC_WRITE_U16 just to the address of output 1.  You will have to be 
careful about potential bit ordering differences between your master and slave, 
however.)


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>  
[cid:insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png] 
<https://www.instagram.com/compacsort/>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: BUSSIERES Vincent
Sent: Thursday, 23 April 2020 08:50
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Beckhoff EL2809 (16 digital outputs) initialization 
issue

Dear Etherlab users,

I am working with a Beckhoff EL2809 module (16 digital outputs module) and I 
have some difficulties to register pdo entries.
I think that for this module pdo are not assignable.

You can find some informations about this product below :

=== Master 0, Slave 3 ===
Device: Main
State: PREOP
Flag: +
Identity:
  Vendor Id:   0x0002
  Product code:0x0af93052
  Revision number: 0x0012
  Serial number:   0x
DL information:
  FMMU bit operation: no
  Distributed clocks: yes, delay measurement only
  DC system time transmission delay: 885 ns
Port  Type  Link  LoopSignal  NextSlave  RxTime [ns]  Diff [ns]   NextDc 
[ns]
   0* EBUS  upopenyes 2   2053620480   0 145
   1  EBUS  upopenyes 4   2053621070 590 140
   2  N/A   down  closed  no  --   -   -
   3  N/C   down  closed  no  --   -   -
General:
  Group: DigOut
  Image name:
  Order number: EL2809
  Device name: EL2809 16K. Dig. Ausgang 24V, 0.5A
  Flags:
Enable SafeOp: no
Enable notLRW: no
  Current consumption: 140 mA

SM0: PhysAddr 0x0f00, DefaultSize1, ControlRegister 0x44, Enable 9
  RxPDO 0x1600 "Channel 1"
PDO entry 0x7000:01,  1 bit, "Output"
  RxPDO 0x1601 "Channel 2"
PDO entry 0x7010:01,  1 bit, "Output"
  RxPDO 0x1602 "Channel 3"
PDO entry 0x7020:01,  1 bit, "Output"
  RxPDO 0x1603 "Channel 4"
PDO entry 0x7030:01,  1 bit, "Output"
  RxPDO 0x1604 "Channel 5"
PDO entry 0x7040:01,  1 bit, "Output"
  RxPDO 0x1605 "Channel 6"
PDO entry 0x7050:01,  1 bit, "Output"
  RxPDO 0x1606 "Channel 7"
PDO entry 0x7060:01,  1 bit, "Output"
  RxPDO 0x1607 "Channel 8"
PDO entry 0x7070:01,  1 bit, "Output"
SM1: PhysAddr 0x0f01, DefaultSize1, ControlRegister 0x44, Enable 9
  RxPDO 0x1608 "Channel 9"
PDO entry 0x7080:01,  1 bit, "Output"
  RxPDO 0x1609 "Channel 10"
PDO entry 0x7090:01,  1 bit, "Output"
  RxPDO 0x160a "Channel 11"
PDO entry 0x70a0:01,  1 bit, "Output"
  RxPDO 0x160b "Channel 12"
PDO entry 0x70b0:01,  1 bit, "Output&qu

Re: [Etherlab-users] dynamic PDO unmapping

2020-09-17 Thread Gavin Lambert
(Forwarding an earlier reply back to the list; it got stuck in moderation due 
to signature images out of my control.)



No, not without deactivating the master and reconfiguring it.  But for the 
master to know that it needs to do that, you'd have to have your safety routine 
communicate a fault back to the master, in which case you can tell it to change 
its normal PDO output to a safe value instead of stopping communication.  
Usually this will take at least one cycle to get the status update, so you 
probably can't avoid sending the "wrong" value at least once.

Meanwhile the servo slave itself, when it detects a fault condition, should go 
into a state where it ignores whatever values the master is sending (unless it 
considers them "safe" for its fault condition), bridging the time between when 
the fault is detected and when the master notices and updates its outputs.

(If this isn't your own slave device then you should probably be asking the 
slave vendor how to do this sort of thing properly.)

---- 


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
From: BUSSIERES Vincent
Sent: Thursday, 17 September 2020 07:55
To: etherlab-users@etherlab.org
Subject: [Etherlab-users] dynamic PDO unmapping

Hello, 

I'd like to unmapp PDOs dynamically or to stop sending PDO data to a particular 
slave. 
My EtherCAT network includes 6 slaves, among them digital inputs / outputs 
modules and servodrives modules.
I have developped safety functions embeded into the servodrives modules. For 
instance, in case of emergency stop, the embeded program reads digital safety 
emerency input and configures a torque setpoint to stop the motor very quickly. 
The problem is that EtherCAT master sends PDO frames continuously to all the 
slaves, in particular torque setpoint PDO to servodrive. Therefor the setpoint 
configured in embeded program is replaced by the one sent by EtherCAT master.
 
So I'd like to know if it is possible to stop sending temporarly PDO to a 
particular slave or unmapp these PDOs.
 
Best regards
 
Vincent BUSSIERES
Responsable Technique Logiciel
 

ZE Ma Campagne
36, Impasse Félix Nadar
16000 ANGOULEME
Tel: 33 (0)9.72.40.35.08
-- 
Etherlab-users mailing list
Etherlab-users@etherlab.org
http://lists.etherlab.org/cgi-bin/mailman/listinfo/etherlab-users


Re: [etherlab-users] foe_write returns error

2020-05-27 Thread Gavin Lambert
Which version of the Etherlab master are you using?

Out of the box, FoE does not work – you need to use the unofficial patchset 
version.

Having said that, where possible I’d still recommend using TwinCAT to update 
the firmware of Beckhoff slaves.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>  
[cid:insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png] 
<https://www.instagram.com/compacsort/>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: Pierre Kurkdjian
Sent: Thursday, 28 May 2020 05:20
To: etherlab-users@etherlab.org
Subject: [etherlab-users] foe_write returns error

Hello Etherlab Ethercat community,


I am trying to update the ethercat firmware of a Beckhoff slave using the 
command “ethercat foe_write”.

I set the ethercat slave to the right state (BOOT state) and then I run the 
command “ethercat foe_write”. Unfortunately I get an error message (“Failed to 
write via FoE: FOE_TIMEOUT_ERROR”) and I don’t know whether the firmware has 
been updated or not.



This is what I do:



$ ethercat -p0 state INIT

$ ethercat -p0 state BOOT

$ ethercat foe_write -p0 -o ECATFW__ the_new_firmware.hex

Failed to write via FoE: FOE_TIMEOUT_ERROR


Notice: the file named “the_new_firmware.hex“ really  exists. If I enter the 
name of a non-existing file then I get a different error message.
Did someone get the same issue. Thank you for your help.

Best,
Pierre
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] etherlab-users@etherlab.org

2020-06-17 Thread Gavin Lambert
"automake: warnings are treated as errors" is most likely your problem.

Check your environment; it looks like automake will treat WARNINGS=error as a 
request for this, for example.  There may be other triggers as well.

Alternatively, to fix the "subdir-objects" warning at least you can try using 
the unofficial patchset at 
https://sourceforge.net/u/uecasm/etherlab-patches/ci/default/tree/ -- it 
definitely resolves that particular warning, though I'm not sure if it's 
completely warning-clean.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>  
[cid:insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png] 
<https://www.instagram.com/compacsort/>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: Steih, Martin
Sent: Wednesday, 17 June 2020 23:14
To: etherlab-users@etherlab.org
Subject: [etherlab-users] etherlab-users@etherlab.org

Hello,

lately, after getting the code from sourceforge, I am getting errors trying to 
bootstrap the etherlab-master code. See the output below. Has anyone an idea of 
why this error occurs? It did not occur two month ago but now occurs 
consistently on stretch as well buster.

+ touch ChangeLog   
+ autoreconf -i 

configure.ac:44: installing 'autoconf/compile'  
configure.ac:44: installing 
'autoconf/config.guess' 
configure.ac:44: installing 'autoconf/config.sub'   
configure.ac:33: installing 
'autoconf/install-sh'   
configure.ac:33: installing 'autoconf/missing'  

examples/dc_user/Makefile.am: installing 'autoconf/depcomp' 
automake: warnings are treated as 
errors  
  /usr/share/automake-1.15/am/ltlibrary.am: warning: 'libethercat.la': 
linking libtool libraries using a non-POSIX
/usr/share/automake-1.15/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 
'configure.ac'  lib/Makefile.am:33:   while 
processing Libtool library 'libethercat.la' 
tool/Makefile.am:38: warning: source file '../master/soe_errors.c' 
is in a subdirectory,tool/Makefile.am:38: but 
option 'subdir-objects' is disabled 
   automake: warning: possible forward-incompatibility. 
   automake: At least a 
source file is in a subdirectory, but the 'subdir-objects'  
   automake: automake option hasn't been enabled.  For now, the 
corresponding output   automake: object 
file(s) will be placed in the top-level directory.  However,
   automake: this behaviour will change in future Automake 
versions: they will automake: 
unconditionally cause object files to be placed in the same subdirectory
  automake: of the corresponding sources.   
  automake: 
You are advised to start using 'subdir-objects' option throughout your  
  automake: project, to avoid future 
incompatibilities.  
 autoreconf: automake failed with exit status: 1

i. A. Martin Steih
Entwicklung

Re: [etherlab-users] Invalid output configuration

2020-06-03 Thread Gavin Lambert
Typically, yes.

What you should try is this:

 1.  Ensure that your master app is not running.
 2.  Physically reboot the slave (eg. power cycle).
 3.  Run “ethercat cstruct -p0” (substitute the position of your actual slave 
if different)
 4.  Compare the output to the code in your master app.

This will tell you the default PDO layout of the slave, which is typically what 
you want to use in your master app – unless you can prove otherwise, assume 
anything different in your code is a bug.

In some cases you may want to use some non-default PDOs, and there are ways to 
get the cstruct output for that as well, but typically slaves will only support 
a limited set of alternative configurations.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>  
[cid:insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png] 
<https://www.instagram.com/compacsort/>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: William Zumwalt
Sent: Thursday, 4 June 2020 12:15
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Invalid output configuration

I getting "Invalid output configuration" when starting up a slave. Can anyone 
help narrow this down, to what this might refer to?

[ 4101.757740] EtherCAT DEBUG 0-main-0: PREOP -> PREOP + ERROR.
[ 4101.757751] EtherCAT ERROR 0-main-0: Failed to set SAFEOP state, slave 
refused state change (PREOP + ERROR).
[ 4101.765760] EtherCAT 0: Slave states on main device: PREOP + ERROR.
[ 4101.765769] EtherCAT ERROR 0-main-0: AL status message 0x001D: "Invalid 
output configuration".

Could this be configuration issue with the sync EC_DIR_OUTPUT?

___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [Etherlab-users] Running a large number of slaves

2021-05-05 Thread Gavin Lambert
In theory, RxPDOs can be overlaid with TxPDOs, but not RxPDOs with other RxPDOs 
or TxPDOs with other TxPDOs.  Each FMMU must be treated as atomic -- it's 
technically ok for one slave to have some FMMUs in one packet and some in 
another (although it's better if they're all in one, and some slaves may 
actually not work correctly if they're split) but you can't "split" an FMMU 
between two packets.



Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
From: Graeme Foot  
Sent: Thursday, 6 May 2021 10:49 am
To: Geller, Nir ; Gavin Lambert 
; Richard Hacker ; 
etherlab-users@etherlab.org
Subject: RE: [Etherlab-users] Running a large number of slaves


Hi Nir,

I don't use overlapping PDO's and don't know the constraints on them, but 
looking at the code, if you remove the "if (fmmu->logical_domain_offset >= 
candidate_start)" condition there will be a couple of problems.

1) When creating the first datagram the "emplace_datagram()" call will receive 
an incorrect data size.  The data size is calculated by "valid_start - 
datagram_offset".  "valid_start" for the current FMMU assumes that it is at the 
end of the previous FMMU, but due to the overlap it is still at the start of 
the previous FMMU.  On the other hand it looks like the datagrams working 
counter will include counts for the first FMMU, and be missed for the second 
datagram.  The domain working counter should however be correct.

2) It looks like a slave with more than 2 overlapping FMMU's can stack their tx 
and rx data separately.  If a datagram fills up after the first 2 FMMU's the 
data will be split between two datagrams which probably won't work at all.  
e.g. if 3 won't fit, 1 & part of 2 will end up in the first datagram, the rest 
of 2, 3 & 4 will end up in the second datagram:
rx: ---1 ---3---
tx: --2- ---4

(I have come across slaves with more than 2 FMMU's, but don't know if they can 
also be overlapped.)

So, I don't think this is the correct fix.


There is a "TODO overlapping PDOs" section in slave_config.c that look's like 
it is a thought on how to deal with the problem, but it looks like it is trying 
to align pairs of rx/tx data rather than allowing the example in #2 above.

I suspect the answer will be for "ec_domain_finish()" to refer back to the 
slave and if it has overlapping pdo's make sure all pdo's from the slave make 
it into the same datagram.  I'm out of time to look further at the moment.

Regards,
Graeme.


-Original Message-
From: Etherlab-users <mailto:etherlab-users-boun...@etherlab.org> On Behalf Of 
Geller, Nir
Sent: Wednesday, 5 May 2021 21:20
To: Gavin Lambert <mailto:gavin.lamb...@tomra.com>; Richard Hacker 
<mailto:h...@igh.de>; mailto:etherlab-users@etherlab.org
Subject: Re: [Etherlab-users] Running a large number of slaves

I think I got caught in a very specific situation that isn't handled properly 
by the code.

I will try to describe it more accurately.

The last slave in the topology supports overlapping PDOs, therefore Rx and Tx 
FMMUs logical_domain_offset have the same value.
Suppose until the last slave the accumulated domain size is 1400, the last 
slave's Rx PDO size is 30, and the Tx PDO size is 150.

The last slave's Rx FMMU is handled first by the loop.
The condition
if (fmmu->logical_domain_offset + fmmu->data_size - datagram_offset > 
(EC_MAX_DATA_SIZE)) is not met, and candidate_start is set to the value of the 
Rx FMMU logical_domain_offset.

The Tx FMMU is handled second by the loop, but this time the condition if 
(fmmu->logical_domain_offset >= candidate_start) is not met.

Being the last slave in the topology, the loop ends, and only 1 LRW datagram in 
size > 1500 is created after the condition if (domain->data_size > 
datagram_offset)

Removing completely the condition
if (fmmu->logical_domain_offset >= candidate_start)

fixes the error, but I'm not sure if it safe.
What do you think?

Thanks,

Nir.


-Original Message-
From: Gavin Lambert <mailto:gavin.lamb...@tomra.com>
Sent: Wednesday, May 5, 2021 1:25 AM
To: Geller, Nir <mailto:nir.gel...@servotronix.com>; Richard Hacker 
<mailto:h...@igh.de>; mailto:etherlab-users@etherlab.org
Subject: RE: [Etherlab-users] Running a large number of slaves

I've never used overlapped PDOs myself, but something doesn't sound right in 
your description below.

As I understand it, overlapping only supports overlapping the input and output 
FMMUs on

Re: [Etherlab-users] Distributed Clocks and Oversampling - slave configuration of the ELM3604-002

2021-05-26 Thread Gavin Lambert
I'm not sure what the Matlab equivalent of this is, but assuming that the slave 
follows the normal DC subordinated cycles mode (which I did glance through the 
datasheet but couldn't verify) then the way that the DC sync0 and sync1 cycle 
times need to be set is a little weird at first glance.

Typically the slave will sample on SYNC0 and report on SYNC1, so you want the 
SYNC1 pulse to match your domain packet cycle time and SYNC0 your desired 
sampling rate, but these are specified a bit oddly.  For example, with a domain 
cycle time of 1ms (1kHz) and a desired sampling rate of 4kHz, you need to set 
the Sync0 cycle time to 25 and the Sync1 cycle time to 75 (not to 
100 as you might have expected).

Some other advice is that for domain cycle times faster than 1ms you will 
definitely need to use the dedicated drivers (not the generic one), and for 
very fast rates you will likely need to use an RTOS (such as Xenomai).  This 
isn't needed if you have a fast sampling rate with a relatively slow domain 
cycle time, but obviously that will increase the data transfer requirements 
each domain cycle.

The unofficial patchset 
(https://sourceforge.net/u/uecasm/etherlab-patches/ci/default/tree/) does 
contain some improvements for DC, especially for subordinated cycles, so if 
you're not already using that then it may be worth a try.



Gavin Lambert
Senior Software Developer TOMRA Fresh Food

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
From: Merkel, Amos
Sent: Thursday, 27 May 2021 12:59 am
To: etherlab-users@etherlab.org
Subject: [Etherlab-users] Distributed Clocks and Oversampling - slave 
configuration of the ELM3604-002


Hi everyone!

I am trying to get an ELM3604-002 by Beckhoff to work in the etherlab 
environment using Simulink and the generic slave block of the etherlab_lib.  
So far, I managed to get the slave operating and working for lower sample 
rates, but keep getting error states and "DC Invalid Sync Cycle Time" messages 
in dmesg for anything higher than 4kHz. Unfortunately, I do not really 
understand how the DC configuration works in detail, and the ELM3604-002 
apparently does not support freerun mode, so I am stuck right now. 

Does anyone have an idea how to fix this? I would be most grateful for any 
hint! 
You will find my Matlab function with the slave struct below.

Best regards,

Amos

%% ELM3604-0002 Generic Slave Struct 
% by Amos Merkel

%% notes 
%    firmware does not support freerun mode
%    Output Port 1..4: Value-Vector Channel 1..4, 
%   -length depends on oversampling factor 
%   -vector entry n correspondents to nth value of
%   timestep, taken at time timestep +
%   n*Timesteplength/oversampling factor
%    Output Port 5..8: Status Output of Channel 1..4, if activated
%    -entries are: 1: error 2: Underrange 3: Overrange 
4: Diag
%    5: TxPDOState
%    configure osm (in 1..15) and t_sample to your need
%    check SDO Configuration below and configure to your needs (see Beckhoff 
documentation for
%    additional options)

%% struct
function rv=elm3604

osm=3;  % osm:  oversampling mode in range 1..15 for 
the resulting oversampling rates: 1 2 4 5 8 10 16 20 25 32 40 50 64 80 100
tsample=1/5000;%tsample=1e-3;   % tsample:  sample time in s
StatusOutput=true;  % StatusOutput: Add Status Outputs for each Channel

osm=max(min(osm,15),1); % limit os to 1..100
osf=[1 2 4 5 8 10 16 20 25 32 40 50 64 80 100]; %oversampling rates 
corresponding to oversampling mode
os=osf(osm);    % actual oversampling factor

CycleTimeSync1=double(uint32(tsample(1)*(1-1/os)*1e9));

%% -Slave Configuration--

rv.SlaveConfig.vendor=2;
rv.SlaveConfig.product=hex2dec('50219349');
rv.SlaveConfig.description='ELM3604-0002';
if os>1
    rv.SlaveConfig.dc=[hex2dec('0730') 0 -os -25 1 1 CycleTimeSync1 0 0 0 
]; % DC-Setup [Assign_Activate Cycle_Time_Sync0 Cycle_Time_Sync0_Factor 
Shift_Time_Sync0 Shift_Time_Sync0_Factor Shift_Time_Sync0_Input 
Cycle_Time_Sync1 Cycle_Time_Sync1_Factor Shift_Time_Sync1 
Shift_Time_Sync1_Factor]

end
%% --SyncManager (Sm) Configuration--

rv.SlaveConfig.sm={ ...
    {0, 0, {}}, ...
    {1, 1, {}},...
    {2, 0, {}},...
    {3, 1, {
    {hex2dec('1a00'), [ % PAI TxPDO-Map Status Ch.1
    hex2dec('6000'), 01, 08;    %   No of Samples   8bit
    hex2dec('6000'), 09, 1; %   Error   

Re: [Etherlab-users] Running a large number of slaves

2021-04-25 Thread Gavin Lambert
I assume you meant domain.c.

You are correct that such a configuration *should* work, provided that the 
slave actually supports it as well -- but it looks like you were just 
duplicating slave indexes rather than actually specifying unique objects, which 
is unlikely to work well.  The SM/FMMU config on the master side has to exactly 
match the config on the slave side in order for communication to be successful.

You mention overlapping PDOs -- have you tried disabling that option?  
Certainly if your goal is to create a larger packet size then you should not 
have that enabled; and it's an experimental feature so it's more likely to have 
bugs in it, especially for unusual configurations such as what you were 
attempting.



Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
From: Geller, Nir  
Sent: Monday, 26 April 2021 1:00 am
To: Gavin Lambert ; Richard Hacker ; 
etherlab-users@etherlab.org
Subject: RE: [Etherlab-users] Running a large number of slaves


Hi Gavin,

Thanks for your reply.

The final system I am developing will run about 80 slaves, each with a PDO 
domain size of ~130 bytes.
I do not have such a number of slaves at my disposal, so I'm trying to somehow 
simulate a PDO domain that exceeds 1486 bytes in order to test the ecat master.

I created 2 slaves, each with a PDO domain of about 920 bytes.

I also asked myself how the data will be split between the ethernet frames.
(Both slaves support overlapping PDOs).

I expected that 2 LRW datagrams will be created, each carrying the PDO data 
intended for a specific slave and sent in a separate ethernet frame. Why should 
this be a problem?

The situation is that only 1 LRW datagram is created, in the size of 1830 bytes.
This, of course, is not going to work.

In datagram.c, ec_domain_finish(), 

The if statement
if (fmmu->logical_domain_offset + fmmu->data_size - datagram_offset > 
EC_MAX_DATA_SIZE) {
is never executed, but

/* Allocate last datagram pair, if data are left (this is also the case if
  * the process data fit into a single datagram) */
if (domain->data_size > datagram_offset) {

Is executed only once.

Could you direct me more precisely where in the code a fix should be 
implemented?

Thanks,

Nir.

From: Gavin Lambert <mailto:gavin.lamb...@tomra.com> 
Sent: Friday, April 23, 2021 1:13 AM
To: Geller, Nir <mailto:nir.gel...@servotronix.com>; Richard Hacker 
<mailto:h...@igh.de>; mailto:etherlab-users@etherlab.org
Subject: RE: [Etherlab-users] Running a large number of slaves

The EtherCAT bus in general is not designed for that kind of thing.  When you 
have a large PDO domain, it is supposed to be because you have a large number 
of smaller slaves, not a small number of large slaves.

I'm not sure exactly where the cutoff should be, but most likely any single 
slave wanting to exchange more than 300 bytes or so should probably be using 
SDO rather than PDO.  (SDO mailboxes can be configured up to 1484 bytes, 
although that depends on slave implementation too and most only support a much 
smaller size.)  Do you really need that amount of data each and every cycle?

The packet-splitting does work - I have systems where each cycle sends three 
PDO packets - but the largest amount of PDO data in any one slave in my network 
is about 200 bytes.  Most slaves are a lot less.

Gavin Lambert
Senior Software Developer



COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | 
https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.tomra.com%2F=04%7C01%7Cgavin.lambert%40tomra.com%7Cf585962eae3b49c600a908d907ea0f1d%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637549524141805369%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000=0B1lreUtpyexzwDAC2%2BQOW3pJCU8BHURzAHJ%2F0niM3E%3D=0
 
The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication. 
From: Geller, Nir <mailto:nir.gel...@servotronix.com> 
Sent: Friday, 23 April 2021 1:39 am
To: Geller, Nir <mailto:nir.gel...@servotronix.com>; Gavin Lambert 
<mailto:gavin.lamb...@tomra.com>; Richard Hacker <mailto:h...@igh.de>; 
mailto:etherlab-users@etherlab.org
Subject: RE: [Etherlab-users] Running a large number of slaves


This email originated from outside of the organiz

Re: [Etherlab-users] Running a large number of slaves

2021-05-04 Thread Gavin Lambert
I've never used overlapped PDOs myself, but something doesn't sound right in 
your description below.

As I understand it, overlapping only supports overlapping the input and output 
FMMUs on the same slave; you can never overlap data from different slaves 
(otherwise they would corrupt the data).  As such, while the 
logical_domain_offset of the input and output of one slave might be the same, 
afterwards it should be incremented by the max of both and the next slave 
should always have a strictly higher value.  (That appears to agree with the 
log message output.)



Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
From: Geller, Nir  
Sent: Wednesday, 5 May 2021 2:27 am
To: Geller, Nir ; Gavin Lambert 
; Richard Hacker ; 
etherlab-users@etherlab.org
Subject: RE: [Etherlab-users] Running a large number of slaves

Hi,

I've made some progress and now I can get all the slaves to OP and exchange 
data with the master.
Fragmentation is working properly and can be seen clearly in a wireshark 
capture.

I have 7 slaves that support overlapping PDOs with PDO domains of 68 and 241 
bytes, and an 8th slave that doesn't support overlapping PDOs with PDO domains 
of 35 and 33 bytes.
In dmesg, coming out of domain.c, ec_domain_add_fmmu_config():

[   78.299113] Domain 0: fmmu f08d0924 Added 68 bytes at 0.
[   78.306251] Domain 0: fmmu f08d0944 Added 241 bytes at 0.
[   78.317895] Domain 0: fmmu f08d1124 Added 68 bytes at 241.
[   78.325476] Domain 0: fmmu f08d1144 Added 241 bytes at 241.
[   78.337518] Domain 0: fmmu f08d1924 Added 68 bytes at 482.
[   78.345279] Domain 0: fmmu f08d1944 Added 241 bytes at 482.
[   78.357735] Domain 0: fmmu f08d2124 Added 68 bytes at 723.
[   78.365580] Domain 0: fmmu f08d2144 Added 241 bytes at 723.
[   78.378337] Domain 0: fmmu f08d2924 Added 68 bytes at 964.
[   78.386187] Domain 0: fmmu f08d2944 Added 241 bytes at 964.
[   78.403592] Domain 0: fmmu f08d3124 Added 68 bytes at 1205.
[   78.411901] Domain 0: fmmu f08d3144 Added 241 bytes at 1205.
[   78.425531] Domain 0: fmmu f08d3924 Added 68 bytes at 1446.
[   78.433643] Domain 0: fmmu f08d3944 Added 241 bytes at 1446.
[   78.447590] Domain 0: fmmu f08d0124 Added 35 bytes at 1687.
[   78.454539] Domain 0: fmmu f08d0144 Added 33 bytes at 1722.

So in the case of overlapping PDOs, both Rx and Tx FMMUs have 
logical_domain_offset of equal values. If a slave does not support overlapping 
PDOs, the FMMUs logical_domain_offset have different values.

Then in domain.c, ec_domain_finish(), in the loop list_for_each_entry(fmmu, 
>fmmu_configs, list)
The condition
if (fmmu->logical_domain_offset >= candidate_start)
is met when a slave's first FMMU is evaluated, then candidate_start is added 
with fmmu->data_size.
The condition is never met with the second slave's FMMU, that bares the same 
value logical_domain_offset like the prior FMMU.

Completely removing the condition

if (fmmu->logical_domain_offset >= candidate_start)

fixed the problem for me, though I'm not sure whether this code change is the 
best way to solve the problem.
Please share if you have any thoughts.

Thanks a lot for your support,

Nir.

From: Etherlab-users <mailto:etherlab-users-boun...@etherlab.org> On Behalf Of 
Geller, Nir
Sent: Sunday, April 25, 2021 4:00 PM
To: Gavin Lambert <mailto:gavin.lamb...@tomra.com>; Richard Hacker 
<mailto:h...@igh.de>; mailto:etherlab-users@etherlab.org
Subject: Re: [Etherlab-users] Running a large number of slaves

Hi Gavin,

Thanks for your reply.

The final system I am developing will run about 80 slaves, each with a PDO 
domain size of ~130 bytes.
I do not have such a number of slaves at my disposal, so I'm trying to somehow 
simulate a PDO domain that exceeds 1486 bytes in order to test the ecat master.

I created 2 slaves, each with a PDO domain of about 920 bytes.

I also asked myself how the data will be split between the ethernet frames.
(Both slaves support overlapping PDOs).

I expected that 2 LRW datagrams will be created, each carrying the PDO data 
intended for a specific slave and sent in a separate ethernet frame. Why should 
this be a problem?

The situation is that only 1 LRW datagram is created, in the size of 1830 bytes.
This, of course, is not going to work.

In datagram.c, ec_domain_finish(), 

The if statement
if (fmmu->logical_domain_offset + fmmu->data_size - datagram_offset > 
EC_MAX_DATA_SIZE) {
is never executed, but

/* Allocate last datagram pair, if data are left (this is also the case if
  * the process data fit into a single datagra

Re: [Etherlab-users] Enable normal Ethernet devices with native e1000e driver

2021-05-03 Thread Gavin Lambert
Activating or deactivating the ec_e1000e (or other device-specific) network 
modules will disconnect and remove all devices with the same chipset/family, 
and then add them all back again (both regular Ethernet and EtherCAT).

The end result is that all ports should be available for use again, but it is 
possible that they may come back with a different name (especially if you're 
using the old ethN names rather than the new hardware-based names) and/or not 
be configured the same way as previously (e.g. they will lose the IP assignment 
and might come back with no address or a different address, although that is 
unlikely if you're using standard DHCP).  It will also disrupt any existing 
connections using those ports, although they should normally be able to 
re-establish afterwards provided that the IP is recovered.

It can be useful to use hardware that has different chipsets for your "main" 
Ethernet port and your EtherCAT ports, to avoid temporary disruption as the 
services are restarted, especially if you're connecting to the machine over a 
remote network connection.  But this is not absolutely required.

It's recommended to use a modern kernel that does not use the legacy ethN names.



Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
From: Douglas Lopez
Sent: Thursday, 22 April 2021 2:51 pm
To: etherlab-users@etherlab.org
Subject: [Etherlab-users] Enable normal Ethernet devices with native e1000e 
driver


Hello IgH Etherlab,

First off, I would like to thank you for your hard work with etherlab.  I found 
the manual very useful and was able to implement IgH ethercat master to run my 
slaves without too many issues, and I am new to plc development in general.  I 
apologize in advance if this is the incorrect place to contact, if so, could 
you please redirect me?

My issue is that while the ec master service is running, the ec_e1000e driver 
disables all other ethernet devices on my machine that are not configured for 
an ethercat master in the etc/sysconfig/ethercat file.  While the etherCAT 
master service is running, ifconfig lists only the network device configured 
for the master.

After rereading the v1.5.2 manual Section 4: Dedicated Hardware, I am unsure if 
the native e1000e driver will be able to use one device (ex:  eth2) for 
etherCAT master while using  others (ex: eth0, eth1) as "normal" ethernet 
devices.  However, Section 4.2:  Ethernet and EtherCAT Devices indicates that 
the native driver is "one networking driver for EtherCAT and non-EtherCAT 
devices" which seems contrary to the point made in Dedicated Hardware.  Section 
4.2 does not indicate that the non-EtherCAT devices will be available while the 
service is running, so maybe the fault is in my understanding.

Is it possible to start the master service for one ethernet device (eth2) and 
then use the other ethernet devices to ssh, with the native e1000e driver?  Or 
does activating the master service remove all devices from the network stack so 
that only the master device is operational?

If this is not possible due to "dedicated hardware" for the native driver, 
after reading section 4.3: Device Activation, the generic driver should be able 
to handle this feature?  If I recall correctly, the generic driver will not 
work for RT applications, so I will have to lose Xenomai.

System Specs:
Linux version:  3.2.21
Xenomai:  2.6.21
Distribution:  AntiX 16 (Debian 8.5 Jessie)

Master version: 1.5.2
Ethernet Driver:  e1000e

Thank you very much for your time,
Doug


-- 
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [Etherlab-users] Running a large number of slaves

2021-05-03 Thread Gavin Lambert
The EtherCAT bus in general is not designed for that kind of thing.  When you 
have a large PDO domain, it is supposed to be because you have a large number 
of smaller slaves, not a small number of large slaves.

I'm not sure exactly where the cutoff should be, but most likely any single 
slave wanting to exchange more than 300 bytes or so should probably be using 
SDO rather than PDO.  (SDO mailboxes can be configured up to 1484 bytes, 
although that depends on slave implementation too and most only support a much 
smaller size.)  Do you really need that amount of data each and every cycle?

The packet-splitting does work - I have systems where each cycle sends three 
PDO packets - but the largest amount of PDO data in any one slave in my network 
is about 200 bytes.  Most slaves are a lot less.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com>
 [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] 
<https://www.facebook.com/Compacsort>  
[cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] 
<https://www.linkedin.com/company/compac-sorting-equipment/>  
[cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] 
<https://vimeo.com/compacsort>  
[cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] 
<https://twitter.com/compacsort>  
[cid:insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png] 
<https://www.instagram.com/compacsort/>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.

From: Geller, Nir 
Sent: Friday, 23 April 2021 1:39 am
To: Geller, Nir ; Gavin Lambert 
; Richard Hacker ; 
etherlab-users@etherlab.org
Subject: RE: [Etherlab-users] Running a large number of slaves


This email originated from outside of the organization. Do not click links or 
open attachments unless you recognize the sender and know the content is safe.

Hi,

In my setup I have 2 ecat slaves with a large PDO data worth of 917 bytes.
A LRW datagram is allocated with a payload size of 1830 bytes:

[   56.206673] EtherCAT DEBUG 0: Adding datagram pair with expected WC 6.
[   56.206690] EtherCAT 0: Domain0: Logical address 0x, 1830 byte, 
expected working counter 6.
[   56.215738] EtherCAT 0:   Datagram domain0-0-main: Logical offset 
0x, 1830 byte, type LRW at f1c6600c.


My suspicion is that in master.c, ec_master_send_datagrams(), the following 
piece of code

 // does the current datagram fit in the frame?
 datagram_size = EC_DATAGRAM_HEADER_SIZE + datagram->data_size
 + EC_DATAGRAM_FOOTER_SIZE;
 if (cur_data - frame_data + datagram_size > ETH_DATA_LEN) {
 more_datagrams_waiting = 1;
 break;
 }

Gets stuck in an infinite loop because it can't handle a datagram larger than 
1500 bytes.

Is my assumption correct?

Do you happen to have a code fix for this situation?

Thanks,

Nir.


From: Etherlab-users 
mailto:etherlab-users-boun...@etherlab.org>>
 On Behalf Of Geller, Nir
Sent: Wednesday, April 21, 2021 11:10 AM
To: Gavin Lambert mailto:gavin.lamb...@tomra.com>>; 
Richard Hacker mailto:h...@igh.de>>; 
etherlab-users@etherlab.org<mailto:etherlab-users@etherlab.org>
Subject: Re: [Etherlab-users] Running a large number of slaves


Hello again,

I tried running the ethercat master with a large PDO domain, but with no 
success.

Following
https://sourceforge.net/u/uecasm/etherlab-patches/ci/default/tree/#readme<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fu%2Fuecasm%2Fetherlab-patches%2Fci%2Fdefault%2Ftree%2F%23readme=04%7C01%7Cgavin.lambert%40tomra.com%7C69c3c87304b241e33b3108d905940454%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637546955571855490%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000=zPIH9KoPnpog%2BVGlqXG2mJ58VWV72Z%2FjzcmO3Uv2dvY%3D=0>
I built the ethercat master with Gavin's patch set.

I'm running on a x86 Intel Atom dual core with linux kernel 3.18.48. Ethernet 
adapter is igb.

To achieve a very large PDO volume I created 2 ecat slaves, each with PDO data 
worth of 917 bytes.

When connecting only 1 slave, and running examples/user/ec_user_example I can 
raise the slave to OP and exchange data between the master and slave over PDO.

When connecting 2 slaves the start up process of the ethercat master gets stuck 
after

EtherCAT DEBUG 0-main-0: Checking system time offset.

And according to a wireshark capture the communica

Re: [Etherlab-users] Running a large number of slaves

2021-03-30 Thread Gavin Lambert
Yes, it splits to multiple packets automatically.  Just be careful to not use 
more data than your cycle rate will allow.

Note that initialization and configuration of a large number of slaves is very 
slow by default, as it occurs in series.
The unofficial patchset changes this to occur in parallel (for groups at a time 
rather than the whole network, to avoid creating too many packets at once).


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Geller, Nir
Sent: Tuesday, 30 March 2021 1:23 am
To: Richard Hacker ; etherlab-users@etherlab.org
Subject: Re: [Etherlab-users] Running a large number of slaves

Hi,

Thanks for your reply.

You mean that in the case of a large amount of PDO data ( > 1500), a single 
invoke of ecrt_master_send(master) will result several frames sent out 1 after 
another?

Nir.

-Original Message-
From: Etherlab-users  On Behalf Of Richard 
Hacker
Sent: Monday, March 29, 2021 3:09 PM
To: etherlab-users@etherlab.org
Subject: Re: [Etherlab-users] Running a large number of slaves

EtherCAT and the master are not limited to the ethernet packet size.
EtherCAT frames are automatically divided into smaller ethernet packets as 
required. As long as you're not exceeding physical limits, (like sending ~1,5kb 
at a rate of 1kHz), you should be fine.

Physically EtherCAT can address ~64k slaves on a network.

On 2021-03-29 13:22, Geller, Nir wrote:
> Hi There,
>
> I'm trying to setup one ethercat master with a very large number of 
> ethercat slaves.
>
> The first obstacle I'm thinking about is a very large amount of data 
> sent over PDO each cycle, that will definitely exceed 1500 bytes.
>
> In order to address this issue I want to understand if it is possible 
> to send more than one frame each cycle?
>
> Another method could be using jumbo frames. Does the ethercat master 
> support that?
>
> Does anybody have practical experience with such a setup?
>
> Thanks,
>
> Nir.
>
>

Mit freundlichem Gruß

Richard Hacker

--


Richard Hacker M.Sc.
richard.hac...@igh.de
Tel.: +49 201 / 36014-16

Ingenieurgemeinschaft IgH
Gesellschaft für Ingenieurleistungen mbH Nordsternstraße 66
D-45329 Essen

Amtsgericht Essen HRB 11500
USt-Id.-Nr.: DE 174 626 722
Geschäftsführung:
- Dr.-Ing. Siegfried Rotthäuser
- Dr. Sven Beermann, Prokurist
Tel.: +49 201 / 360-14-0
https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.igh.de%2Fdata=04%7C01%7Cgavin.lambert%40tomra.com%7Cc94214e8fb1b48f0029e08d8f2ad5668%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637526173602822005%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=YcXsqSHNccIDDwhMlXvDi8fk5qDl1QtsqUBW%2FPJWZ0Y%3Dreserved=0


--
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.etherlab.org%2Fmailman%2Flistinfo%2Fetherlab-usersdata=04%7C01%7Cgavin.lambert%40tomra.com%7Cc94214e8fb1b48f0029e08d8f2ad5668%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637526173602822005%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=R5I8zS%2BgfoqIZDkHkRulUESJ7MZZWEG5Dua7uAqBxQs%3Dreserved=0
--
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.etherlab.org%2Fmailman%2Flistinfo%2Fetherlab-usersdata=04%7C01%7Cgavin.lambert%40tomra.com%7Cc94214e8fb1b48f0029e08d8f2ad5668%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637526173602822005%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=R5I8zS%2BgfoqIZDkHkRulUESJ7MZZWEG5Dua7uAqBxQs%3Dreserved=0
-- 
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [Etherlab-users] Measuring the roundtrip time of the EtherCAT packet

2021-03-13 Thread Gavin Lambert
1. Yes, it's a very bad idea to have a busy loop in an RT process.

2. If you're using the EtherCAT-specific drivers then it puts the NIC into a 
polling-only mode, such that until you make the call to read it, it has no idea 
that a packet arrived either.  This is usually a good thing as it reduces 
context switching from interrupts, although it's less important with modern RT 
kernels unless you're using a very high cycle time.  The generic driver remains 
interrupt-driven but the library itself still expects you to poll for incoming 
packets.  If you want a true measurement of the packet latency, the best method 
is to use Wireshark on an external "monitoring" system.

3. By design, you are supposed to provide configuration of the slaves up-front 
in the code without use of ecrt_master_get_pdo_entry etc, only using 
ecrt_slave_config_* calls.  This allows the application and the network to 
start up while the slaves are powered off or otherwise not yet connected.  
Typically you should perform any needed pre-configuration interactively with 
the "ethercat" command line tool, and then finish up with "ethercat cstruct" to 
capture the live configuration into data tables that can be used directly in 
your code.  (Of course, more dynamic methods are possible as well for more 
complex situations, but you should be able to do whatever it is without relying 
on the slave hardware being connected at the time of application startup.)

4. This task is already done by ecrt_domain_reg_pdo_entry_list based on those 
tables from above.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Fontana Nicola
Sent: Friday, 12 March 2021 11:31 pm
To: etherlab-users@etherlab.org
Subject: [Etherlab-users] Measuring the roundtrip time of the EtherCAT packet

This email originated from outside of the organization. Do not click links or 
open attachments unless you recognize the sender and know the content is safe.

Hi all,

I'm new to to the EtherLab project, and to the EtherCAT world in general, so my 
apologies in advance if the questions are dumb.

I'm interested in master development, so I checked the two more popular 
opensource choices: SOEM and this one (I called it IgH ethercat).
To have a real taste, I implemented two similar test programs on top of both. 
The full source code is available on Github:


https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fntd%2Fethercatestdata=04%7C01%7Cgavin.lambert%40tomra.com%7C7ab74df01209434ba61d08d8e541fe44%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637511418914783843%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=H6%2FCl5YoNMGoOV6IjQF2yxfa8zUbunQkk2WnyjIJJ5k%3Dreserved=0

To measure the roundtrip time, i.e. the time needed to send a packet and 
receive its response, I have something similar to this pseudocode:

start = g_get_monotonic_time();

ecrt_domain_queue(domain);
ecrt_master_send(master);
do {
g_usleep(5);
ecrt_master_receive(master);
ecrt_domain_process(domain);
ecrt_domain_state(domain, );
} while (state.wc_state != EC_WC_COMPLETE);

roundtrip = g_get_monotonic_time() - start;

Here are my questions.

1. I had to add a 5 us delay to avoid hogging the CPU. Without it,
   every 5/1 iteration, I was getting a 40 ms (milliseconds!)
   roundtrip. This maybe has nothing to do with EtherLab but... has
   anyone experienced this kind of behavior?

2. Is there a way to do the same without this awful polling loop?
   Callbacks? Anything else?

3. I have a function (fieldbus_automapping) that clears any previous
   PDO mapping and remap everything by using what returned by
   ecrt_master_get_pdo_entry(). This seems quite an obvious candidate
   for `libethercat` but, being a novice in EtherCAT, I'm fearing to say
   rubbish. Does that function existence make any sense? Is it worth to
   be included in `libethercat`?

4. Similar to the previous question: I have a function
   (fieldbus_autoconfigure, more a proof-of-concept than a real
   function) that sequentially registers the outputs and the inputs
   into the process data. Is it too much "high-level" to be upstreamed?

Ciao.
--
Nicola


--
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.etherlab.org%2Fmailman%2Flistinfo%2Fetherlab-usersdata=04%7C01%7Cgavin.lambert%40tomra.com%7C7ab74df01209434ba61d08d8e541fe44%7C

Re: [Etherlab-users] Estun EE-R0: Invalid input configuration

2021-03-04 Thread Gavin Lambert
If it can't cope with both complete and incomplete transfers in PDO 
configuration, then it is not compliant with the EtherCAT specification, and 
you should throw it away and find a better slave instead.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Eibach, Dirk
Sent: Friday, 5 March 2021 2:59 am
To: Eibach, Dirk ; Richard Hacker ; 
etherlab-users@etherlab.org
Subject: Re: [Etherlab-users] Estun EE-R0: Invalid input configuration

An interesting difference I found is that the Acontis master does all 
SDO-writing on block(like ecrt_slave_config_complete_sdo()), whereas Etherlab 
does it in single transfers. I already realized that the Estun slave has 
problems with this when mapping PDO entries. So I had already patched this in 
fsm_pdo_entry.c. But maybe the same applies also to the other SDO transfers? I 
will check if I can patch this too.

-- 
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [Etherlab-users] C- Function to change slave-state

2021-04-21 Thread Gavin Lambert
Anything you can do in the ethercat command line tool, you can do in code by 
making the equivalent ioctl calls that it does, although it's a less-documented 
and more fragile interface.

Having said that, there is ordinarily no reason to manually change slave 
operation states -- the master will automatically take care of bringing all 
slaves from INIT to PREOP as a matter of course, and then once you activate 
your master application, all slaves configured in its domains will be brought 
to OP (and similarly back to PREOP after the master is deactivated).  If a 
slave reboots while the master is active then it will automatically be brought 
back to OP if your app is using it.  If a slave errors and returns to SAFEOP, 
the error will be acknowledged, and then it will similarly be reconfigured and 
returned to OP.


Gavin Lambert
Senior Software Developer

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Yaw Mensah Bonsu Nana
Sent: Wednesday, 21 April 2021 5:54 pm
To: etherlab-users@etherlab.org
Subject: Re: [Etherlab-users] C- Function to change slave-state

Hallo Richard,

thank you for the fast reply. But I am looking for a way to the State change in 
code.

Best Regards
Yaw
-- 
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [Etherlab-users] Configuring EL7047 stepper driver

2021-08-02 Thread Gavin Lambert
Yes, you're calling both now.  Previously you had the "else-if" structured such 
that it wouldn't, though.

ecrt_domain_reg_pdo_entry_list doesn't require a *static* array (although 
that's used in the examples); you can build a temporary array if you wish, 
although then you're back to needing a loop.

The important point though is that it captures the pointer to the actual value, 
which you are currently discarding in your call and simply hoping that the data 
appears at the offsets you expect in your process image structure.  (Which, to 
be fair, it always should -- until you move devices around in your network or 
upgrade a device to a later revision with a different data model.  What you 
have works for now, but it's brittle.  But if you're happy with that caveat, 
then fine.)


Gavin Lambert
Senior Software Developer TOMRA Fresh Food

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Fontana Nicola  
Sent: Tuesday, 3 August 2021 12:36 am
To: Gavin Lambert ; etherlab-users@etherlab.org
Subject: Re: [Etherlab-users] Configuring EL7047 stepper driver

Il giorno lun, 02/08/2021 alle 13.50 +0200, Fontana Nicola ha scritto:
>
> Il giorno dom, 01/08/2021 alle 22.55 +0000, Gavin Lambert ha scritto:
> > Why are you calling ecrt_slave_config_pdos *OR* 
> > ecrt_slave_config_reg_pdo_entry?  You need to do both things.
>
> Hi Gavin,
>
> I am calling both.

I've just cleaned up the code and added some comment, hopefully making the 
intentions clearer.

> > (Although you can replace the latter with 
> > ecrt_domain_reg_pdo_entry_list to avoid a loop in your own code.)
>
> Good catch, thank you: I'll check if I can drop that 
> `autoregister_pdos` function and will update the snippet accordingly.

AFAIU, `ecrt_domain_reg_pdo_entry_list` requires another explicit static array. 
This is a big no from my point of view, where I am struggling to keep 
complexity as low as possible by using conventions instead of explicit lists.

Ciao.
--
Nicola


-- 
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [Etherlab-users] Configuring EL7047 stepper driver

2021-08-03 Thread Gavin Lambert
On 3 August 2021 6:07 pm, quoth Fontana Nicola:
> This, although a bit mind twisting, is functionally equivalent to the current
> one, i.e. both `ecrt_slave_config_pdos` and `autoregister_pdos` are called
> for all modules but the EK1100.

You're correct of course; I guess my brain was skidding over the return value 
comparison.

> Yes, I'm not interested in storing byte or bit offsets. With "hoping"
> you mean that libethercat can (at least theoretically) leave byte holes inside
> the process image? That would certainly create issues here, as I am implying
> everything is packed.
> 
> > (Which, to be fair, it always should -- until you move devices around
> > in your network or upgrade a device to a later revision with a different 
> > data
> > model.
> > What you have works for now, but it's brittle.  But if you're happy
> > with that caveat, then fine.)
> 
> Can you expand a bit here? If the devices can be moved around I would use
> aliases and if a new device cannot behave like the old one, that would
> require some code rewrite. But I think those concerns are not related to the
> fact I am "autoregistering" the PDO entries.

API-wise, the library is only guaranteeing that the PDOs that you register 
appear *somewhere* in the domain memory (specifically: at the offset/pointer 
returned).  (Technically, you only actually need to register one PDO from each 
SM to guarantee that the entire SM will appear -- registering every PDO is only 
confirming that the values also appeared in your ecrt_slave_config_pdos call; 
since you're iterating the same table in both cases it's a little pointless, 
especially if you're not saving the offsets.)

EtherCAT itself requires that all PDOs within a single SM will always appear 
"packed" in consecutive bytes, matching the declared SM layout.  It has no 
particular constraints between different SMs (although some slaves may 
misbehave if their own SMs are split between different packets, although that 
is supposed to be legal in general.)  But a particular master is entirely free 
to order the SMs from different slaves however it likes, or to (for example) 
insert padding between SMs to ensure that each one aligns on a convenient 
word/dword boundary, or to group RxPDOs and TxPDOs differently (or overlap 
them), or to request additional SMs you didn't ask for, although usually the 
preference is to minimize packet size.

From practical considerations, because ecrt_slave_config_reg_pdo_entry returns 
an offset (that cannot later be changed without restarting the configuration 
from scratch) and Etherlab doesn't do any alignment or extra background data 
(and doesn't overlap unless specifically requested), *with current 
implementation* you'll always end up with the domain memory being ordered with 
each slave's SM according to when it was first referred to by 
ecrt_slave_config_reg_pdo_entry and with no padding between.  Doing something 
different is only a theoretical possibility.

But it does mean that your process_image_t is tied to having exactly those 
slaves in exactly that order (registered order, not necessarily network order), 
making it brittle to changes in your design or wanting to re-use implementation 
for another project.  My point was that for more flexibility, you could make a 
per-slave "process_image_t" rather than a global one -- combined with actually 
using the offset/pointer for the first PDO in each SM, you can make each slave 
a reusable component that you could repeat as many times as needed for each 
project, rather than a one-off.  And this would also make you immune to SMs 
being ordered differently than you originally expected, in some theoretical 
future change.


Gavin Lambert
Senior Software Developer TOMRA Fresh Food

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-- 
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [Etherlab-users] Configuring EL7047 stepper driver

2021-08-01 Thread Gavin Lambert
Why are you calling ecrt_slave_config_pdos *OR* 
ecrt_slave_config_reg_pdo_entry?  You need to do both things.  (Although you 
can replace the latter with ecrt_domain_reg_pdo_entry_list to avoid a loop in 
your own code.)


Gavin Lambert
Senior Software Developer TOMRA Fresh Food

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Fontana Nicola
Sent: Sunday, 1 August 2021 8:38 am
To: Graeme Foot ; etherlab-users@etherlab.org
Subject: Re: [Etherlab-users] Configuring EL7047 stepper driver

Il giorno lun, 26/07/2021 alle 07.00 +0200, Fontana Nicola ha scritto:
> ...
> I will do my homeworks and report back for future reference.
> ...

I can confirm that, by moving the PDO handling into the application, things 
started working as expected. Here is the updated snippet:


https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.com%2F-%2Fsnippets%2F2155802data=04%7C01%7Cgavin.lambert%40tomra.com%7C020593bd03294f1d6ccf08d954631658%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637633606834855034%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=nLGnNTU%2F52J5y71UJ%2FPsKMsrAv8ASYVFE5HQos8cBxE%3Dreserved=0

The shell script is now used only for bootstrapping the EL7047. All 0x8nnn:nn 
entries in the object dictionary seem to be stored in some non-volatile memory 
(no idea this is customary or mandated by some standard), so that script should 
be called only on new devices.

The manual handling of PDOs on the C side is really tedious and error-prone, so 
I can understand Gavin's suggestion of trying to configure as much as possible 
before `ethercat cstruct`, but I'm confident some kind of abstraction is 
possible (see e.g. the `SlaveLayout` struct in `el7047.c` for details).

Thank you again for your help.

Ciao.
--
Nicola


--
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.etherlab.org%2Fmailman%2Flistinfo%2Fetherlab-usersdata=04%7C01%7Cgavin.lambert%40tomra.com%7C020593bd03294f1d6ccf08d954631658%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637633606834855034%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=09hYJykWoNSbxHGWss%2Brmww8iycr42NTxi1XytKecVw%3Dreserved=0
-- 
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [Etherlab-users] 2 bits reading

2021-10-11 Thread Gavin Lambert
Yes (assuming you meant incrementing the bit offset, not the byte address).  Or 
you can use EC_READ_U8 and then do the bit masking yourself.

For bit-aligned values, don't forget to provide a non-null pointer to receive 
the bit offset when registering the PDO.

Or since this is only a sync counter, if you're certain that you never miss any 
cycles you can fairly safely just ignore the second bit and simply use the LSB 
toggle as an indication that an update has occurred.

Gavin Lambert

Senior Software Developer TOMRA Fresh Food



[cid:TOMRAFresh_final_size_times_two_2_99d242b2-ba06-4c25-ab26-020cca7ee6dd.png]
 [cid:TF-FB-icon_b77c57e4-4990-4f9d-b3a2-8e6ab45df7f2.jpg] 
<https://www.facebook.com/TOMRAFreshFood>  
[cid:TF-LinkedIn-icon_d54c4829-dcb9-450c-9187-34b26e85ebaa.jpg] 
<https://www.linkedin.com/company/tomra-fresh-food/>  
[cid:TOMRA-Vimeo_4673038e-313a-491f-b3a4-0b39ace6df88.jpg] 
<https://vimeo.com/tomrafreshfood>  
[cid:TOMRAinstagram_45b30c55-490a-4f32-8fd3-998c152e3494.jpg] 
<https://www.instagram.com/tomrafood/>
 Compac Technologies Ltd | 4 Henderson Place | PO Box 13 516 | Onehunga 1061 | 
New Zealand

 Phone: +64 96 34 00 88 | https://www.compacsort.com
The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
From: BUSSIERES Vincent
Sent: Tuesday, 12 October 2021 10:20
To: etherlab-users@etherlab.org
Subject: [Etherlab-users] 2 bits reading

Dear etherlab users, I bought a Beckhoff incremental encoder interface EL5102, 
as you can see below, some datas are written on two bits.
How can I read these 2 bits ?
May I read them by calling twice EC_READ_BIT with address increment ?

Index   Name Meaning

Data type   Flags  Default
60n2:0F   Input cycle counter   2-bit counter for synchronization 
(incremented only if a new value is present)BIT2 RO   
0x00 (0dec)
Best regards

Vincent BUSSIERES
Responsable Technique Logiciel

[cid:image001.png@01D7BF5A.9E615620]
ZE Ma Campagne
36, Impasse Félix Nadar
16000 ANGOULEME
Tel: 33 (0)9.72.40.36.52
www.hemeria-group.com<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwebmail.nexeya.fr%2Fowa%2Fredir.aspx%3FC%3DGK_BqKCZef7LtPZnqnd_LGYr1NG9sz4Smy3iKIwO-pXqtJC7VgzXCA..%26URL%3Dhttp%253a%252f%252fwww.hemeria-group.com%252f=04%7C01%7Cgavin.lambert%40tomra.com%7C12547e247f5e46af71d408d98cfce6ab%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637695840522265846%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000=UHk6XPlo%2FQGznYWqyW%2BXwAD7JHincesuHanPvT8CE64%3D=0>
P Afin de contribuer au respect de l'environnement, merci de n'imprimer ce 
courriel qu'en cas de nécessité.
Ce message et les fichiers pouvant être attachés sont confidentiels, réservés à 
l'usage unique des destinataires et n'engagent HEMERIA sous aucune forme que ce 
soit.
This email and any files transmitted with it are confidential, intented solely 
for the unique use of the recipients and don't commit HEMERIA.



-- 
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [Etherlab-users] ecrt_sdo_request_state : error

2021-10-25 Thread Gavin Lambert
No, in fact you must not call ecrt_sdo_request_write on each cycle; you must 
call it only to begin a write.

The proper sequence is:

 1.  Call ecrt_sdo_request_index[_complete] to set the SDO to write (not 
required if this is the same SDO as the previous request / when created).
 2.  Call ecrt_sdo_request_data and write the data value to be written by the 
request into this buffer.
 3.  Call ecrt_sdo_request_write[_with_size] to begin the write request.
 4.  Each subsequent cycle, call ecrt_sdo_request_state to check the progress - 
do not call any of the above again on the same object while the status is 
EC_REQUEST_BUSY.
 5.  After completion, you may stop calling ecrt_sdo_request_state (although 
it's harmless if you continue), and you may start over at #1 again on any 
subsequent cycle.

#1-3 happen in the same cycle.  You don't have to do #4 on every cycle, but you 
must not try to use the request object again in any other way until the request 
is completed (with success or error).  You can have multiple request objects 
active for a single slave at a time, but bear in mind that they will happen in 
series, not parallel.  (Multiple requests for different slaves will happen in 
parallel, although only up to a preset concurrency limit.)

Since this is asynchronous functionality, you may find it useful to implement 
it with a state machine, although this is not required.

Gavin Lambert

Senior Software Developer TOMRA Fresh Food



[cid:TOMRAFresh_final_size_times_two_2_99d242b2-ba06-4c25-ab26-020cca7ee6dd.png]
 [cid:TF-FB-icon_b77c57e4-4990-4f9d-b3a2-8e6ab45df7f2.jpg] 
<https://www.facebook.com/TOMRAFreshFood>  
[cid:TF-LinkedIn-icon_d54c4829-dcb9-450c-9187-34b26e85ebaa.jpg] 
<https://www.linkedin.com/company/tomra-fresh-food/>  
[cid:TOMRA-Vimeo_4673038e-313a-491f-b3a4-0b39ace6df88.jpg] 
<https://vimeo.com/tomrafreshfood>  
[cid:TOMRAinstagram_45b30c55-490a-4f32-8fd3-998c152e3494.jpg] 
<https://www.instagram.com/tomrafood/>
 Compac Technologies Ltd | 4 Henderson Place | PO Box 13 516 | Onehunga 1061 | 
New Zealand

 Phone: +64 96 34 00 88 | https://www.compacsort.com
The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
From: BUSSIERES Vincent
Sent: Monday, 25 October 2021 08:55
To: etherlab-users@etherlab.org
Subject: [Etherlab-users] ecrt_sdo_request_state : error


Dear Etherlab users,

I use a Beckhoff module EL5102 (2 channels encoder interface) and two 
servodrives to control motors.



I develop a homing sequence as below :



1- Enable counter reset on channel 1 when index encoder is encountered

2- Move axis 1 until index is encoutered

3- Unable counter reset on channel 1

4- Enable counter reset on channel 2 when index encoder is encountered

5- Move axis 2 until index is encoutered

6- Unable counter reset on channel 2



Unabling and disabling counter reset is done using SDOs 0x80n0:01 where n is 
the channel number.



In my program, I create 2 SDO requests with « 
ecrt_slave_config_create_sdo_request » before changing master state in OP with 
« ecrt_master_activate ».

Then, before entering in cyclic task, I write SDOs for the first time and I get 
« EC_REQUEST_UNUSED » SDO request state (trigger first write), it seems to be 
OK.



void enableIndexResetCh_n(state)

{

switch (ecrt_sdo_request_state(mReqIndexResetCh_n)) {

case EC_REQUEST_UNUSED:

ecrt_sdo_request_write(mReqIndexResetCh_n);

break;



case EC_REQUEST_BUSY:

break;



case EC_REQUEST_SUCCESS:

EC_WRITE_U8(ecrt_sdo_request_data(mReqIndexResetCh1), 
static_cast(state));

ecrt_sdo_request_write(mReqIndexResetCh_n);

break;



default:

ecrt_sdo_request_write(mReqIndexResetCh_n);

break;

}

break;

}



Then, I realize homing sequence in the cyclic task as described before.

For the fisrt channel, I write « 1 » into SDO 0x8000:01, request state is « 
EC_REQUEST_SUCCES » but for the second channel 0x8010:02 I get « 
EC_REQUEST_ERROR » and SDO value remains at false state.

I don't understand why I get this error.



Moreover I want to let you know that I don't call « ecrt_sdo_request_write » at 
each loop of cyclic task but only when I need to change sdo state. Perhaps this 
is not the right way to call this function. Do I have to call this function at 
each iteration ?

How can I be sure that sdo state corresponds to the right state ? Do I have to 
read sdo state (if sdo is R/W) also at each iteration ?



Regards
-- 
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [Etherlab-users] Configuring EL7047 stepper driver

2021-07-26 Thread Gavin Lambert
Broadly speaking, there's three different kinds of slave.

The most basic have fixed PDO configuration and assignment.  If these implement 
CoE at all (which is also optional), you can't change any part of the PDO 
layout.

The middle tier (reasonably common in slaves that implement CoE at all) have 
variable PDO assignment but fixed configuration.  This means that you cannot 
change the contents of the PDOs but you can select which of them to include in 
your domain (although not always freely -- many slaves have mutually exclusive 
PDOs or specific ordering/size requirements or other such limitations).

Lastly there are those that do support changing the PDO configuration as well 
as assignment.  These are very rare (typically just things like PLCs and other 
highly programmable slaves).

For the former, you just "ethercat cstruct" and that's the only layout you'll 
ever get.
For the other two, you can do some manipulation before you "ethercat cstruct".  
But that manipulation only happens at "pre-commission" time (when you're 
writing your application) -- it never happens at actual run-live.

The table that is generated by "ethercat cstruct" encapsulates all of the PDO 
configuration and assignment, and when you use this table properly (see the 
examples) you don't have any "manual" writes to the PDO assignment or 
configuration objects at all in your code; that's taken care of by the Etherlab 
master itself.

The ecrt_slave_config_sdo* calls are only for "extra" not-PDO-related 
configuration that your slave may require.


Gavin Lambert
Senior Software Developer TOMRA Fresh Food

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Fontana Nicola  
Sent: Monday, 26 July 2021 5:21 pm
To: Gavin Lambert ; Graeme Foot 
; etherlab-users@etherlab.org
Subject: Re: [Etherlab-users] Configuring EL7047 stepper driver

Il giorno lun, 26/07/2021 alle 04.54 +, Gavin Lambert ha scritto:
> ...
> It's not really something you can do from a bash script.

Hi Gavin,

yes, I learnt it the hard way. That particular device has fixed PDO mappings 
and settings, i.e. all 0x1[468A]? entries are read-only. The only relevant 
parameters I can touch are the PDO assignement registers.
Coming from CANopen I thought anything can be done by just manipulating the 
object dictionary but... well, this is not the case.

Thank you again.
--
Nicola


-- 
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [Etherlab-users] Configuring EL7047 stepper driver

2021-07-26 Thread Gavin Lambert
You can also configure the slave to the desired configuration (either manually 
via "ethercat download" command line or with another master such as TwinCAT) 
before you use "ethercat cstruct" to generate your desired PDO layout (but do 
still read through it to verify that it is as expected).  This may or may not 
be simpler than just modifying the default cstruct tables to your desired 
config, depending on various factors.

After that, as Graeme says, you should write your application code to do the 
necessary configuration assuming that no "ethercat" commands have previously 
been run.  Reboot your slave before testing your app to ensure that it's not 
depending on some previous manual configuration, and read the example code 
(especially the "user" example).

It's not really something you can do from a bash script.


Gavin Lambert
Senior Software Developer TOMRA Fresh Food

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.com

The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
-Original Message-
From: Etherlab-users  On Behalf Of Graeme 
Foot
Sent: Monday, 26 July 2021 1:47 pm
To: Fontana Nicola ; etherlab-users@etherlab.org
Subject: Re: [Etherlab-users] Configuring EL7047 stepper driver

Hi Nicola,

The first thing is don't try to configure slaves via the ethercat command line 
utility.  You need to run an application (see the examples folder for various 
example applications).
The second thing is don't try to manually configure each slave by direct SDO 
calls, there are functions that do all of that for you that you call as part of 
the application.

The applications first step is to configure the slaves using for example:
  ecrt_master_get_slave
  ecrt_master_slave_config
  ecrt_slave_config_pdos
  ecrt_slave_config_create_sdo_request
  ecrt_slave_config_reg_pdo_entry
  ecrt_slave_config_sdo8 etc
  ecrt_slave_config_dc

A devices default configuration can be retrieved using the "ethercat cstruct" 
command.  You can then modify it if your slave allows modification.  You can 
download the slaves esi file from Beckhoff if you want to use a non-standard 
configuration, using it as a reference to set up your own cstruct data.

Once ready, the application calls ecrt_master_activate() and then calls the 
following commands (as a minimum) in a realtime loop:
  ecrt_master_receive
  ecrt_domain_process
  ecrt_domain_queue
  ecrt_master_send

The application will bring the slaves up from PREOP to OP, applying the 
configuration along the way.  If a slave is repowered the master will 
automatically re-apply the configuration and bring it back to OP.

Regards,
Graeme

-Original Message-
From: Etherlab-users  On Behalf Of Fontana 
Nicola
Sent: Sunday, 25 July 2021 01:02
To: etherlab-users@etherlab.org
Subject: [Etherlab-users] Configuring EL7047 stepper driver

Hi all,

I think this issue is not related to the ethercat software per-se but maybe 
someone has already met something similar or can point me into the right 
direction.

I'm trying to configure the EL7047 stepper driver in position controller mode 
without encoder (by default it is in velocity mode):


https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.beckhoff.com%2Fen-en%2Fproducts%2Fi-o%2Fethercat-terminals%2Fel7xxx-compact-drive-technology%2Fel7047.htmldata=04%7C01%7Cgavin.lambert%40tomra.com%7C16a57fd89b504bb5809808d94fd745eb%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637628608287133729%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=7nrcZ%2BRZV042Qzmhkyow%2B5Dam266ZgyJp7bRKX%2BZe84%3Dreserved=0

No matter what: it stays in PREOP state after having configured it.
Whenever I try to put it in SAFEOP/OP I get:

Failed to set SAFEOP state, slave refused state change (PREOP + ERROR).
AL status message 0x001E: "Invalid input configuration".

Here is the full script I'm using:


https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.com%2F-%2Fsnippets%2F2153453data=04%7C01%7Cgavin.lambert%40tomra.com%7C16a57fd89b504bb5809808d94fd745eb%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637628608287133729%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=Amp%2FeLCSJ7gRo6mLXMdACw8az8EbiNrurOTWdO0vcvc%3Dreserved=0

It runs successfully and I am sure the settings are changed (I checked them 
many times). For a couple of parameters, with a datatype smaller than a byte 
but bigger than boolean, I had to explicitely set the datatype to `uint8`, and 
AFAIK this is the only thing that "stinks".

The Bec

Re: [Etherlab-users] Slave shows INVALID PDO MAPPING even after giving PDO mapping

2024-04-07 Thread Gavin Lambert
Is your colleague using exactly the same device as you are (i.e. you are moving 
your device to their desk) or are they using a different but theoretically 
identical device? If one or both devices have previously been used with a 
different master then they may have different default configurations, or you 
may be relying on a configured address that is not the default device state.  
Or if the devices are not identical (they might be the same model but different 
revisions) then they might require or default to different PDO layouts.

Ensure that you have called ecrt_slave_config_pdos or equivalent in addition to 
ecrt_domain_reg_pdo_entry_list or equivalent.

Inspect the output of ethercat slaves -v on both systems before attempting to 
run your application (reboot the device first if you have previously attempted 
to run your app).

Gavin Lambert

Software Engineer



[cid:TOMRA_CMYK_final_size_times_two_cd761a01-1d1f-446e-9316-8012271820b6.png]
 [cid:TF-FB-icon_b77c57e4-4990-4f9d-b3a2-8e6ab45df7f2.jpg] 
<https://www.facebook.com/TOMRA.Food/>  
[cid:TF-LinkedIn-icon_d54c4829-dcb9-450c-9187-34b26e85ebaa.jpg] 
<https://www.linkedin.com/company/tomra-food/>  
[cid:icons-social-media-twitter_small_2_4bae5ad2-4add-4314-a352-5b317f784956.jpg]
 <https://twitter.com/TOMRAFood>  
[cid:TF-Youtube-icon_8b2c830c-70d9-48da-a4db-db9191d346ba.jpg] 
<https://www.youtube.com/playlist?list=PLDD3B1A7BAE919EC6>  
[cid:TOMRAinstagram_45b30c55-490a-4f32-8fd3-998c152e3494.jpg] 
<https://www.instagram.com/tomrafood/>
 Compac Technologies Ltd | 4 Henderson Place | PO Box 13 516 | Onehunga 1061 | 
New Zealand

 Phone: +64 96 34 00 88 | https://www.compacsort.com
The information contained in this communication and any attachment is 
confidential and may be legally privileged. It should only be read by the 
person(s) to whom it is addressed. If you have received this communication in 
error, please notify the sender and delete the communication.
From: Pranay Tummalapalli
Sent: Friday, April 5, 2024 8:07 PM
To: etherlab-users@etherlab.org
Subject: [Etherlab-users] Slave shows INVALID PDO MAPPING even after giving PDO 
mapping



I have a fully functional and tested setup in my system for Ethercat running a 
DC Motor with a single EtherCAT drive. Below are my system configurations:

Master source: vectioneer/stable branch

OS: Ubuntu 22.04

Kernel: 5.15.0-97-generic

I am using the systemd ethercat service. And I have a custom folder under the 
examples where I have all source and exec files for my project. I have added 
the folder in examples/Makefile.am and added the directory to 
configure.ac<http://configure.ac>. In my system it build well and everything 
works. Motor runs, all EtherCAT functionalities work and motor goes to setpoint 
position in OP.

When I try to run the same setup in my colleague's system with the same 
configuration as my system including master source and kernel version, the same 
drive remains in PREOP. When I try to run the same script as my system, the 
drive goes to PREOP+ERR and system logs display INVALID PDO MAPPING, SLAVE 
REFUSED TO CHANGE STATE with error 0x0024.
What a I missing in this?
-- 
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://lists.etherlab.org/mailman/listinfo/etherlab-users


<    1   2