DMA issue to be tested

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Files at this revision

API Documentation at this revision

Comitter:
spacelab
Date:
Tue Nov 01 07:18:59 2016 +0000
Parent:
306:7c3872365d58
Child:
308:bd591ef82b76
Child:
309:af5ab655ba00
Commit message:
DMA_issue_verification

Changed in this revision

CDMS_HK.h Show annotated file Show diff for this revision Revisions of this file
Compression.h Show annotated file Show diff for this revision Revisions of this file
DefinitionsAndGlobals.h Show annotated file Show diff for this revision Revisions of this file
ThreadsAndFunctions.h Show annotated file Show diff for this revision Revisions of this file
--- a/CDMS_HK.h	Sun Oct 09 07:08:34 2016 +0000
+++ b/CDMS_HK.h	Tue Nov 01 07:18:59 2016 +0000
@@ -288,6 +288,7 @@
     SelectLinec1=0;
     SelectLinec2=0;
     SelectLinec3=0;
+    wait_ms(1);
     //gPC.printf("\r%d %d %d %d\n",SelectLinec3.read(),SelectLinec2.read(),SelectLinec1.read(),SelectLinec0.read());
     for(Iteration=0; Iteration<16; Iteration++) {
 
@@ -300,18 +301,21 @@
             SelectLinec2=!(SelectLinec2);
         if(Iteration%8==7)
             SelectLinec3=!(SelectLinec3);
-        //gPC.printf("\r%d %d %d %d\n",SelectLinec3.read(),SelectLinec2.read(),SelectLinec1.read(),SelectLinec0.read());
+            wait_ms(1);
+     //  gPC.printf("\r%d %d %d %d\n",SelectLinec3.read(),SelectLinec2.read(),SelectLinec1.read(),SelectLinec0.read());
     }
 
     actual_data.CDMS_temp_actual=(-90.7*3.3*CDMS_temp_sensor.read())+190.1543;
     
-//    gPC.printf("\rRaw Temp = %f\n",actual_data.temp_actual[15]*3.3);
+
     
     for(Iteration=0; Iteration<16; Iteration++) {
 
         if(Iteration<4)
-            actual_data.temp_actual[Iteration]=actual_data.temp_actual[Iteration]*3.3*20;
-            
+            {actual_data.temp_actual[Iteration]=actual_data.temp_actual[Iteration]*3.3*2;
+         //   gPC.printf("\rVoltage reading, iteration = %f, %d \n",actual_data.temp_actual[Iteration], Iteration);
+          //  wait_ms(1);
+        }
         else if(Iteration<14){
             resistance=24300*actual_data.temp_actual[Iteration]*3.3/(3.3-actual_data.temp_actual[Iteration]*3.3);
            
--- a/Compression.h	Sun Oct 09 07:08:34 2016 +0000
+++ b/Compression.h	Tue Nov 01 07:18:59 2016 +0000
@@ -132,7 +132,10 @@
 void srp(uint8_t * head)
 {
     uint8_t sd_stat = 0;
-    gPC.printf("\n\rsrp");
+        SCI_LED1 =1;
+
+    // SCI_LED1 = !SCI_LED1;
+   // gPC.printf("\n\rsrp");
     debug_cntr = 0;
     sci_time = FCTN_CDMS_RD_RTC();
     #if debug_time
@@ -141,7 +144,7 @@
     if(time_prev_scp==0){
         time_prev_scp = sci_time;
     }    
-    //FCTN_SD_MNGR();                                                             ///changed recently
+    FCTN_SD_MNGR();                                                             ///changed recently
     for (int i = 0; i < 52 ; i++)
     {
         scp_bin[i] = 0;
@@ -151,14 +154,14 @@
     for(uint8_t counter = 0 ; counter < 60 ; counter++)
     {       
         #if srpz
-        gPC.printf("\n\n\rSRP count:%d",counter+1);
+     //   gPC.printf("\n\n\rSRP count:%d",counter+1);
         #endif
         /*-------------------- ------------populating sfp_bin and scp_bin[] starts here(also tag AT or BT)-----------------------*/
         at = 0;     pzf = 1;    ezf = 1;
         if(srp_mode == 0)                                   //calibrated mode 
         {
             #if srpz
-            gPC.printf("\n\rSRP - Calibrated Mode");
+       //     gPC.printf("\n\rSRP - Calibrated Mode");
             #endif
             for(int i=0; i<48 ; i++)                        //first 48 bins or SRP are of 16 bits size
             {
@@ -1272,4 +1275,8 @@
     #endif   
     gPC.printf("fsc = %u, %u,%u\n\r", FSC_CURRENT[1],FSC_CURRENT[2],FSC_CURRENT[3]);
     //gPC.printf("\n\rEndSRP"); 
+ //   SCI_LED1 = !SCI_LED1;
+     SCI_LED1 = 0;
+
+
 }
\ No newline at end of file
--- a/DefinitionsAndGlobals.h	Sun Oct 09 07:08:34 2016 +0000
+++ b/DefinitionsAndGlobals.h	Tue Nov 01 07:18:59 2016 +0000
@@ -307,6 +307,7 @@
 DigitalOut RESET_TO_PYLD(PIN21,1);//RESET_PYLD
 
 DigitalOut DMA_LED1(PIN61,0);
+DigitalOut SCI_LED1(PIN62,0);
 
 //SD HK
 uint32_t FSC_CURRENT[6];
--- a/ThreadsAndFunctions.h	Sun Oct 09 07:08:34 2016 +0000
+++ b/ThreadsAndFunctions.h	Tue Nov 01 07:18:59 2016 +0000
@@ -15,18 +15,19 @@
     gPC.printf("\n\rTest...........................");
     gPAY_SPI->bulkRead_init(gPAYLOAD_BUFFER, PAYLOAD_BUFFER_LENGTH, &payload_isr_fun);
     gPAY_SPI->bulkRead_start();
+    
     //AY_SPI->bulkRead_pause();
     //AY_SPI->bulkRead_resume(&payload_isr_fun);
     while(true){
         //gPC.puts("entering sci\r\n");
         gSCIENCE_THREAD->signal_wait(SCIENCE_SIGNAL);
-        gMutex.lock();
+        gMutex.lock(); 
         PL_RCV_SC_DATA_STATUS = 1;
         //gPC.puts("sig_set\r\n");
         //for(int i =0; i<PAYLOAD_BUFFER_LENGTH; i++)
         //if (gPAYLOAD_BUFFER[i] != 0x01) gPC.printf("%d = 0x%02X\n\r",i,gPAYLOAD_BUFFER[i]);  
         //gPAY_SPI->bulkRead_start();
-        srp(gPAYLOAD_BUFFER);//skip one apcket when cdms resets
+      //  srp(gPAYLOAD_BUFFER);//skip one apcket when cdms resets
         //gPC.puts("exit_srp\r\n");
         //wait(2);/*timeout to be decided*/
         if(dma)
@@ -37,9 +38,12 @@
             //gPAY_SPI->bulkRead_pause();
             //gPAY_SPI->bulkRead_resume(&payload_isr_fun);
         }
+       // DMA_LED1 = !DMA_LED1; // added by samp
+        
+        srp(gPAYLOAD_BUFFER);//skip one apcket when cdms resets
         /*else
         gPC.printf("\n\rDMA error");*/
-        gMutex.unlock();
+        gMutex.unlock(); 
     }
 }