working version
Dependencies: mbed mbed-rtos SimpleDMA FreescaleIAP eeprom
Fork of CDMS_CODE_FM_28JAN2017 by
Diff: main.cpp
- Revision:
- 356:197c93dc2012
- Parent:
- 355:a5e72222ff26
- Child:
- 357:f3d48d62e00e
--- a/main.cpp Tue Mar 28 08:50:07 2017 +0000 +++ b/main.cpp Sat Feb 10 09:06:26 2018 +0000 @@ -71,6 +71,10 @@ // COMMON SPI spi.format(8,0); spi.frequency(500000); + FLASH_INI(); + if ((BAE_STATUS & 0x03) == 0x03) + {SW_OFF_BAE();} + uint8_t sd_stat_temp = SD_STATUS & 0x03; //Joel SD_CARD_fromuC_ENA3 = 0; SD_CARD_fromISO_ENA4 = 0; SD_SW_EN_DS = 0; @@ -78,32 +82,49 @@ SD_CARD_fromuC_ENA3 = 1; SD_CARD_fromISO_ENA4 = 1; SD_SW_EN_DS = 1; - + wait(1); // SD CARD cs_sd = 1; gCS_RTC = 1; gCS_ADF = 1; - // CDMS_RTC_DISABLE = 1; - - FCTN_CDMS_INIT_RTC();/* rtc initialization*/ + //CDMS_RTC_DISABLE = 1; + if((CDMS_RTC_DISABLE & 0x01) == 1) + { + CDMS_RTC_ON(); + } + if((RTC_INIT_STATUS & 0x01) != 1) //Joel + { + FCTN_CDMS_INIT_RTC();/* rtc initialization*/ + } FCTN_CDMS_SD_INIT();/* sd card initialization*/ + if(sd_stat_temp == DEVICE_DISABLED) + { + SD_STATUS = sd_stat_temp; + // SD_STATUS = 0x03; + SD_SW_EN_DS = 0; + } + else if(sd_stat_temp == DEVICE_OC_FAULT) + { + SD_STATUS = sd_stat_temp; + } // INIT_EEPROM(); // added by samp - - CDMS_RESET_COUNTER++; - FCTN_CDMS_WR_FLASH(17,CDMS_RESET_COUNTER); + CDMS_RESET_COUNTER+=1; + FCTN_CDMS_WR_FLASH(7,CDMS_RESET_COUNTER); + gPC.printf("\n\r%d\n",CDMS_RESET_COUNTER); TIME_LATEST_CDSMS_RESET = FCTN_CDMS_RD_RTC() >> 7; FCTN_CDMS_WR_FLASH(8,TIME_LATEST_CDSMS_RESET); // gPC.printf("%d \n", READ_FROM_EERPOM(8)); - uint8_t test[512]; + //uint8_t test[512]; - for(int i =0; i<512; i++) - test[i] = 0; - disk_write(test,80000); - - //SD_MNG_SECT = SD_LIB_BLK_CURRENT; + //for(int i =0; i<512; i++) + // test[i] = 0; + //disk_write(test,80000); + + SD_MNG_SECT = SD_LIB_BLK_CURRENT; + FCTN_SD_MNGR(); #if DEBUG