[etherlab-users] Timeout while waiting for Sdo upload response

Erwin Burgstaller ethercat.berknapp at spamgourmet.com
Tue Apr 14 17:10:58 CEST 2009


* Mon, Oct 20, 2008 - 17:44:25 +0200, Florian Pose - fp at igh-essen.com:
> On Mon, Oct 20, 2008 at 04:19:28PM +0200, Erwin Burgstaller wrote:
> > > If I understood you right, the only timeout problems happen in context
> > > of Sdo requests, is this correct?
> > 
> > That's correct.
> 
> Ok, I'll have a look at it tomorrow. This must be not so hard to find.

Hi,

I forgot about that problem, as I did run the bus always via the switch
and even if timeouts are reportet by the master, setting the baud rate
via SDO-request did mostly work. At least it seemed to work.

But now that application went to production with EC-Master 1.4 and the
timeout problem is still there and sometimes setting the serial
parameters for the EL6001 does not work.

I've tried the developer version 1.7 too and I've also tried it with
both settings: --enable-cycles and --disable-cycles, but with no
difference.

I've noticed too: If I run the ec_master.ko with debug level 2, the upload requests

ethercat upload -p1 -tstring 0x100A 0
ethercat upload -p1 -tuint8 0x1C12 0

are working, although there are timeout messages but at the end it seems
to work. With debug on level 0 it doesn't.

It looks like a timing problem, as it went better when I'm putting a
switch in or I'm slowing down the master with debug level 2.

It has nothing to do with the above problem, but:

I've patched the master code, so I can set the debug level while
inserting the kernel module.

I did set 

#define EC_IO_TIMEOUT 20000

too, because with the orignal value of 500 sometimes datagrams were
declared as timed out but in fact the master did not get enough cpu
cycles to catch all datagrams while scanning the bus. So some modules
were not correctly recognized. Increasing the EC_IO_TIMEOUT did help.

But the SDO-timeout-thing is not affected by that.

I'm appending my changes to the master code, maybe they could go to the
current code.

Thanks for any help,

Erwin


-- 
Erwin Burgstaller
-------------- next part --------------
diff -w -u ./globals.h ../../v1_4_patched/master/globals.h
--- ./globals.h	2009-01-14 12:27:16.000000000 +0100
+++ ../../v1_4_patched/master/globals.h	2009-03-30 17:44:07.000000000 +0200
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
  *
  *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
  *
@@ -45,7 +45,7 @@
 #define EC_EOE_FREQUENCY 1000
 
 /** Datagram timeout in microseconds. */
-#define EC_IO_TIMEOUT 500
+#define EC_IO_TIMEOUT 20000
 
 /** Number of state machine retries on datagram timeout. */
 #define EC_FSM_RETRIES 3
diff -w -u ./master.c ../../v1_4_patched/master/master.c
--- ./master.c	2009-01-14 12:27:16.000000000 +0100
+++ ../../v1_4_patched/master/master.c	2009-03-30 17:44:07.000000000 +0200
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
  *
  *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
  *
@@ -102,7 +102,8 @@
         const uint8_t *main_mac, /**< MAC address of main device */
         const uint8_t *backup_mac, /**< MAC address of backup device */
         dev_t device_number, /**< Character device number. */
-        struct class *class /**< Device class. */
+	struct class *class, /**< Device class. */
+        int debug_level /**< Debug level (module parameter) */
         )
 {
     master->index = index;
@@ -138,7 +139,7 @@
 
     INIT_LIST_HEAD(&master->domains);
 
-    master->debug_level = 0;
+    master->debug_level = debug_level;
     master->stats.timeouts = 0;
     master->stats.corrupted = 0;
     master->stats.unmatched = 0;
diff -w -u ./master.h ../../v1_4_patched/master/master.h
--- ./master.h	2009-01-14 12:27:16.000000000 +0100
+++ ../../v1_4_patched/master/master.h	2009-03-30 17:44:07.000000000 +0200
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
  *
  *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
  *
@@ -160,7 +160,7 @@
 
 // master creation/deletion
 int ec_master_init(ec_master_t *, unsigned int, const uint8_t *,
-        const uint8_t *, dev_t, struct class *);
+		   const uint8_t *, dev_t, struct class *, int);
 void ec_master_clear(ec_master_t *);
 
 // phase transitions
diff -w -u ./module.c ../../v1_4_patched/master/module.c
--- ./module.c	2009-01-14 12:27:16.000000000 +0100
+++ ../../v1_4_patched/master/module.c	2009-03-30 17:44:07.000000000 +0200
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
  *
  *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
  *
@@ -57,6 +57,9 @@
 static struct semaphore master_sem; /**< Master semaphore. */
 static unsigned int master_count; /**< Number of masters. */
 static unsigned int backup_count; /**< Number of backup devices. */
+static unsigned int debug_level;  /**< Debug level, just for transfer
+				   * from commandline to master
+				   * structure */
 
 dev_t device_number; /**< Device number for master cdevs. */
 struct class *class; /**< Device class. */
@@ -79,6 +82,10 @@
 module_param_array(backup_devices, charp, &backup_count, S_IRUGO);
 MODULE_PARM_DESC(backup_devices, "MAC addresses of backup devices");
 
+module_param_named(debug_level, debug_level, uint, S_IRUGO);
+MODULE_PARM_DESC(debug_level, "Debug level 0..1 (none,debug)");
+
+
 /** \endcond */
 
 /*****************************************************************************/
@@ -139,8 +146,9 @@
     }
     
     for (i = 0; i < master_count; i++) {
+
         if (ec_master_init(&masters[i], i, macs[i][0], macs[i][1],
-                    device_number, class)) {
+			  device_number, class, debug_level)) {
             ret = -ENOMEM;
             goto out_free_masters;
         }


More information about the Etherlab-users mailing list