working version
Dependencies: mbed mbed-rtos SimpleDMA FreescaleIAP eeprom
Fork of CDMS_CODE_FM_28JAN2017 by
Revision 315:f9a30c8cbe96, committed 2016-12-08
- Comitter:
- chaithanyarss
- Date:
- Thu Dec 08 10:12:15 2016 +0000
- Parent:
- 314:9f1b654a0b54
- Commit message:
- Corrected small things in HK. Checked MAX_MIN telecommands.
Changed in this revision
--- a/CDMS_HK.h Wed Dec 07 06:38:22 2016 +0000
+++ b/CDMS_HK.h Thu Dec 08 10:12:15 2016 +0000
@@ -16,6 +16,7 @@
AnalogIn TempInput(PIN27); // Input from Current Multiplexer
AnalogIn CDMS_temp_sensor(PIN53);
AnalogIn COMRX_RSSI_volatge(PIN70);
+AnalogIn EPS_BTRY_VOLT (PIN54);
DigitalOut SelectLinec3 (PIN79); // MSB of Select Lines
@@ -81,6 +82,7 @@
uint8_t CDMS_quant[20];
CDMS_quant[1]= (uint8_t)quant_data.CDMS_temp_quant;
CDMS_quant[2]= (uint8_t)RSSI_volatge;
+ CDMS_quant[3]= (uint8_t)(EPS_BTRY_VOLT*33*(62.0/11));
for(int i=0; i<16; i++) {
CDMS_quant[i+4]= (uint8_t)quant_data.temp_quant[i];
}
@@ -116,8 +118,9 @@
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);
+ CDMS_HEALTH_DATA[i] = time >> (i-124)*8;
+ gPC.printf("0x%d\n",time);
+ gPC.printf("HK ARCH TIME TAGGED");
FCTN_SD_MNGR(); //Adding FSC & TMID to TM frame
CDMS_HK_FRAME[0] = 0x20;
CDMS_HK_FRAME[1] = FSC_CURRENT[4]+1;
@@ -209,7 +212,7 @@
beacon_array[7] = SD_FAULTCOUNT;
beacon_array[8] = RTC_FAULTCOUNT >> 8;
beacon_array[9] = RTC_FAULTCOUNT;
- beacon_array[10] = (((SD_STATUS == DEVICE_DISABLED || SD_STATUS == DEVICE_OC_FAULT)?1:0)<<7)|(RTC_STATUS <<6)|(COM_RX_STATUS<<3)|(V_C_PGOOD<<2)|(COMRX_OC_FAULT<<1)|(COM_TX_OC_FAULT);
+ beacon_array[10] = (((SD_STATUS == DEVICE_DISABLED || SD_STATUS == DEVICE_OC_FAULT)?1:0)<<7)|(RTC_STATUS <<6)|(COM_RX_STATUS<<3)|(0<<2)|(COMRX_OC_FAULT<<1)|(COM_TX_OC_FAULT);
beacon_array[11] = (COM_RX_CNTRL <<7)|(COM_TX_CNTRL);
beacon_array[12] = CDMS_HK_MAIN_COUNTER >>8;
beacon_array[13] = CDMS_HK_MAIN_COUNTER;
@@ -270,8 +273,8 @@
for (int i = 4; i < 16; ++i) {
min_max_data.temp_min[i] = saveMin(min_max_data.temp_min[i],quant_data.temp_quant[i]);
min_max_data.temp_max[i] = saveMax(min_max_data.temp_max[i],quant_data.temp_quant[i]);
- // gPC.printf("\Max reading, iteration = %d, %d \n",min_max_data.temp_max[i], i);
- // gPC.printf("\Min reading, iteration = %d, %d \n",min_max_data.temp_min[i], i);
+ //gPC.printf("\rMax reading, iteration = %d, %d \n",min_max_data.temp_max[i], i);
+ //gPC.printf("\rMin reading, iteration = %d, %d \n",min_max_data.temp_min[i], i);
}
min_max_data.CDMS_temp_min = saveMin(min_max_data.CDMS_temp_min,quant_data.CDMS_temp_quant);
@@ -314,12 +317,11 @@
for(Iteration=0; Iteration<16; Iteration++) {
if(Iteration<4)
- {actual_data.temp_actual[Iteration]=actual_data.temp_actual[Iteration]*3.3*2;
- // gPC.printf("\rVoltage reading, iteration = %f, %d \n",actual_data.temp_actual[Iteration], Iteration);
- // wait_ms(1);
+ {
+ actual_data.temp_actual[Iteration]=actual_data.temp_actual[Iteration]*3.3*2*10;
}
else if(Iteration<14)
- {
+ {
resistance=24000*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
@@ -351,6 +353,7 @@
void FUNC_CDMS_GPIO_STATUS() //Polls the status of Input GPIO PINS
{
+ /*
//V_A_PGOOD //TRZ EN
GPIO_STATUS=(V_A_PGOOD)?(GPIO_STATUS)|((uint16_t)(0x1<<15)):(GPIO_STATUS)&(~((uint16_t)(0x1<<15)));
//V_B_PGOOD_1 //3V3BPGOOD //$
@@ -359,27 +362,34 @@
GPIO_STATUS=(V_B_PGOOD_2)?(GPIO_STATUS)|((uint16_t)(0x1<<13)):(GPIO_STATUS)&(~((uint16_t)(0x1<<13)));
//V_C_PGOOD //3V3CPGOOD //$
GPIO_STATUS=(V_C_PGOOD)?(GPIO_STATUS)|((uint16_t)(0x1<<12)):(GPIO_STATUS)&(~((uint16_t)(0x1<<12)));
+ */
+
//COMRX_OC_FAULT //$
GPIO_STATUS=(COMRX_OC_FAULT)?(GPIO_STATUS)|((uint16_t)(0x1<<11)):(GPIO_STATUS)&(~((uint16_t)(0x1<<11)));
// COMTX_OC_FAULT //$
GPIO_STATUS=(COM_TX_OC_FAULT)?(GPIO_STATUS)|((uint16_t)(0x1<<10)):(GPIO_STATUS)&(~((uint16_t)(0x1<<10)));
+ // CDMS_SD_OC_FAULT
+ GPIO_STATUS=(SD_OC_FAULT)?(GPIO_STATUS)|((uint16_t)(0x1<<9)):(GPIO_STATUS)&(~((uint16_t)(0x1<<9)));
//BAE_OC_FAULT //$
- GPIO_STATUS=(BAE_OC_FAULT)?(GPIO_STATUS)|((uint16_t)(0x1<<9)):(GPIO_STATUS)&(~((uint16_t)(0x1<<9)));
-
+ GPIO_STATUS=(BAE_OC_FAULT)?(GPIO_STATUS)|((uint16_t)(0x1<<8)):(GPIO_STATUS)&(~((uint16_t)(0x1<<8)));
+
+ /*
//PL_GPIO_1_STATUS //$
GPIO_STATUS=(PL_GPIO_1_STATUS)?(GPIO_STATUS)|((uint16_t)(0x1<<8)):(GPIO_STATUS)&(~((uint16_t)(0x1<<8)));
//PL_GPIO_2_STATUS //$
GPIO_STATUS=(PL_GPIO_2_STATUS)?(GPIO_STATUS)|((uint16_t)(0x1<<7)):(GPIO_STATUS)&(~((uint16_t)(0x1<<7)));
//PL_GPIO_3_STATUS //$
GPIO_STATUS=(PL_GPIO_3_STATUS)?(GPIO_STATUS)|((uint16_t)(0x1<<6)):(GPIO_STATUS)&(~((uint16_t)(0x1<<6)));
+ */
+
//PL_BEE_SW_OC_FAULT //to be verified
- GPIO_STATUS=(PL_BEE_SW_OC_FAULT)?(GPIO_STATUS)|((uint16_t)(0x1<<5)):(GPIO_STATUS)&(~((uint16_t)(0x1<<5)));
+ GPIO_STATUS=(PL_BEE_SW_OC_FAULT)?(GPIO_STATUS)|((uint16_t)(0x1<<4)):(GPIO_STATUS)&(~((uint16_t)(0x1<<4)));
//PL_EPS_LATCH_SW_OC_FAULT // to be verified
- GPIO_STATUS=(PL_EPS_LATCH_SW_OC_FAULT)?(GPIO_STATUS)|((uint16_t)(0x1<<4)):(GPIO_STATUS)&(~((uint16_t)(0x1<<4)));
+ GPIO_STATUS=(PL_EPS_LATCH_SW_OC_FAULT)?(GPIO_STATUS)|((uint16_t)(0x1<<3)):(GPIO_STATUS)&(~((uint16_t)(0x1<<3)));
//EPS_V_C_EN_STATUS
- GPIO_STATUS=(COM_RX_CNTRL)?(GPIO_STATUS)|((uint16_t)(0x1<<3)):(GPIO_STATUS)&(~((uint16_t)(0x1<<3)));
+ GPIO_STATUS=(COM_RX_CNTRL)?(GPIO_STATUS)|((uint16_t)(0x1<<2)):(GPIO_STATUS)&(~((uint16_t)(0x1<<2)));
//EPS_V_D_EN_STATUS
- GPIO_STATUS=(COM_TX_CNTRL)?(GPIO_STATUS)|((uint16_t)(0x1<<2)):(GPIO_STATUS)&(~((uint16_t)(0x1<<2)));
+ GPIO_STATUS=(COM_TX_CNTRL)?(GPIO_STATUS)|((uint16_t)(0x1<<1)):(GPIO_STATUS)&(~((uint16_t)(0x1<<1)));
// gPC.printf("%04x\n",GPIO_STATUS);
gPC.printf("\rBAE_OC STATE = %04x \n",GPIO_STATUS);
}
@@ -583,4 +593,5 @@
for(int i = 0; i<4; i++)
CDMS_RAM[79+i] = FSC_LAST[5] >> (3-i)*8;
CDMS_RAM[83] = 0x00;
+ gPC.printf("\n\r%d %d %d %d %d",FSC_CURRENT[1],FSC_CURRENT[2],FSC_CURRENT[3],FSC_CURRENT[4],FSC_CURRENT[5]);
}
\ No newline at end of file
--- a/COM_MNG_TMTC.h Wed Dec 07 06:38:22 2016 +0000
+++ b/COM_MNG_TMTC.h Thu Dec 08 10:12:15 2016 +0000
@@ -623,7 +623,7 @@
ACK_L234(tm_ptr_short,0x02,GETpacket_seq_count(tc_ptr));
return tm_ptr_short;
}
- }
+ }
}
case 0x80:
{
--- a/Compression.h Wed Dec 07 06:38:22 2016 +0000
+++ b/Compression.h Thu Dec 08 10:12:15 2016 +0000
@@ -500,7 +500,7 @@
#if srpz
gPC.printf("\n\rPrinting SFP_TM\n\r{");
- //gPC.printf("\n\r{");
+ gPC.printf("\n\r{");
for(uint8_t z=0;z<134;z++){
gPC.printf("%02X",frames[id][z]);
}
@@ -1274,10 +1274,8 @@
position_tm_frame[id] = position_tm_starting[id];
}
#endif
- gPC.printf("fsc = %u, %u,%u\n\r", FSC_CURRENT[1],FSC_CURRENT[2],FSC_CURRENT[3]);
+ gPC.printf("\rFSC_CURRENT[1] = %u\n\rFSC_CURRENT[2] = %\n\rFSC_CURRENT[3] = %u\n\r", FSC_CURRENT[1],FSC_CURRENT[2],FSC_CURRENT[3]);
//gPC.printf("\n\rEndSRP");
// SCI_LED1 = !SCI_LED1;
SCI_LED1 = 0;
-
-
}
\ No newline at end of file
--- a/DefinitionsAndGlobals.h Wed Dec 07 06:38:22 2016 +0000 +++ b/DefinitionsAndGlobals.h Thu Dec 08 10:12:15 2016 +0000 @@ -278,7 +278,6 @@ DigitalIn V_A_PGOOD (PIN88); DigitalIn V_B_PGOOD_1 (PIN6); DigitalIn V_B_PGOOD_2 (PIN7); -DigitalIn V_C_PGOOD (PIN54); DigitalIn COMRX_OC_FAULT (PIN68); //DigitalIn COMTX_OC_FAULT (PIN69); DigitalIn BAE_OC_FAULT (PIN92);
--- a/FMS_all.h Wed Dec 07 06:38:22 2016 +0000
+++ b/FMS_all.h Thu Dec 08 10:12:15 2016 +0000
@@ -350,13 +350,13 @@
for(int i=0;i<16;i++)
{
//tm_pointer->TM_string[i] = 0;
- tm_pointer->TM_string[i+7] = min_max_data.temp_max[i];
+ tm_pointer->TM_string[i+7] = (uint8_t)min_max_data.temp_max[i];
}
for(int i=0;i<16;i++)
{
//tm_pointer->TM_string[i] = 0;
- tm_pointer->TM_string[i+26] = min_max_data.temp_min[i];
+ tm_pointer->TM_string[i+26] = (uint8_t)min_max_data.temp_min[i];
}
tm_pointer->TM_string[47] = GPIO_STATUS &0xFF00;
--- a/Flash.h Wed Dec 07 06:38:22 2016 +0000
+++ b/Flash.h Thu Dec 08 10:12:15 2016 +0000
@@ -7,47 +7,50 @@
int strt_add = flash_size() - (2*SECTOR_SIZE);
uint32_t flasharray[32]; //256+(3*1024)
uint32_t INITIAL_FLASH[32];
+
/*corrected*/
int *nativeflash = (int*)strt_add;
void FLASH_INI()
{
+ INITIAL_FLASH[16] = 8000;
uint32_t read[32];
for(int i=0;i<32;i++)
- {
- read[i] = nativeflash[i];
- }
+ {
+ read[i] = nativeflash[i];
+ }
if(read[0] == -1)
+ {
for(int j=0;j<32;j++)
- {
- FCTN_CDMS_WR_FLASH(j,INITIAL_FLASH[j]);
- }
+ {
+ FCTN_CDMS_WR_FLASH(j,INITIAL_FLASH[j]);
+ }
+ }
else
- {
+ {
for(int j=0;j<32;j++)
- {
- read[j] = nativeflash[j];
- }
- EPS_V_A_EN_STATUS = read[0];
- BAE_STATUS = read[1];
- SD_STATUS = read[2];
- PL_STATUS = read[3];
- PL_EPS_LATCH_SW_EN = read[4];
- RTC_INIT_STATUS = read[5];
- CDMS_RTC_DISABLE = read[6];
- CDMS_RESET_COUNTER = read[7];
- TIME_LATEST_CDSMS_RESET = read[8];
- COM_TC_BYTES_LIMIT = read[9];
- COM_RX_CURRENT_MAX = read[10];
- COM_RX_DISABLE_TIMEOUT = read[11];
- COM_PA_TMP_HIGH = read[12];
- COM_PA_RECOVERY_TIMEOUT = read[13];
- COM_SESSION_TIMEOUT = read[14];
- COM_RSSI_MIN = read[15];
- SD_LIB_BLK_CURRENT = read[16];
+ {
+ read[j] = nativeflash[j];
}
-
+ }
+ EPS_V_A_EN_STATUS = read[0];
+ BAE_STATUS = read[1];
+ SD_STATUS = read[2];
+ PL_STATUS = read[3];
+ PL_EPS_LATCH_SW_EN = read[4];
+ RTC_INIT_STATUS = read[5];
+ CDMS_RTC_DISABLE = read[6];
+ CDMS_RESET_COUNTER = read[7];
+ TIME_LATEST_CDSMS_RESET = read[8];
+ COM_TC_BYTES_LIMIT = read[9];
+ COM_RX_CURRENT_MAX = read[10];
+ COM_RX_DISABLE_TIMEOUT = read[11];
+ COM_PA_TMP_HIGH = read[12];
+ COM_PA_RECOVERY_TIMEOUT = read[13];
+ COM_SESSION_TIMEOUT = read[14];
+ COM_RSSI_MIN = read[15];
+ SD_LIB_BLK_CURRENT = read[16];
}
/*Writing to the Flash*/
--- a/OBSRS.h Wed Dec 07 06:38:22 2016 +0000
+++ b/OBSRS.h Thu Dec 08 10:12:15 2016 +0000
@@ -667,6 +667,7 @@
no_of_frames = tcp->TC_string[3];
for(int i=0 ;i<no_of_frames ; i++){
list_of_FSC[i] = tcp->TC_string[4+i];
+ gPC.printf("\n\rlist_of_FSC[%d] = %d ",i,list_of_FSC[i]);
}
}
--- a/cdms_sd.h Wed Dec 07 06:38:22 2016 +0000
+++ b/cdms_sd.h Thu Dec 08 10:12:15 2016 +0000
@@ -438,7 +438,7 @@
gPC.puts("\rv1 initialization successfull\r\n");
cdv = 512;
debug_if(SD_DBG, "\n\rInit: SEDCARD_V1\n\r");
-
+ FCTN_SD_MNGR();
return SDCARD_V1;
}
}
@@ -460,6 +460,7 @@
cmd58();
debug_if(SD_DBG, "\n\rInit: SDCARD_V2\n\r");
cdv = 1;
+ FCTN_SD_MNGR();
return SDCARD_V2;
}
}
--- a/main.cpp Wed Dec 07 06:38:22 2016 +0000
+++ b/main.cpp Thu Dec 08 10:12:15 2016 +0000
@@ -69,7 +69,8 @@
// COMMON SPI
spi.format(8,0);
spi.frequency(500000);
-
+
+ FLASH_INI();
SD_SW_EN_DS = 0;
wait(1);
SD_SW_EN_DS = 1;
