working

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Files at this revision

API Documentation at this revision

Comitter:
ee12b079
Date:
Thu Mar 10 15:26:50 2016 +0000
Parent:
132:d4a4461214ad
Child:
137:6fcbbaf19284
Commit message:
To be tested for i2c with PL and OBSRS TC.; Major change : 1) junk_f flag shifted to reset_adf (so that it works for multiple sessions); 2) Serial Baudrate changed to 115200; 3) Added many zeros at the end of packet in APS for GNU radio

Changed in this revision

COM_MNG_TMTC.h Show annotated file Show diff for this revision Revisions of this file
COM_SND_TM.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
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/COM_MNG_TMTC.h	Mon Feb 29 13:21:40 2016 +0000
+++ b/COM_MNG_TMTC.h	Thu Mar 10 15:26:50 2016 +0000
@@ -495,15 +495,16 @@
                             }                            
                             case 0x2:
                             {
-                            //printf("sub_service:Read from Flash_Memory\r\n");
+                            printf("sub_service:Read from Flash_Memory\r\n");
                             mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]);                           
                                                                                              
                                     //Data[0] = FCTN_CDMS_RD_FLASH(0);
                                     //Data[1] = FCTN_CDMS_RD_FLASH(1);                                                                                             
                                     //tm_pointer = new Long_tm;
-                                    tm_pointer->TM_string[0] = 0x30;
+                                    tm_pointer->TM_string[0] = 0xB0;
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
-                                    tm_pointer->TM_string[2] = (uint8_t)(flash_counter);
+                                    tm_pointer->TM_string[2] = ACKCODE;
+                                    
                                     for(uint8_t i=0;i<4;i++)
                                     {
                                         tm_pointer->TM_string[3+i] = (uint8_t)((Data[0]>>(8*i))&0x00FF);
@@ -515,6 +516,7 @@
                                     crc16 = crc16_gen(tm_ptr->TM_string,9);
                                     tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
                                     tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    //for(int i = )
                                 tm_pointer->next_TM = NULL;                 return tm_ptr;
                             }                           
                             case 0x5:
--- a/COM_SND_TM.h	Mon Feb 29 13:21:40 2016 +0000
+++ b/COM_SND_TM.h	Thu Mar 10 15:26:50 2016 +0000
@@ -419,8 +419,8 @@
                                 TOTAL_SEGMENT_NO -= SEGMENT_NO;
                                 reset_adf = true;//what does this do??
                                 Sframe = true;
+                                junk_f = true;
                            }
-                        junk_f = true;
                     }
                     continue;
                 }
--- a/ThreadsAndFunctions.h	Mon Feb 29 13:21:40 2016 +0000
+++ b/ThreadsAndFunctions.h	Thu Mar 10 15:26:50 2016 +0000
@@ -106,7 +106,7 @@
             gPC.puts("NEW TC RECEIVED\r\n");
             #endif
 //            DEBUF_PRINT("NEW TC RECEIVED\r\n");
-            Thread::wait(2000);    /*To be removed in flight model*/
+            //Thread::wait(2000);    /*To be removed in flight model*/
             gFLAGS = gFLAGS & (~NEW_TC_RECEIVED);
             gFLAGS = gFLAGS | COM_MNG_TMTC_RUNNING_FLAG;
 
--- a/main.cpp	Mon Feb 29 13:21:40 2016 +0000
+++ b/main.cpp	Thu Mar 10 15:26:50 2016 +0000
@@ -5,7 +5,9 @@
 uint8_t rcv_isr = 0; // flag for interrupt
 
 #define DEBUG 1
-#define SDCARD 0
+#define SDCARD 1
+#define I2C_PL 0
+
 
 #include "SimpleDMA.h"
 #include "dmaSPIslave.h"
@@ -47,13 +49,14 @@
 //    gRX_CURRENT_PTR = gRX_CURRENT_DATA_NODE->values;
     RX1M.attach(&rx_read, Serial::RxIrq);
     
+    #if I2c
     //I2C to Payload    (depends on pl interrupt design)
     PYLD_I2C_Int.rise(&isr_pyldtm);
-    
+    #endif
     
     // DEBUG
     //gPC.puts("welcome to mng_tm_tc\r\n");
-    gPC.baud(1200);
+    gPC.baud(115200);
     
     // COMMON SPI
     spi.format(8,0);
@@ -108,6 +111,7 @@
     {delete gSCIENCE_THREAD;
     break;}
     }*/
+    #if I2c
     int i =0 ;
     char test[1] ;
     test[0] = 7;
@@ -128,7 +132,7 @@
         }
         
     }
-   
+    #endif
     while(true){
         Thread::wait(osWaitForever);
         //state = gCOM_MNG_TMTC_THREAD->get_state() + '0';