
Repository for CDMS code
Dependencies: SimpleDMA mbed-rtos mbed eeprom
Fork of COM_MNG_TMTC_SIMPLE by
Revision 55:39e59903bc3a, committed 2016-01-14
- Comitter:
- ee12b079
- Date:
- Thu Jan 14 15:00:25 2016 +0000
- Parent:
- 54:199040d70b17
- Child:
- 57:bf998cb2a104
- Commit message:
- Incomplete, use revision 53 for integrating or testing
Changed in this revision
--- a/COM_MNG_TMTC.h Thu Jan 14 13:26:40 2016 +0000 +++ b/COM_MNG_TMTC.h Thu Jan 14 15:00:25 2016 +0000 @@ -409,7 +409,7 @@ // CDMS TEAM CODE START inline Base_tm* FCTN_CDMS_RLY_TMTC(Base_tc *tc_ptr){ uint8_t ACKCODE = 0x00; - printf("\rTC execution in progress\r\n"); + //printf("\rTC execution in progress\r\n"); Base_tm *tm_pointer = new Long_tm; Base_tm *tm_ptr = tm_pointer; received = 0; @@ -417,15 +417,15 @@ { case 1: //apid=01 implies it corresponds to bae { - printf("Telecommand is for BAE\r\n"); - printf("Sending TC to BAE...\r\n"); //interrupt to be sent to the bae + //printf("Telecommand is for BAE\r\n"); + //printf("Sending TC to BAE...\r\n"); //interrupt to be sent to the bae FCTN_I2C_WRITE((char*)tc_ptr->TC_string); while(1) { wait(1); //TimeOut instead of wait if(tm_status_4m_slv == 1) { - printf("receiving...\r\n"); + //printf("receiving...\r\n"); FCTN_I2C_READ((char*)tm_pointer->TM_string); //printf("%s", tm_pointer->TM_string); received+=1; @@ -439,11 +439,11 @@ } if(received >= 1 ) { - printf("Telemetry is received from BAE\r\n"); + //printf("Telemetry is received from BAE\r\n"); Base_tm *tm_print = tm_ptr; for(uint8_t i=0;i<received;i++) { - printf("%s", tm_print->TM_string); + //printf("%s", tm_print->TM_string); tm_print = tm_print->next_TM; //for check } received = 0; @@ -451,7 +451,7 @@ } else { - printf("Telemetry is not received from BAE\r\n"); + //printf("Telemetry is not received from BAE\r\n"); //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -471,17 +471,17 @@ } case 2: { - printf("Telecommand is for CDMS\r\n"); //apid = 10 corresponds to cdms + //printf("Telecommand is for CDMS\r\n"); //apid = 10 corresponds to cdms switch(GETservice_type(tc_ptr)) { case 0x60: { - printf("service:MMS\r\n"); + //printf("service:MMS\r\n"); switch(GETservice_subtype(tc_ptr)) { case 0x1: { - printf("sub_service:Read from RAM_Memory\r\n"); + //printf("sub_service:Read from RAM_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); @@ -505,7 +505,7 @@ } 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); @@ -529,7 +529,7 @@ } case 0x5: { - printf("WRITE ON FLASH_MEMORY\r\n"); + //printf("WRITE ON FLASH_MEMORY\r\n"); mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]); block = (((uint32_t)(tc_ptr->TC_string[5])<<24)|((uint32_t)(tc_ptr->TC_string[5])<<16)|((uint32_t)(tc_ptr->TC_string[5])<<8)|((uint32_t)(tc_ptr->TC_string[5]))); FCTN_CDMS_WR_FLASH(mid,block); @@ -551,7 +551,7 @@ } default: { - printf("INVALID TC\r\n"); //Send Invalid TC Telemetry + //printf("INVALID TC\r\n"); //Send Invalid TC Telemetry //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -572,12 +572,12 @@ } case 0x8: { - printf("service:FUNCTION MANAGEMENT SERVICE\r\n"); + //printf("service:FUNCTION MANAGEMENT SERVICE\r\n"); if(GETservice_subtype(tc_ptr)==0x1) { if(GETpid(tc_ptr)==0x01) { - printf("TC_PL_INIT\r\n"); // call PWR_SWCH_ON function + //printf("TC_PL_INIT\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -594,7 +594,7 @@ } else if(GETpid(tc_ptr)==0x02) { - printf("TC_PL_MAIN\r\n"); // call PWR_SWCH_ON function + //printf("TC_PL_MAIN\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -611,7 +611,7 @@ } else if(GETpid(tc_ptr)==0x03) { - printf("TC_COM_INIT\r\n"); // call PWR_SWCH_ON function + //printf("TC_COM_INIT\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -628,7 +628,7 @@ } else if(GETpid(tc_ptr)==0x04) { - printf("TC_CDMS_HK_MAIN\r\n"); // call PWR_SWCH_ON function + //printf("TC_CDMS_HK_MAIN\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -645,7 +645,7 @@ } else if(GETpid(tc_ptr)==0x11) { - printf("TC_SW_ON_SD\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_ON_SD\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -662,7 +662,7 @@ } else if(GETpid(tc_ptr)==0x12) { - printf("TC_SW_ON_RTC\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_ON_RTC\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -679,7 +679,7 @@ } else if(GETpid(tc_ptr)==0x13) { - printf("TC_SW_ON_BAE\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_ON_BAE\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -696,7 +696,7 @@ } else if(GETpid(tc_ptr)==0x14) { - printf("TC_SW_ON_PL_DL\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_ON_PL_DL\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -713,7 +713,7 @@ } else if(GETpid(tc_ptr)==0x15) { - printf("TC_SW_ON_PL_AG_HV\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_ON_PL_AG_HV\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -730,7 +730,7 @@ } else if(GETpid(tc_ptr)==0x16) { - printf("TC_SW_ON_V_A_EN\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_ON_V_A_EN\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -747,7 +747,7 @@ } else if(GETpid(tc_ptr)==0x21) { - printf("TC_SW_OFF_SD\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_OFF_SD\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -764,7 +764,7 @@ } else if(GETpid(tc_ptr)==0x22) { - printf("TC_SW_OFF_RTC\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_OFF_RTC\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -781,7 +781,7 @@ } else if(GETpid(tc_ptr)==0x23) { - printf("TC_SW_OFF_BAE\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_OFF_BAE\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -798,7 +798,7 @@ } else if(GETpid(tc_ptr)==0x24) { - printf("TC_SW_OFF_PL_DL\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_OFF_PL_DL\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -815,7 +815,7 @@ } else if(GETpid(tc_ptr)==0x25) { - printf("TC_SW_OFF_PL_AG_HV\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_OFF_PL_AG_HV\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -832,7 +832,7 @@ } else if(GETpid(tc_ptr)==0x26) { - printf("TC_SW_OFF_V_A_EN\r\n"); // call PWR_SWCH_ON function + //printf("TC_SW_OFF_V_A_EN\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -849,7 +849,7 @@ } else if(GETpid(tc_ptr)==0x31) { - printf("TC_RST_SD\r\n"); // call PWR_SWCH_ON function + //printf("TC_RST_SD\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -866,7 +866,7 @@ } else if(GETpid(tc_ptr)==0x32) { - printf("TC_RST_RTC\r\n"); // call PWR_SWCH_ON function + //printf("TC_RST_RTC\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -883,7 +883,7 @@ } else if(GETpid(tc_ptr)==0x33) { - printf("TC_RST_BAE\r\n"); // call PWR_SWCH_ON function + //printf("TC_RST_BAE\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -900,7 +900,7 @@ } else if(GETpid(tc_ptr)==0x34) { - printf("TC_RST_PL_DL\r\n"); // call PWR_SWCH_ON function + //printf("TC_RST_PL_DL\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -918,7 +918,7 @@ } else if(GETpid(tc_ptr)==0xC1) { - printf("RESET_HK_COUNTER\r\n"); // call PWR_SWCH_ON function + //printf("RESET_HK_COUNTER\r\n"); // call PWR_SWCH_ON function //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -935,7 +935,7 @@ } else if(GETpid(tc_ptr)==0xF1) { - printf("RD_RTC\r\n"); //call RD_RTC + //printf("RD_RTC\r\n"); //call RD_RTC //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xD0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -956,7 +956,7 @@ } else { - printf("INVALID TC\r\n"); + //printf("INVALID TC\r\n"); //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -978,7 +978,7 @@ } default: { - printf("INVALID TC"); //send invalid TC TM + //printf("INVALID TC"); //send invalid TC TM //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -999,7 +999,7 @@ } case 3: { - printf("Telecommand is for PL\r\n"); + //printf("Telecommand is for PL\r\n"); // printf("Informing PL about TC using I2C\r\n"); //interrupt to be sent to the bae // FCTN_I2C_WRITE((char*)tc_ptr->TC_string); // printf("sent the Telecommand to BAE\r\n"); //packet along with crc will be sent when bae is ready @@ -1019,7 +1019,7 @@ } default: //invalid TC { - printf("INVALID TC\r\n"); + //printf("INVALID TC\r\n"); //tm_pointer = new Short_tm; tm_pointer->TM_string[0] = 0xB0; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); @@ -1224,7 +1224,7 @@ length = TM_LONG_SIZE;\ }\ for(int i = 0 ; i < length ; ++i){\ - gPC.putc(obosc_tm_current->TM_string[i]);\ + /*gPC.putc(obosc_tm_current->TM_string[i]);*/\ }\ obosc_tm_current = obosc_tm_current->next_TM;\ }\
--- a/COM_POWER_ON_TX.h Thu Jan 14 13:26:40 2016 +0000 +++ b/COM_POWER_ON_TX.h Thu Jan 14 15:00:25 2016 +0000 @@ -81,7 +81,7 @@ }\ /*gPC.puts("Printing Call Sign, ACK_L1, TC_LIST inside COM_POWER_ON\r\n");*/\ for(int i = 0 ; i < length ; ++i){\ - gPC.putc(power_on_tm->TM_string[i]);\ + /*gPC.putc(power_on_tm->TM_string[i]);*/\ }\ power_on_tm = power_on_tm->next_TM;\ }\
--- a/SDC_init.h Thu Jan 14 13:26:40 2016 +0000 +++ b/SDC_init.h Thu Jan 14 15:00:25 2016 +0000 @@ -88,7 +88,7 @@ return initialise_card_v2(); } else if (r == (R1_IDLE_STATE | R1_ILLEGAL_COMMAND)) { - printf("Entering v1 bro\n"); + //printf("Entering v1 bro\n"); return initialise_card_v1(); } else {
--- a/SDCread.h Thu Jan 14 13:26:40 2016 +0000 +++ b/SDCread.h Thu Jan 14 15:00:25 2016 +0000 @@ -172,7 +172,7 @@ last_block = false; last_buffer = true; - printf("?\r\n"); + //printf("?\r\n"); break; } }
--- a/ThreadsAndFunctions.h Thu Jan 14 13:26:40 2016 +0000 +++ b/ThreadsAndFunctions.h Thu Jan 14 15:00:25 2016 +0000 @@ -103,6 +103,7 @@ } else if( gFLAGS & NEW_TC_RECEIVED ){ /*gPC.puts("NEW TC RECEIVED\r\n");*/ + Thread::wait(7000); gFLAGS = gFLAGS & (~NEW_TC_RECEIVED); gFLAGS = gFLAGS | COM_MNG_TMTC_RUNNING_FLAG; @@ -166,16 +167,16 @@ } } else{ - gPC.puts("tc list is not complete\r\n"); + //gPC.puts("tc list is not complete\r\n"); if(tempContinue & 0x01){ - gPC.puts("last packet bit not found\r\n"); + //gPC.puts("last packet bit not found\r\n"); } if( tempContinue & 0x02 ){ - gPC.puts("missing psc found\r\n"); + //gPC.puts("missing psc found\r\n"); } - gPC.printf("crc fail tc = %u\r\n", gTOTAL_CRC_FAIL_TC); - gPC.printf("incorrect size tc = %u\r\n", gTOTAL_INCORRECT_SIZE_TC); - gPC.printf("repeated psc = %u\r\n", gTOTAL_REPEATED_TC); + //gPC.printf("crc fail tc = %u\r\n", gTOTAL_CRC_FAIL_TC); + //gPC.printf("incorrect size tc = %u\r\n", gTOTAL_INCORRECT_SIZE_TC); + //gPC.printf("repeated psc = %u\r\n", gTOTAL_REPEATED_TC); Base_tc *test_tc = gHEAD_NODE_TCL; while( test_tc != NULL ){ int length = 0; @@ -186,12 +187,12 @@ length = TC_LONG_SIZE; } for(int i = 0 ; i < length ; ++i ){ - gPC.printf("%x ", test_tc->TC_string[i]); + //gPC.printf("%x ", test_tc->TC_string[i]); } - gPC.puts("\r\n"); + //gPC.puts("\r\n"); test_tc = test_tc->next_TC; } - gPC.puts("\r\n"); + //gPC.puts("\r\n"); COM_POWER_ON_TX; // PENDING : POWER OFF TX RX1M.attach(&rx_read, Serial::RxIrq);
--- a/adf.h Thu Jan 14 13:26:40 2016 +0000 +++ b/adf.h Thu Jan 14 15:00:25 2016 +0000 @@ -109,11 +109,11 @@ else{\ hardware_reset(0);\ hw_reset_err_cnt++;\ - gPC.puts("Resetting hardware\r\n");\ + /*gPC.puts("Resetting hardware\r\n");*/\ }\ }\ if( flag == false ){\ - gPC.puts("Seems to be SPI problem\r\n");\ + /*gPC.puts("Seems to be SPI problem\r\n");*/\ }\ assrt_phy_off(tempReturn);\ if(!bbram_flag){\ @@ -232,7 +232,7 @@ buffer_state = !buffer_state;\ if(last_buffer){\ finish_write_data = true;\ - gPC.puts("adf_off\r\n");\ + /*gPC.puts("adf_off\r\n");*/\ }\ } @@ -307,7 +307,7 @@ spi.write(0xB1);\ gCS_ADF=1;\ SPI_mutex.unlock();\ - gPC.puts("transmission done\r\n");\ + /*gPC.puts("transmission done\r\n");*/\ loop_on = false;\ }else{\ write_data;\ @@ -318,7 +318,7 @@ } void read_TC(Base_tc* TC_ptr){ - gPC.puts("Inside sd card sending\r\n"); + //gPC.puts("Inside sd card sending\r\n"); unsigned char service_subtype = 0; uint64_t starting_add = 0, ending_add = 0; service_subtype = (TC_ptr->TC_string[2])&0x0f; @@ -327,7 +327,7 @@ starting_add = 10; // for now ending_add = 20; // adf_SND_SDCard(starting_add , ending_add); - gPC.puts("sending from sd card\r\n"); + //gPC.puts("sending from sd card\r\n"); adf_SND_SDCard; } @@ -338,9 +338,9 @@ loop_on = true;\ ADF_off = false;\ initial_adf_check;\ - gPC.puts("initial adf check\r\n");\ + /*gPC.puts("initial adf check\r\n");*/\ initiate;\ - gPC.puts("adf configured\r\n");\ + /*gPC.puts("adf configured\r\n");*/\ gLEDR = !gLEDR;\ } @@ -360,7 +360,7 @@ gCS_ADF=1;\ SPI_mutex.unlock();\ loop_on = false;\ - gPC.puts("Transmission done\r\n");\ + /*gPC.puts("Transmission done\r\n");*/\ }\ else{\ ADF_off = true;\ @@ -371,5 +371,5 @@ }\ }\ }\ - gPC.puts("after while loop\r\n");\ + /*gPC.puts("after while loop\r\n");*/\ } \ No newline at end of file
--- a/i2c.h Thu Jan 14 13:26:40 2016 +0000 +++ b/i2c.h Thu Jan 14 15:00:25 2016 +0000 @@ -28,7 +28,7 @@ if (write_ack == 1) { led2 = 1; - printf("\n\r data not sent \n"); + //printf("\n\r data not sent \n"); led2 = 0; } irpt_2_slv = 0; @@ -49,7 +49,7 @@ if (read_ack == 1) { led2 = 1; - printf("\n \r data not received \n"); + //printf("\n \r data not received \n"); led2 = 0; } //if(read_ack == 1)
--- a/main.cpp Thu Jan 14 13:26:40 2016 +0000 +++ b/main.cpp Thu Jan 14 15:00:25 2016 +0000 @@ -32,7 +32,7 @@ RX1M.attach(&rx_read, Serial::RxIrq); // DEBUG - gPC.puts("welcome to mng_tm_tc\r\n"); + //gPC.puts("welcome to mng_tm_tc\r\n"); gPC.baud(1200); // COMMON SPI