CRC-Counter nach ESC-Datasheet implementiert.
authorFlorian Pose <fp@igh-essen.com>
Mon, 27 Mar 2006 12:04:55 +0000
changeset 132 63a5b40eb7da
parent 131 7564db092c91
child 133 b36d187ecc0b
CRC-Counter nach ESC-Datasheet implementiert.
master/slave.c
todo.txt
--- a/master/slave.c	Mon Mar 27 10:47:12 2006 +0000
+++ b/master/slave.c	Mon Mar 27 12:04:55 2006 +0000
@@ -871,14 +871,31 @@
     }
 
     // No CRC faults.
-    if (!EC_READ_U16(command.data) && !EC_READ_U16(command.data + 2)) return 0;
-
-    EC_WARN("CRC faults on slave %i. A: %i, B: %i\n", slave->ring_position,
-            EC_READ_U16(command.data), EC_READ_U16(command.data + 2));
+    if (!EC_READ_U32(command.data)) return 0;
+
+    if (EC_READ_U8(command.data))
+        EC_WARN("%3i RX-error%s on slave %i, channel A.\n",
+                EC_READ_U8(command.data),
+                EC_READ_U8(command.data) == 1 ? "" : "s",
+                slave->ring_position);
+    if (EC_READ_U8(command.data + 1))
+        EC_WARN("%3i invalid frame%s on slave %i, channel A.\n",
+                EC_READ_U8(command.data + 1),
+                EC_READ_U8(command.data + 1) == 1 ? "" : "s",
+                slave->ring_position);
+    if (EC_READ_U8(command.data + 2))
+        EC_WARN("%3i RX-error%s on slave %i, channel B.\n",
+                EC_READ_U8(command.data + 2),
+                EC_READ_U8(command.data + 2) == 1 ? "" : "s",
+                slave->ring_position);
+    if (EC_READ_U8(command.data + 3))
+        EC_WARN("%3i invalid frame%s on slave %i, channel B.\n",
+                EC_READ_U8(command.data + 3),
+                EC_READ_U8(command.data + 3) == 1 ? "" : "s",
+                slave->ring_position);
 
     // Reset CRC counters
-    EC_WRITE_U16(data,     0x0000);
-    EC_WRITE_U16(data + 2, 0x0000);
+    EC_WRITE_U32(data, 0x00000000);
     ec_command_init_npwr(&command, slave->station_address, 0x0300, 4, data);
     if (unlikely(ec_master_simple_io(slave->master, &command))) {
         EC_WARN("Resetting CRC fault counters failed on slave %i!\n",
--- a/todo.txt	Mon Mar 27 10:47:12 2006 +0000
+++ b/todo.txt	Mon Mar 27 12:04:55 2006 +0000
@@ -5,12 +5,12 @@
 
 - Anzahl Frames, die die Karte Puffern kann
 - Mehrere Frames versenden
+- Typeninformation aus Master entfernen / XML-Dateien aus User-Space lesen
 - Kommandos mit dynamischem Speicher
 - Konfiguration Inkrementalgeberklemme
 - SSI-Klemme
 - SysFS-Interface implementieren
 - SDO Dictionary der Slaves auslesen und im SysFS darstellen
-- Typeninformation aus Master entfernen / XML-Dateien aus User-Space lesen
 - DLL-Link-States auslesen und Topologie berechnen
 - Ethernet over EtherCAT (EoE)
 - eepro100-Kartentreiber