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:
28:8505285f65ed
Parent:
27:93c0e4ae943e
Child:
29:95ef6b54ec8e
Child:
32:1f6a705cd794
--- a/soes.cpp	Mon Mar 09 15:58:00 2015 +0000
+++ b/soes.cpp	Tue Mar 10 09:43:41 2015 +0000
@@ -65,9 +65,9 @@
 DigitalOut et1100_ss(ET1100_SS);
 DigitalIn  et1100_miso(ET1100_MISO);
 SPI et1100_spi(ET1100_MOSI,ET1100_MISO,ET1100_SCK);
-MODSERIAL xbus_serial(PTC4,PTC3);
+MODSERIAL xbus_serial(PTA2,PTA1, 512);
 xbus_t xbus_master;
-MODSERIAL pc(USBTX,USBRX,512);
+//MODSERIAL pc(USBTX,USBRX,512);
 
 DigitalOut ploep(PTA13);
 #define PLOEP do{ploep = !(ploep);}while(0);
@@ -98,7 +98,7 @@
         case 0x01:
         {
             uint32_t rates[] = {460800,230400,115200,76800,57600,38400,28800,19200,14400,9600};
-            if(Eb.setting8 < (sizeof(rates)/sizeof(uint32_t)) )
+            if(Eb.setting8 < (sizeof(rates)/sizeof(uint32_t))  )
             {	
             	XbusGoToConfig();
             	XbusSetBaudRate(Eb.setting8);
@@ -108,6 +108,16 @@
             	XbusInitializeXbusMaster();
             	
             }
+            else if(Eb.setting8 == 0x80)
+            {
+            	XbusGoToConfig();
+            	XbusSetBaudRate(0x80);
+            	XbusReset();
+            	wait(2);
+            	xbus_serial.baud(960800);
+            	XbusInitializeXbusMaster();
+            	
+            }
             break;
         }
         case 0x02:
@@ -208,7 +218,7 @@
     wait_ms(200);
     /*initialize configuration*/
     //Eb.setting16 = 0xABCD;
-    //Eb.setting8  = 111;
+    Eb.setting8  = 1;
     // wait until ESC is started up
     while ((ESCvar.DLstatus & 0x0001) == 0)
         ESC_read(ESCREG_DLSTATUS, &ESCvar.DLstatus, sizeof(ESCvar.DLstatus), &ESCvar.ALevent);