working version
Dependencies: mbed mbed-rtos SimpleDMA FreescaleIAP eeprom
Fork of CDMS_CODE_FM_28JAN2017 by
Revision 322:7d906d34aaff, committed 2016-12-10
- Comitter:
- ee12b079
- Date:
- Sat Dec 10 12:32:27 2016 +0000
- Parent:
- 321:42bdefc37270
- Child:
- 323:1f3c756e7b38
- Child:
- 334:71e9f4fdb387
- Commit message:
- Merged with Chaitanya's changes
Changed in this revision
--- a/CDMS_HK.h Sat Dec 10 11:49:13 2016 +0000
+++ b/CDMS_HK.h Sat Dec 10 12:32:27 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/FMS_all.h Sat Dec 10 11:49:13 2016 +0000
+++ b/FMS_all.h Sat Dec 10 12:32:27 2016 +0000
@@ -343,4 +343,26 @@
//tm_pointer->TM_string[i] = 0;
tm_pointer->TM_string[i+4] = CDMS_HEALTH_DATA[i];
}
+}
+
+void FCTN_CDMS_MAX_MIN(Base_tm *tm_pointer)
+{
+ for(int i=0;i<16;i++)
+ {
+ //tm_pointer->TM_string[i] = 0;
+ 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] = (uint8_t)min_max_data.temp_min[i];
+ }
+
+ tm_pointer->TM_string[47] = GPIO_STATUS &0xFF00;
+ tm_pointer->TM_string[48] |= (GPIO_STATUS<<11) & 0xF000;
+
+ TIME_LATEST_RTC= FCTN_CDMS_RD_RTC() >> 7;
+ for(int i = 0; i<4; i++)
+ tm_pointer->TM_string[48+i] = TIME_LATEST_RTC >> (3-i)*8;
}
\ No newline at end of file
--- a/Flash.h Sat Dec 10 11:49:13 2016 +0000
+++ b/Flash.h Sat Dec 10 12:32:27 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/cdms_sd.h Sat Dec 10 11:49:13 2016 +0000
+++ b/cdms_sd.h Sat Dec 10 12:32:27 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;
}
}
