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: SimpleDMA eeprom mbed-rtos mbed
Fork of CDMS_CODE_FM_28JAN2017 by
Diff: CDMS_HK.h
- Revision:
- 308:7c3872365d58
- Parent:
- 305:beb148fe97dc
- Child:
- 309:6ed5535ac465
--- a/CDMS_HK.h Sat Sep 10 07:06:59 2016 +0000
+++ b/CDMS_HK.h Sun Oct 09 07:08:34 2016 +0000
@@ -63,8 +63,8 @@
FCTN_CDMS_PL_MAIN((void const *)NULL);
hk_count = 2;
}
- gPC.printf("\n\rEntering HK thread\n");
-
+ // gPC.printf("\n\rEntering HK thread\n");
+ gPC.printf("\n\r%d\n",CDMS_WR_SD_FAULT_COUNTER);
if(EN_CDMS_HK == 0x00)
continue;
CDMS_HK_MAIN_STATUS = 0x01;
@@ -72,7 +72,7 @@
FCTN_CDMS_HK(); //collects temperatures
RSSI_volatge = COMRX_RSSI_volatge.read() * 3.3;//to be checked
- gPC.printf("\n\rRSSI voltage = %f",RSSI_volatge);
+ //gPC.printf("\n\rRSSI voltage = %f",RSSI_volatge);
VERIFY_COMRX();
VERIFY_RTC();
HANDLE_HW_FAULTS();
@@ -117,18 +117,18 @@
uint64_t time = FCTN_CDMS_RD_RTC() >> 7; //Reading Time from RTC
for(int i = 124; i<128; i++)
CDMS_HEALTH_DATA[i] = time >> i*8;
- gPC.printf("0x%d\n",time);
- //FCTN_SD_MNGR(); //Adding FSC & TMID to TM frame
+ //gPC.printf("0x%d\n",time);
+ FCTN_SD_MNGR(); //Adding FSC & TMID to TM frame
CDMS_HK_FRAME[0] = 0x20;
CDMS_HK_FRAME[1] = FSC_CURRENT[4]+1;
CDMS_HK_FRAME[2] = (FSC_CURRENT[4]+1) >> 8;
CDMS_HK_FRAME[3] = (FSC_CURRENT[4]+1) >> 16;
- gPC.printf("\n");
+ // gPC.printf("\n");
for(int i = 0; i<128; i++){ /*Adding actual CDMS Health data to TM frame*/
CDMS_HK_FRAME[i+4] = CDMS_HEALTH_DATA[i];
- gPC.printf("%02x",CDMS_HEALTH_DATA[i]);
+ //gPC.printf("%02x",CDMS_HEALTH_DATA[i]);
}
- gPC.printf("\n");
+ // gPC.printf("\n");
uint16_t crc = crc16_gen(CDMS_HK_FRAME,132); /*Adding CRC to TM frame*/
CDMS_HK_FRAME[133] = crc;
CDMS_HK_FRAME[132] = crc >> 8;
@@ -136,27 +136,29 @@
exor(CDMS_HK_FRAME);
CDMS_HEALTH.convolutionEncode(CDMS_HK_FRAME , convoluted_CDMS_HK);
CDMS_HEALTH.convolutionEncode(CDMS_HK_FRAME + 67, convoluted_CDMS_HK + 135);
+ //gPC.printf("\n\r reached here");
interleave(convoluted_CDMS_HK , interleave_CDMS_HK);
interleave(convoluted_CDMS_HK +135, interleave_CDMS_HK + 144);
+ //gPC.printf("\n\r reached here");
for(int i=0; i<288; i++)
CDMS_HEALTH_FINAL[i] = interleave_CDMS_HK[i];
-
+ //gPC.printf("\n\r reached here");
sd_stat = SD_WRITE(CDMS_HEALTH_FINAL,FSC_CURRENT[4]+1,4);
if(sd_stat)
{
- gPC.puts("sd write failure");
+ gPC.puts("sd write failure $*&^@!~!");
// break;
}
- gPC.printf("Completed CDMS HK\t");
+ // gPC.printf("Completed CDMS HK\t");
/*---------------------------------- BAE HK --------------------------------------------*/
BAE_HK_I2C = FCTN_I2C_READ(BAE_HK,134);
- gPC.printf("Entering BAE HK\t");
+ // gPC.printf("Entering BAE HK\t");
if(BAE_HK_I2C == 0) {
crc = crc16_gen((unsigned char *)BAE_HK,132);
if(crc == ((uint16_t)BAE_HK[132] << 8) | (uint16_t)BAE_HK[133]){
- gPC.printf("BAE HK data recieved through I2C\t");
+ //gPC.printf("BAE HK data recieved through I2C\t");
TIME_LATEST_I2C_BAE = FCTN_CDMS_RD_RTC() >> 7;
/*for(int i = 0; i<15; i++)
gPC.printf("\r 0x%02X\n",BAE_HK[i]);*/
@@ -191,7 +193,7 @@
for(int i = 0; i<134; i++)
BAE_HK[i] = 0;
}
- gPC.printf("Completed BAE HK\n");
+ // gPC.printf("Completed BAE HK\n");
/*----------------------------------Beacon message--------------------------------------*/
@@ -228,10 +230,10 @@
bool y;
y = FCTN_I2C_WRITE((char *)beacon_array,134);
if(y == 0)
- gPC.printf("long Bcn sent\n\r");
+ gPC.printf("long Bcn sent\n\r");
else
gPC.printf("long Bcn not sent\r\n");
- gPC.printf("\rCompleted Beacon\n");
+ //gPC.printf("\rCompleted Beacon\n");
gMutex.unlock();
}
}
@@ -280,13 +282,13 @@
{
int Iteration=0;
- int resistance;
+ float resistance;
SelectLinec0=0;
SelectLinec1=0;
SelectLinec2=0;
SelectLinec3=0;
- gPC.printf("\r%d %d %d %d\n",SelectLinec3.read(),SelectLinec2.read(),SelectLinec1.read(),SelectLinec0.read());
+ //gPC.printf("\r%d %d %d %d\n",SelectLinec3.read(),SelectLinec2.read(),SelectLinec1.read(),SelectLinec0.read());
for(Iteration=0; Iteration<16; Iteration++) {
actual_data.temp_actual[Iteration]=TempInput.read();
@@ -298,25 +300,25 @@
SelectLinec2=!(SelectLinec2);
if(Iteration%8==7)
SelectLinec3=!(SelectLinec3);
- gPC.printf("\r%d %d %d %d\n",SelectLinec3.read(),SelectLinec2.read(),SelectLinec1.read(),SelectLinec0.read());
+ //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);
+// 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*2;
+ actual_data.temp_actual[Iteration]=actual_data.temp_actual[Iteration]*3.3*20;
else if(Iteration<14){
- resistance=10000*actual_data.temp_actual[Iteration]*3.3/(3.3-actual_data.temp_actual[Iteration]*3.3);
+ resistance=24300*actual_data.temp_actual[Iteration]*3.3/(3.3-actual_data.temp_actual[Iteration]*3.3);
if(actual_data.temp_actual[Iteration]*3.3<1.47) //Document says 1.378 .Pls Check
- actual_data.temp_actual[Iteration]=3694/log(24.032242*resistance);
+ actual_data.temp_actual[Iteration]=3694/log(24.032242*resistance/10);
else
- actual_data.temp_actual[Iteration]=3365.4/log(7.60573*resistance);
+ actual_data.temp_actual[Iteration]=3365.4/log(7.60573*resistance/10);
}
else
actual_data.temp_actual[Iteration]=(-90.7*3.3*actual_data.temp_actual[Iteration])+190.1543;
@@ -365,7 +367,7 @@
GPIO_STATUS=(COM_RX_CNTRL)?(GPIO_STATUS)|((uint16_t)(0x1<<3)):(GPIO_STATUS)&(~((uint16_t)(0x1<<3)));
//EPS_V_D_EN_STATUS
GPIO_STATUS=(COM_TX_CNTRL)?(GPIO_STATUS)|((uint16_t)(0x1<<2)):(GPIO_STATUS)&(~((uint16_t)(0x1<<2)));
- gPC.printf("%04x\n",GPIO_STATUS);
+ // gPC.printf("%04x\n",GPIO_STATUS);
}
void VERIFY_COMRX()
@@ -512,9 +514,9 @@
void COLLECT_CDMS_RAM()
{
CDMS_RAM[0] = ((PL_INIT_STATUS<<7)&0x80)|((PL_MAIN_status<<6)&0x40)|((PL_LOW_power<<5)&0x20)|((PL_STATE<<3)&0x18)|(PL_STATUS&0x07);
- gPC.printf("\n\rPL_STATUS : %d",PL_STATUS);
- gPC.printf("\n\rPL_STATE : %d",PL_STATE);
- gPC.printf("\n\rpl bits = %02x\n",CDMS_RAM[0]);
+ //gPC.printf("\n\rPL_STATUS : %d",PL_STATUS);
+ //gPC.printf("\n\rPL_STATE : %d",PL_STATE);
+ //gPC.printf("\n\rpl bits = %02x\n",CDMS_RAM[0]);
CDMS_RAM[1] = ((PL_RCV_SC_DATA_STATUS<<7)&0x80)|((COM_SESSION<<6)&0x40)|((COM_RX<<5)&0x20)|((RF_SW_STATUS<<4)&0x10)|((COM_TX<<3)&0x08)|((COM_TX_STATUS<<2)&0x04)|((COM_MNG_TMTC<<1)&0x02)|(EN_CDMS_HK&0x01);
CDMS_RAM[2] = ((EN_PL<<7)&0x80)|((EN_RCV_SC<<6)&0x40)|((CDMS_INIT_STATUS<<5)&0x20)|((CDMS_HK_MAIN_STATUS<<4)&0x10)|((CDMS_HK_STATUS<<2)&0x0C)|((COM_RX_STATUS<<1)&0x02)|(CDMS_RTC_BL&0x01);
CDMS_RAM[3] = CDMS_I2C_ERR_SPEED_COUNTER >> 8;
