some improvements
authorfrdupin
Tue, 19 Dec 2006 16:45:39 +0100
changeset 61 813ffdfbffb2
parent 60 a8723422e0dd
child 62 93d4db3677e6
some improvements
examples/gene_SYNC_HCS12/appli.c
examples/gene_SYNC_HCS12/objdict.h
examples/gene_SYNC_HCS12/readme.txt
--- a/examples/gene_SYNC_HCS12/appli.c	Tue Dec 19 16:30:57 2006 +0100
+++ b/examples/gene_SYNC_HCS12/appli.c	Tue Dec 19 16:45:39 2006 +0100
@@ -49,18 +49,10 @@
 #include "../include/sync.h"
 
 #include "../include/nmtSlave.h"
+
+// File created by the GUI 
 #include "objdict.h"
 
-// Variables defined in the object dictionary (See objdict.c)
-extern UNS16 acceptanceFilter1;		// Mapped at index 0x2015, subindex 0x00
-extern UNS16 acceptanceFilter2;		// Mapped at index 0x2016, subindex 0x00
-extern UNS16 acceptanceFilter3;		// Mapped at index 0x2017, subindex 0x00
-extern UNS16 acceptanceFilter4;		// Mapped at index 0x2018, subindex 0x00
-extern UNS16 mask1;		// Mapped at index 0x2019, subindex 0x00
-extern UNS16 mask2;		// Mapped at index 0x2020, subindex 0x00
-extern UNS16 mask3;		// Mapped at index 0x2021, subindex 0x00
-extern UNS16 mask4;		// Mapped at index 0x2022, subindex 0x00
-extern UNS8 applyDownloadedFilters;
 
 
 
@@ -151,15 +143,6 @@
 void initPortB(void);
 void initPortH(void);
 
-// Functions needed by Canfestival
-// Notice that gene_SYNC is the name of the sensor defined in python GUI.
-// Do not change it !.
-void gene_SYNC_initialisation(void);
-void gene_SYNC_preOperational(void);
-void gene_SYNC_operational(void);
-void gene_SYNC_stopped(void);
-void gene_SYNC_post_sync(void);
-
 
 //------------------------------------------------------------------------------
 //Initialisation of the port B for the leds.
@@ -288,7 +271,17 @@
 //------------------------------------------------------------------------------
 void gene_SYNC_SDOtimeoutError (UNS8 line)
 {
+	// This function was implemented for the Client's use (client = the one which initiate the dialog),
+	// but we can use it also for the server.
+	// Note : if for an other reason than a timeout, a SDO to read or write 
+	// faile, we do not have implemented a warning function at the server side.
+	// Of course, there is one on the client side.
+  
   MSG_ERR(0x1F01, "SDO timeout for line : ", line);
+  // See the transfer structure in sdo.h to know what informations
+  // you can retreive.
+  MSG_ERR(0x1F02, "  to access index ", gene_SYNC_Data.transfers[line].index);
+  MSG_ERR(0x1F03, "         subIndex ", gene_SYNC_Data.transfers[line].subIndex);
 }
 
 //------------------------------------------------------------------------------
--- a/examples/gene_SYNC_HCS12/objdict.h	Tue Dec 19 16:30:57 2006 +0100
+++ b/examples/gene_SYNC_HCS12/objdict.h	Tue Dec 19 16:45:39 2006 +0100
@@ -30,13 +30,13 @@
 
 UNS8 gene_SYNC_canSend(Message *);
 
-void gene_SYNC_initialisation();
-void gene_SYNC_preOperational();
-void gene_SYNC_operational();
-void gene_SYNC_stopped();
+void gene_SYNC_initialisation(void);
+void gene_SYNC_preOperational(void);
+void gene_SYNC_operational(void);
+void gene_SYNC_stopped(void);
 
-void gene_SYNC_post_sync();
-void gene_SYNC_post_TPDO();
+void gene_SYNC_post_sync(void);
+void gene_SYNC_post_TPDO(void);
 
 // Master node data struct
 extern CO_Data gene_SYNC_Data;
--- a/examples/gene_SYNC_HCS12/readme.txt	Tue Dec 19 16:30:57 2006 +0100
+++ b/examples/gene_SYNC_HCS12/readme.txt	Tue Dec 19 16:45:39 2006 +0100
@@ -51,12 +51,38 @@
 
 
 To change the period of SYNC,
+-----------------------------
 In pre-operational mode, send the SDO message cobid | .... (all in hexa):
 0x603 | 23 06 10 00 40 42 0F 00 
 to have a SYNC generated every 1 second. The change is instantaneous.
 (Assume that the nodeId is 3).
 
 
+To read the name of the node
+----------------------------
+(Assume that the nodeId is 3).
+You must use the segmented SDO protocole to make an upload from index
+0x1008 subindex 0x00
+
+c : client
+s : server (geneSync)
+
+Here is the dialog you must obtain.
+c: 0x603 | 40 08 10 00 00 00 00 00
+s: 0x583 | 41 08 10 00 0A 00 00 00
+c: 0x603 | 60 00 00 00 00 00 00 00
+s: 0x583 | 00 47 45 4E 45 5F 53 59
+c: 0x603 | 70 00 00 00 00 00 00 00
+s: 0x583 | 19 4E 43 00 00 00 00 00
+
+In the server's frames, you should read GENE_SYNC. (yes ...)
+
+If in the exchange you are not responding too faster (less than 3
+seconds. See in config.h #define SDO_TIMEOUT_MS),
+the nodes send a SDO abort :
+0x583 | 08 08 10 00 00 00 04 05
+
+
 
 
 
@@ -65,3 +91,5 @@
 
 
 
+
+