June 30

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Files at this revision

API Documentation at this revision

Comitter:
krishanprajapat
Date:
Mon Apr 11 16:04:55 2016 +0000
Parent:
150:fa3940954b1e
Child:
161:a63672bf4423
Child:
163:e4ff6c00faa2
Child:
168:087d16523507
Commit message:
ack L1 (waitting ) problems solved

Changed in this revision

COM_MNG_TMTC.h Show annotated file Show diff for this revision Revisions of this file
OBSRS.h Show annotated file Show diff for this revision Revisions of this file
--- a/COM_MNG_TMTC.h	Wed Apr 06 13:11:15 2016 +0000
+++ b/COM_MNG_TMTC.h	Mon Apr 11 16:04:55 2016 +0000
@@ -299,9 +299,9 @@
                                     //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);
@@ -310,7 +310,7 @@
                                     {
                                         tm_pointer->TM_string[3+i] = (uint8_t)((Data[1]>>(8*i))&0x00FF);
                                     }
-                                    crc16 = crc16_gen(tm_ptr->TM_string,9);
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
                                     tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
                                     tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
                                 tm_pointer->next_TM = NULL;                 return tm_ptr;
--- a/OBSRS.h	Wed Apr 06 13:11:15 2016 +0000
+++ b/OBSRS.h	Mon Apr 11 16:04:55 2016 +0000
@@ -500,6 +500,16 @@
             if(create_Ack_andcallsign){
 /*                gPC.printf("cr ack\r\n");*/
                 enable_SCH = true;
+                uint8_t temp2 = TC_STATE_SUCCESSFULLY_EXECUTED; // see all the possible cases
+                PUTexec_status(current_obsrs_tc, temp2);
+                if( (GETexec_status(current_obsrs_tc) == TC_STATE_EXECUTION_FAILED) && (GETabort_on_nack(current_obsrs_tc) == 1) ){
+                                gMASTER_STATE = TCL_STATE_ABORTED;
+                }
+                else if( GETpacket_seq_count(current_obsrs_tc) == (gTOTAL_VALID_TC-1) ){
+                    gMASTER_STATE = TCL_STATE_COMPLETED;
+                }
+                
+                
                 create_Ack_andcallsign = false;
                 Base_tm *ack_and_callsign = NULL;
                 Base_tm *ack_head = NULL;
@@ -515,14 +525,9 @@
                 T_frame_in_Ackandcallsign = 2*snd_tm.make_shor_tm();
 /*                gPC.printf(" T_frame_in_Ackandcallsign = %d\r\n",T_frame_in_Ackandcallsign);*/
                 Base_tm *ack_l234 = ack_and_callsign->next_TM;
-                uint8_t temp2 = TC_STATE_SUCCESSFULLY_EXECUTED; // see all the possible cases
-                PUTexec_status(current_obsrs_tc, temp2);
-                if( (GETexec_status(current_obsrs_tc) == TC_STATE_EXECUTION_FAILED) && (GETabort_on_nack(current_obsrs_tc) == 1) ){
-                                gMASTER_STATE = TCL_STATE_ABORTED;
-                }
-                else if( GETpacket_seq_count(current_obsrs_tc) == (gTOTAL_VALID_TC-1) ){
-                    gMASTER_STATE = TCL_STATE_COMPLETED;
-                }
+                
+                ack_and_callsign = ack_head->next_TM;
+                
                 if( GETshort_or_long_tm(ack_l234) == SHORT_TM_CODE ){
                     for(int i = 0 ; i < TM_SHORT_SIZE ; ++i){
                         gLAST_TM[i] = ack_l234->TM_string[i];
@@ -535,7 +540,6 @@
                         gLAST_TM_SHORT_OR_LONG = LONG_TM_CODE;
                     }
                 }
-                ack_and_callsign = ack_head->next_TM;
                 
 /*                gPC.printf("ex cr ack\r\n");*/
             }    
@@ -592,11 +596,13 @@
                    enable_T_frame = true;
                    enable_SCH = true;
                 }
-                else if(ack_code == 0x85){
+                else if(read_success == 1){
+                    ack_code = 0x85;
                     gPC.printf("Hardware failure");
                     enable_T_frame = false;
                 }
-                else if(ack_code == 0x86){
+                else if(read_success == 2){
+                    ack_code = 0x86;
                     gPC.printf("Invalid FSC");
                     enable_T_frame = false;
                 }