Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of COM_MNG_TMTC_SIMPLE_pl123 by
Revision 99:efde3df6cd94, committed 2016-01-26
- Comitter:
- ee12b079
- Date:
- Tue Jan 26 12:18:53 2016 +0000
- Parent:
- 98:fd99ddc0e0a1
- Child:
- 100:484a687431cc
- Commit message:
- DATA checked for one fsc, with one OBSRS telecommand
Changed in this revision
--- a/Compression.h Tue Jan 26 10:05:19 2016 +0000
+++ b/Compression.h Tue Jan 26 12:18:53 2016 +0000
@@ -55,9 +55,10 @@
unsigned char position_tm_frame[3] = {8,11,5} , position_tm_starting[3] = {8,11,5}; //{sc,sf-bt,sf-at}
unsigned char id; //sf = 0,sc-at = 1,sc-bt = 2;
unsigned char TM_interleave_data[512] , TM_convoluted_data[270] = {0};
-int proton_scp_sum,electron_scp_sum,length, temp_crc,attitude = 0,FSC_science = 0,debug_cntr = 0, size,space;
+int proton_scp_sum,electron_scp_sum,length, temp_crc,attitude = 0,FSC_science = 1,debug_cntr = 0, size,space;
unsigned char *ptr ,* pointer;
long long int sci_time = 0x221000000; //call some function and get the time or get in the starting, what ever akshay says
+int test_cntr = 0;
Convolution ConvObj;
void convolution (unsigned char * ptr){
@@ -279,7 +280,7 @@
if(id == 1){ //below thereshold
space = adjust(1,0,pointer,8);
space = adjust(4,3,pointer,space);
- //FSC_science = FCTN_SD_MNGR(3);
+ FSC_science = FCTN_SD_MNGR(3);
//gPC.printf("SID = 3, FSC = %02X\r\n", FSC_science);
frames[id][1] = (FSC_science>>24)&0xff;
frames[id][2] = (FSC_science>>16)&0xff;
@@ -293,7 +294,8 @@
}else if(id == 2){
space = adjust(1,0,pointer,8);
space = adjust(4,2,pointer,space);
- //FSC_science = FCTN_SD_MNGR(2);
+// FSC_science = FCTN_SD_MNGR(2);
+
//gPC.printf("SID = 2, FSC = %02X\r\n", FSC_science);
frames[id][1] = (FSC_science>>16)&0xff;
frames[id][2] = (FSC_science>>8)&0xff;
@@ -302,13 +304,22 @@
temp_crc = crc16_gen(frames[id],132);
frames[id][132] = temp_crc>>8;
frames[id][133] = temp_crc & 0xff;
+ /*if(test_cntr++ == 0){
+ gPC.puts("frame start\r\n");
+ for(int i = 0; i<134; i++){
+ gPC.printf("%02X",frames[id][i]);
+ }
+ gPC.puts("frame ends\r\n");
+ }*/
+ exor(frames[id]);
convolution(frames[id]);
interleave(TM_convoluted_data,TM_interleave_data);
interleave(TM_convoluted_data+ 135,TM_interleave_data + 144);
if(id == 1)
- /*SD_WRITE(TM_interleave_data,FSC_science,3)*/;
+ SD_WRITE(TM_interleave_data,FSC_science,3);
else if (id == 2)
- /*SD_WRITE(TM_interleave_data,FSC_science,2)*/;
+ SD_WRITE(TM_interleave_data,FSC_science,2);
+ FSC_science++; //remove this after testing
position_tm_frame[id] = position_tm_starting[id];
frames[id][6-id] = (length-1) - j; // first head pointer.
}
@@ -562,7 +573,7 @@
pointer = frames[id];
space = adjust(1,0,pointer,8);
space = adjust(4,1,pointer,space);
- //FSC_science = FCTN_SD_MNGR(1);
+ FSC_science = FCTN_SD_MNGR(1);
//gPC.printf("SID = 1, FSC = %02X\r\n", FSC_science);
frames[id][1] = (FSC_science>>16)&0xff;
frames[id][2] = (FSC_science>>8)&0xff;
@@ -573,10 +584,11 @@
temp_crc = crc16_gen(frames[id],132);
frames[id][132] = temp_crc>>8;
frames[id][133] = temp_crc & 0xff;
+ exor(frames[id]);
convolution(frames[id]);
interleave(TM_convoluted_data,TM_interleave_data);
interleave(TM_convoluted_data+ 135,TM_interleave_data + 144);
- /*SD_WRITE(TM_interleave_data,FSC_science,1);*/
+ SD_WRITE(TM_interleave_data,FSC_science,1);
position_tm_frame[id] = position_tm_starting[id];
frames[id][4] = (length-1) - j;
}
--- a/OBSRS.h Tue Jan 26 10:05:19 2016 +0000
+++ b/OBSRS.h Tue Jan 26 12:18:53 2016 +0000
@@ -438,7 +438,7 @@
// }
//int write_success = SD_WRITE(write_buffer,FSC + block_counter,SID);
// wait_ms(8);
- //read_success = SD_READ(buffer_512, FSC + block_counter,SID);
+ read_success = SD_READ(buffer_512, FSC + block_counter,SID);
// wait_ms(8);
// cout<<"read_success = "<<read_success<<ENDL<<"\r\n";
// cout<<"write_success = "<<write_success<<ENDL;
@@ -447,7 +447,7 @@
// }
}
else{
- /*read_success = SD_READ(buffer_512, list_of_FSC[block_counter],SID)*/;
+ read_success = SD_READ(buffer_512, list_of_FSC[block_counter],SID);
}
ack_code = read_success;
block_counter++;
@@ -494,7 +494,6 @@
// short_TC = true;
//pc.printf("WELCOME\n\r");
- //FCTN_CDMS_SD_INIT();/* sd card initialization*/
// SID = 0x0;
// FSC =10;
// no_of_frames =1;
@@ -526,8 +525,8 @@
list_of_FSC[i] = tcp->TC_string[4+i];
}
}
- //gPC.printf("sid = %u \r\n",SID);
- //gPC.printf("FSC = %u\r\n",FSC);
+ gPC.printf("sid = %u \r\n",SID);
+ gPC.printf("FSC = %u\r\n",FSC);
gPC.puts("exit_sdcard");
// SID = 0x0;
// FSC = 10;
--- a/cdms_sd.h Tue Jan 26 10:05:19 2016 +0000
+++ b/cdms_sd.h Tue Jan 26 12:18:53 2016 +0000
@@ -307,7 +307,9 @@
cmd58();
cmd(55, 0);
if (cmd(41, 0x40000000) == 0) {
-// printf("\rv2 initialization successfull\r\n");
+ #if DEBUG
+ gPC.puts("\rv2 initialization successfull\r\n");
+ #endif
cmd58();
debug_if(SD_DBG, "\n\rInit: SDCARD_V2\n\r");
cdv = 1;
--- a/main.cpp Tue Jan 26 10:05:19 2016 +0000
+++ b/main.cpp Tue Jan 26 12:18:53 2016 +0000
@@ -2,12 +2,7 @@
#include "mbed.h"
-//#define DEBUG_DEF 1
-//
-//#define DEBUF_PRINT(x) \
-// #ifdef DEBUG_DEF \
-// gPC.puts(x);\
-// #endif
+#define DEBUG 1
#include "rtos.h"
#include "mbed_debug.h"
@@ -17,11 +12,9 @@
#include "crc.h"
#include "COM_SND_TM_functions.h"
#include "COM_SND_TM.h"
-//#include "SDCread.h"
-//#include "cdms_sd.h"
+#include "cdms_sd.h"
#include "OBSRS.h"
#include "adf.h"
-//#include "SDC_init.h"
#include "COM_RCV_TC.h"
#include "COM_MNG_TMTC.h"
#include "COM_POWER_ON_TX.h"
@@ -29,8 +22,6 @@
#include "Compression.h"
#include "ThreadsAndFunctions.h"
-InterruptIn inr(PTA13);
-
void set_sig(){gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL);}
int main()
{
@@ -60,7 +51,7 @@
gCS_ADF = 1;
//FCTN_CDMS_INIT_RTC();/* rtc initialization*/
-// FCTN_CDMS_SD_INIT();/* sd card initialization*/
+ FCTN_CDMS_SD_INIT();/* sd card initialization*/
// initialise_card();
// int result= initialise_card();
@@ -74,11 +65,15 @@
// COM_MNG_TMTC THREAD
gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN);
gCOM_MNG_TMTC_THREAD->set_priority(osPriorityAboveNormal);
+ #if DEBUG
gPC.puts("allocating threads\r\n");
+ #endif
gSCIENCE_THREAD = new Thread(SCIENCE_FUN);
// gPC.puts("step one complete\r\n");
gSCIENCE_THREAD->set_priority(osPriorityBelowNormal);
+ #if DEBUG
gPC.puts("competed allocating threads\r\n");
+ #endif
// *******************INITIALISATIONS END********************
/*starting the thread with signal*/
