EtherCAT slave that reads 3 Xsens IMU's connected to a Xbus Master

Dependencies:   MODSERIAL mbed KL25Z_ClockControl

Fork of EtherCAT by First Last

Revision:
36:8e6ac6082e97
Parent:
28:8505285f65ed
diff -r 32659533e0ef -r 8e6ac6082e97 xbus.cpp
--- a/xbus.cpp	Fri Sep 11 11:33:53 2015 +0000
+++ b/xbus.cpp	Fri Sep 11 11:49:14 2015 +0000
@@ -162,14 +162,30 @@
     XbusCreateMessage(0xFF,0x04,2,data,msg);//SetPeriod
     XbusSendArray(msg);
     
-    data[0] = 0;//0x40;
-    data[1] = 2;//0x00;//0002: callibrated data
+    /*
+    data[0] = 0;//0x00;
+    data[1] = 2;//0x02;//0002: callibrated data
+    */
+    data[0] = 0;
+    data[1] = 0x04;//0004: orientation data
     for (int i = 0 ; i<3 ; i++)
     {
-        XbusCreateMessage(i+1,0xD0,2,data,msg);//Set Output Data Format
+        XbusCreateMessage(i+1,0xD0,2,data,msg);//Set Output Mode
+        XbusSendArray(msg);
+    }
+    
+    data[0] = 0;//Reserved
+    data[1] = 0;// LLAWGS84
+    data[2] = 0;//Float output, Enable aux outputs
+    data[3] = 0x01;//SampleCounter, Quaternion, Enable all sensor outputs, Reserved 
+    
+    for (int i = 0 ; i<3 ; i++)
+    {
+        XbusCreateMessage(i+1,0xD2,4,data,msg);//Set Output Settings
         XbusSendArray(msg);
     }
     wait_ms(10);
+    
     XbusCreateMessage(0xFF,0x10,0,msg,msg);//GoToMeasurement
     XbusSendArray(msg);
 }