[etherlab-users] Intermittent Large number of datagrams UNMATCHED

David Page Dave.Page at gleeble.com
Thu Jul 7 13:40:47 CEST 2016


Here's a py script to continuously read the diag registers (requires
ethercat_master.py). While running this, one may wiggle EtherCAT cables to
help identify intermittents.

    Best regards - Dave


>
> Message: 3
> Date: Wed, 06 Jul 2016 13:43:37 -0700
> From: Henry Bausley <hbausley at deltatau.com>
> To: Ralf Roesch <ethercat at cantastic.org>
> Cc: "etherlab-users at etherlab.org" <etherlab-users at etherlab.org>
> Subject: Re: [etherlab-users] Intermittent Large number of datagrams
>         UNMATCHED
> Message-ID: <1467837817.9419.71.camel at henry-ThinkCentre-M93p>
> Content-Type: text/plain; charset="UTF-8"
>
>
>   Thanks for all the great suggestions everyone.  Now that I'm back from
> holiday I will monitor registers 0x300 and 0x310 per the suggestions.
>
> Ralf,
>
>    The drives we are using are Lenze i700 drives.
>
>   I will also try changing the network interface.  Currently the network
> interface giving a problem is reported as a
> Intel 82579LM which is just a PHY, so I assume the controller is in the
> chipset.
>
>   I will try using the additional port on my PC which has an Intel 82574L
> and see if I have better luck.
>
>   I will keep you posted.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20160707/babb264f/attachment-0004.htm>
-------------- next part --------------
# -*- coding: utf-8 -*-
"""
bus_diag
===========

Scan EtherCAT bus slaves and read out bus diagnostic registers.

Created on 2015-07-28

Author Dave Page
"""

import time
from ethercat_master.ethercat_master import get_slaves, MasterDevice
from collections import namedtuple

if __name__ == "__main__":

    class PortState(object):
        def __init__(self, pos, ecat):
            self.position = pos
            self.ecat = ecat
            self.invalid_frame = [0]*4
            self.rx_error = [0]*4
            self.forwarded_error = [0]*4
            self.ecat_processing = 0
            self.lost_link = [0]*4
            self.read_fail = 0

        def __str__(self):
            return """%3d: %-50s fail: %3d frame: %3d %3d %3d %3d rx: %3d %3d %3d %3d forward: %3d %3d %3d %3d proc: %3d link: %3d %3d %3d %3d""" % tuple(
        [self.position, self.ecat.name, self.read_fail] + self.invalid_frame +
        self.rx_error + self.forwarded_error + [self.ecat_processing] +
        self.lost_link)

    with MasterDevice(0) as m:
        master = m.get_master()
        slaves = []
        for i in xrange(master.slave_count):
            slaves.append( PortState(i, m.get_slave(i)) )

        while True:
            print
            print
            for slav in slaves:
                r300 = 0
                r308 = 0
                r310 = 0
                try:
                    # Read 0x0300 - 0x0307
                    r300 = m.read_reg(slav.position, 'uint64_t', 0x0300)
                    # Read 0x0308 - 0x030f
                    r308 = m.read_reg(slav.position, 'uint64_t', 0x0308)
                    # Read 0x0310 - 0x0313
                    r310 = m.read_reg(slav.position, 'uint32_t', 0x0310)

                    #print '%016x %016x %08x' % (r300, r308, r310)
                except:
                    slav.read_fail += 1
                try:
                    # Reset all
                    m.write_reg(slav.position, 'uint64_t', 0x0300, 0)
                    m.write_reg(slav.position, 'uint64_t', 0x0308, 0)
                    m.write_reg(slav.position, 'uint32_t', 0x0310, 0)
                except:
                    print 'Reset failed'

                # Accumulate errors
                for p in xrange(4):
                    slav.invalid_frame[p] += (r300 >> (p*16)) & 0xff
                    slav.rx_error[p] += (r300 >> (8+p*16)) & 0xff
                    slav.forwarded_error[p] += (r308 >> (p*8)) & 0xff
                    slav.lost_link[p] += (r310 >> (p*8)) & 0xff
                slav.ecat_processing += (r308 >> 32) & 0xff

                print slav
            time.sleep(2)


More information about the Etherlab-users mailing list