To fix the hang problem
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: CDMS_HK.h
- Revision:
- 276:9e5b0085763d
- Parent:
- 270:9dacc1d8459a
--- a/CDMS_HK.h Thu Jul 21 11:07:04 2016 +0000 +++ b/CDMS_HK.h Wed Jul 27 09:54:26 2016 +0000 @@ -40,12 +40,24 @@ void FCTN_CDMS_HK_MAIN(void const *args) { uint8_t sd_stat = 0; + uint8_t count; while(1) { gHK_THREAD->signal_wait(HK_SIGNAL); + if(count == 1 || count == 2) + { + FCTN_CDMS_PL_MAIN((void const *)NULL); + count--; + continue; + } + else if(count == 0) + { + FCTN_CDMS_PL_MAIN((void const *)NULL); + count = 2; + } gPC.printf("\n\nEntering HK thread\n"); - if(EN_HK == 0x00) + if(EN_CDMS_HK == 0x00) continue; gMutex.lock(); CDMS_HK_MAIN_STATUS = 0x01; @@ -56,7 +68,7 @@ VERIFY_COMRX(); VERIFY_RTC(); HANDLE_HW_FAULTS(); - FUNC_CDMS_GPIO_STATUS(); //yet to be done + FUNC_CDMS_GPIO_STATUS(); uint8_t CDMS_quant[20]; CDMS_quant[1]= (uint8_t)quant_data.CDMS_temp_quant; @@ -74,7 +86,25 @@ for(int i = 0;i<20;i++) //Collecting Data from Temp sensors CDMS_HEALTH_DATA[86+i] = CDMS_quant[i]; - // Here: Have to FIT flash data. + // Here: Have to FIT flash data. + CDMS_HEALTH_DATA[106] = (EPS_V_A_EN_STATUS<<7) | ((BAE_SW_STATUS<<5)&0x60) | ((CDMS_SD_SW_STATUS<<3)&0x18) | ((PL_BEE_SW_STATUS<<1)&0x06) | (PL_EPS_LATCH_SW_EN & 0x01); + CDMS_HEALTH_DATA[107] = (RTC_INIT_STATUS<<6) | ((CDMS_RTC_DISABLE<<5)&0x20); + CDMS_HEALTH_DATA[108] = CDMS_RESET_COUNTER >>8; + CDMS_HEALTH_DATA[109] = CDMS_RESET_COUNTER; + CDMS_HEALTH_DATA[110] = TIME_LATEST_CDSMS_RESET >>24; + CDMS_HEALTH_DATA[111] = TIME_LATEST_CDSMS_RESET >>16; + CDMS_HEALTH_DATA[112] = TIME_LATEST_CDSMS_RESET >>8; + CDMS_HEALTH_DATA[113] = TIME_LATEST_CDSMS_RESET; + CDMS_HEALTH_DATA[114] = COM_TC_BYTES_LIMIT>>8; + CDMS_HEALTH_DATA[115] = COM_TC_BYTES_LIMIT; + CDMS_HEALTH_DATA[116] = COM_RX_CURRENT_MAX; + CDMS_HEALTH_DATA[117] = COM_RX_DISABLE_TIMEOUT; + CDMS_HEALTH_DATA[118] = COM_PA_TMP_HIGH; + CDMS_HEALTH_DATA[119] = COM_PA_RECOVERY_TIMEOUT; + CDMS_HEALTH_DATA[120] = COM_SESSION_TIMEOUT; + CDMS_HEALTH_DATA[121] = COM_RSSI_MIN; + CDMS_HEALTH_DATA[122] = SD_LIB_BLK_CURRENT>>8; + CDMS_HEALTH_DATA[122] = SD_LIB_BLK_CURRENT; uint64_t time = FCTN_CDMS_RD_RTC() >> 7; //Reading Time from RTC for(int i = 124; i<128; i++) @@ -167,7 +197,7 @@ 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)|(COMTX_OC_FAULT); - beacon_array[11] = (EPS_V_C_EN_STATUS <<7)|(EPS_V_D_EN_STATUS); + beacon_array[11] = (EPS_V_C_EN_STATUS <<7)|(COM_TX_CNTRL); beacon_array[12] = CDMS_HK_MAIN_COUNTER >>8; beacon_array[13] = CDMS_HK_MAIN_COUNTER; beacon_array[14] = PL_MAIN_COUNTER >>8; @@ -321,7 +351,7 @@ //EPS_V_C_EN_STATUS GPIO_STATUS=(EPS_V_C_EN_STATUS)?(GPIO_STATUS)||((uint16_t)(0x1<<3)):(GPIO_STATUS)&(~((uint16_t)(0x1<<3))); //EPS_V_D_EN_STATUS - GPIO_STATUS=(EPS_V_D_EN_STATUS)?(GPIO_STATUS)||((uint16_t)(0x1<<2)):(GPIO_STATUS)&(~((uint16_t)(0x1<<2))); + GPIO_STATUS=(COM_TX_CNTRL)?(GPIO_STATUS)||((uint16_t)(0x1<<2)):(GPIO_STATUS)&(~((uint16_t)(0x1<<2))); }