CDMS_CODE_samp_23SEP_DMA_flag

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE_samp_23SEP_DMA by iitm sat

Revision:
203:424308159a56
Parent:
201:3410fc4d80f0
Child:
204:72f52e74e0e4
Child:
205:d2ac4580960d
diff -r 8700a3e6324c -r 424308159a56 main.cpp
--- a/main.cpp	Fri Jul 01 08:56:27 2016 +0000
+++ b/main.cpp	Fri Jul 01 17:41:48 2016 +0000
@@ -102,7 +102,7 @@
     
     // DEBUG
     //gPC.puts("welcome to mng_tm_tc\r\n");
-    gPC.baud(9600);//changed for bypassing COM
+    gPC.baud(115200);//changed for bypassing COM
     
     // COMMON SPI
     spi.format(8,0);
@@ -114,11 +114,73 @@
     gCS_ADF = 1;
     
     FCTN_CDMS_INIT_RTC();/* rtc initialization*/
-    //FCTN_CDMS_SD_INIT();/* sd card initialization*/
+    FCTN_CDMS_SD_INIT();/* sd card initialization*/
     
     
     uint8_t test[512] = {0};
     disk_write(test,7000); //to be used only just before launch
+    uint8_t data[512];
+    for(int i=0;i<512;i++)
+        data[i] = i%100;
+    for(int i=0;i<512;i++)
+        test[i] = 1;
+    FCTN_SD_MNGR();//this should give the last fscs written : FSC_CURRENT 
+    gPC.printf("\r fsc_curr = %d\n",FSC_CURRENT[2]);
+    if(SD_WRITE(data,FSC_CURRENT[2]+1,2) == 0)//
+    {
+        gPC.printf("\r fsc_curr = %d\n",FSC_CURRENT[2]);
+        int j = SD_READ(test,FSC_CURRENT[2],2);
+        for(int i=0;i<15;i++)
+        {
+            gPC.printf("\r0x%02X 0x%02X %d %d\n",data[i],test[i],j,FSC_CURRENT[2]);
+        }
+    }
+    
+    if(SD_WRITE(data,FSC_CURRENT[2]+1,2) == 0)
+    {
+        int j = SD_READ(test,FSC_CURRENT[2],2);
+        for(int i=0;i<15;i++)
+        {
+            gPC.printf("\r0x%02X 0x%02X %d %d\n",data[i],test[i],j,FSC_CURRENT[2]);
+        }
+    }
+    gPC.printf("\r fsc_curr = %d\n",FSC_CURRENT[2]);
+    if(SD_WRITE(data,FSC_CURRENT[2]+1,2) == 0)
+    {
+        gPC.printf("\r fsc_curr = %d\n",FSC_CURRENT[2]);
+        int j = SD_READ(test,FSC_CURRENT[2],2);
+        gPC.printf("\r fsc_curr = %d\n",FSC_CURRENT[2]);
+        for(int i=0;i<15;i++)
+        {
+            gPC.printf("\r0x%02X 0x%02X %d %d\n",data[i],test[i],j,FSC_CURRENT[2]);
+        }
+    }
+    
+    
+    gPC.printf("\r fsc_curr = %d\n",FSC_CURRENT[1]);
+    if(SD_WRITE(data,FSC_CURRENT[1]+1,1) == 0)
+    {
+        gPC.printf("\r fsc_curr = %d\n",FSC_CURRENT[1]);
+        int j = SD_READ(test,FSC_CURRENT[1],1);
+        gPC.printf("\r fsc_curr = %d\n",FSC_CURRENT[1]);
+        for(int i=0;i<15;i++)
+        {
+            gPC.printf("\r0x%02X 0x%02X %d %d\n",data[i],test[i],j,FSC_CURRENT[1]);
+        }
+    }
+    
+    gPC.printf("\r fsc_curr = %d\n",FSC_CURRENT[2]);
+    if(SD_WRITE(data,FSC_CURRENT[2]+1,2) == 0)
+    {
+        gPC.printf("\r fsc_curr = %d\n",FSC_CURRENT[2]);
+        int j = SD_READ(test,FSC_CURRENT[2],2);
+        gPC.printf("\r fsc_curr = %d\n",FSC_CURRENT[2]);
+        for(int i=0;i<15;i++)
+        {
+            gPC.printf("\r0x%02X 0x%02X %d %d\n",data[i],test[i],j,FSC_CURRENT[2]);
+        }
+    }
+    
     
     
     #if DEBUG
@@ -144,6 +206,10 @@
     master.frequency(400000);
     PL_wo_dma = new RtosTimer(payload_isr_fun_dma, osTimerPeriodic,(void * )NULL);
     //PL_wo_dma->start(6000);//
+    //gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL);
+    
+    
+    
     
     gPC.printf("PL_TC sending\r\n");