working version

Dependencies:   mbed mbed-rtos SimpleDMA FreescaleIAP eeprom

Fork of CDMS_CODE_FM_28JAN2017 by samp Srinivasan

Committer:
chaithanyarss
Date:
Thu Jul 14 13:07:30 2016 +0000
Revision:
261:1e54415b34d3
Parent:
257:7d404e9dc9e2
Child:
262:752c8689944a
Added thresholds in flash

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chaithanyarss 257:7d404e9dc9e2 1
chaithanyarss 257:7d404e9dc9e2 2 // Includes MMS RAM functions also
chaithanyarss 257:7d404e9dc9e2 3
chaithanyarss 257:7d404e9dc9e2 4 /*===================================================FMS Functions=================================================*/
chaithanyarss 257:7d404e9dc9e2 5
chaithanyarss 257:7d404e9dc9e2 6 void STANDBY_PRCS();
ee12b079 209:63e9c8f8b5d2 7
ee12b079 245:da9d1bd999da 8 //Run processes
ee12b079 209:63e9c8f8b5d2 9 void P_PL_INIT();
ee12b079 209:63e9c8f8b5d2 10 void P_PL_MAIN();
ee12b079 209:63e9c8f8b5d2 11 void P_COM_INIT();
ee12b079 209:63e9c8f8b5d2 12 void P_CDMS_HK_MAIN();
ee12b079 209:63e9c8f8b5d2 13 void P_PL_RCV_SC_DATA();
ee12b079 209:63e9c8f8b5d2 14 void P_CDMS_INIT_SD();
ee12b079 245:da9d1bd999da 15
ee12b079 245:da9d1bd999da 16 // Switch ON/OFF functions
ee12b079 209:63e9c8f8b5d2 17 void CDMS_SD_SW_ON();
ee12b079 209:63e9c8f8b5d2 18 void CDMS_SD_SW_OFF();
ee12b079 245:da9d1bd999da 19 void CDMS_RTC_ON();
ee12b079 245:da9d1bd999da 20 void CDMS_RTC_OFF();
ee12b079 209:63e9c8f8b5d2 21 void SW_ON_BAE();
ee12b079 209:63e9c8f8b5d2 22 void SW_OFF_BAE();
ee12b079 209:63e9c8f8b5d2 23 void SW_ON_PL_BEE();
ee12b079 209:63e9c8f8b5d2 24 void SW_OFF_PL_BEE();
ee12b079 209:63e9c8f8b5d2 25 void SW_ON_PL_EPS();
ee12b079 209:63e9c8f8b5d2 26 void SW_OFF_PL_EPS();
ee12b079 209:63e9c8f8b5d2 27 void SW_ON_V_A_EN();
ee12b079 209:63e9c8f8b5d2 28 void SW_OFF_V_A_EN();
ee12b079 245:da9d1bd999da 29
ee12b079 245:da9d1bd999da 30 // RST functions
ee12b079 209:63e9c8f8b5d2 31 void RST_SD();
ee12b079 245:da9d1bd999da 32 void SW_RST_BAE();
ee12b079 245:da9d1bd999da 33 void SW_RST_PL_BEE();
ee12b079 209:63e9c8f8b5d2 34 void RST_BAE();
ee12b079 209:63e9c8f8b5d2 35 void RST_PL_BEE();
chaithanyarss 257:7d404e9dc9e2 36 void CDMS_RESET();
ee12b079 245:da9d1bd999da 37 void SYS_PWR_RESET(); // Have to be decided with EPS team.
ee12b079 245:da9d1bd999da 38 void EPS_V_A_EN();
ee12b079 245:da9d1bd999da 39 void EPS_V_C_EN();
ee12b079 245:da9d1bd999da 40
ee12b079 209:63e9c8f8b5d2 41 void RST_HK_COUNTER();
chaithanyarss 257:7d404e9dc9e2 42 int8_t CDMS_RD_SD_HK(uint8_t *);
chaithanyarss 257:7d404e9dc9e2 43 void CDMS_CALIB_RTC(uint8_t *);
chaithanyarss 257:7d404e9dc9e2 44 void TOTAL_RESET_WITH_CDMS();
chaithanyarss 257:7d404e9dc9e2 45
ee12b079 245:da9d1bd999da 46
chaithanyarss 257:7d404e9dc9e2 47 void STANDBY_PRCS()
chaithanyarss 257:7d404e9dc9e2 48 {
chaithanyarss 257:7d404e9dc9e2 49
chaithanyarss 257:7d404e9dc9e2 50 }
ee12b079 209:63e9c8f8b5d2 51
ee12b079 209:63e9c8f8b5d2 52 void P_PL_INIT()
ee12b079 209:63e9c8f8b5d2 53 {
ee12b079 209:63e9c8f8b5d2 54
ee12b079 209:63e9c8f8b5d2 55 }
ee12b079 209:63e9c8f8b5d2 56
ee12b079 209:63e9c8f8b5d2 57 void P_PL_MAIN()
ee12b079 209:63e9c8f8b5d2 58 {
chaithanyarss 257:7d404e9dc9e2 59 FCTN_CDMS_PL_MAIN((void *)NULL);
ee12b079 209:63e9c8f8b5d2 60 }
ee12b079 209:63e9c8f8b5d2 61
ee12b079 209:63e9c8f8b5d2 62 void P_COM_INIT()
ee12b079 209:63e9c8f8b5d2 63 {
ee12b079 245:da9d1bd999da 64 P_COM_INIT;
ee12b079 209:63e9c8f8b5d2 65 }
ee12b079 209:63e9c8f8b5d2 66
ee12b079 209:63e9c8f8b5d2 67 void P_CDMS_HK_MAIN()
ee12b079 209:63e9c8f8b5d2 68 {
ee12b079 245:da9d1bd999da 69 FCTN_CDMS_HK_MAIN((void *)NULL);
ee12b079 209:63e9c8f8b5d2 70 }
ee12b079 209:63e9c8f8b5d2 71
ee12b079 209:63e9c8f8b5d2 72 void P_PL_RCV_SC_DATA()
ee12b079 209:63e9c8f8b5d2 73 {
ee12b079 245:da9d1bd999da 74
ee12b079 209:63e9c8f8b5d2 75 }
ee12b079 209:63e9c8f8b5d2 76
ee12b079 209:63e9c8f8b5d2 77 void P_CDMS_INIT_SD()
ee12b079 209:63e9c8f8b5d2 78 {
ee12b079 209:63e9c8f8b5d2 79 FCTN_CDMS_SD_INIT();
ee12b079 209:63e9c8f8b5d2 80 }
ee12b079 209:63e9c8f8b5d2 81
ee12b079 209:63e9c8f8b5d2 82 void CDMS_SD_SW_ON()
ee12b079 209:63e9c8f8b5d2 83 {
ee12b079 245:da9d1bd999da 84 SD_SW_EN_DS = 0;
chaithanyarss 261:1e54415b34d3 85 SD_STATUS = DEVICE_POWERED;
chaithanyarss 261:1e54415b34d3 86 CDMS_SD_SW_STATUS = DEVICE_POWERED;
chaithanyarss 261:1e54415b34d3 87 FCTN_CDMS_WR_FLASH(2,DEVICE_POWERED);
chaithanyarss 261:1e54415b34d3 88 gPC.printf("sw on sd\n");
ee12b079 209:63e9c8f8b5d2 89 }
ee12b079 209:63e9c8f8b5d2 90
ee12b079 209:63e9c8f8b5d2 91 void CDMS_SD_SW_OFF()
ee12b079 209:63e9c8f8b5d2 92 {
ee12b079 245:da9d1bd999da 93 SD_SW_EN_DS = 1;
chaithanyarss 261:1e54415b34d3 94 SD_STATUS = DEVICE_DISABLED;
chaithanyarss 261:1e54415b34d3 95 CDMS_SD_SW_STATUS = DEVICE_DISABLED;
chaithanyarss 261:1e54415b34d3 96 FCTN_CDMS_WR_FLASH(2,DEVICE_DISABLED);
chaithanyarss 261:1e54415b34d3 97 gPC.printf("sw off sd\n");
ee12b079 209:63e9c8f8b5d2 98 }
ee12b079 209:63e9c8f8b5d2 99
ee12b079 245:da9d1bd999da 100 void CDMS_RTC_ON()
ee12b079 209:63e9c8f8b5d2 101 {
chaithanyarss 257:7d404e9dc9e2 102 //FCTN_CDMS_INIT_RTC();
chaithanyarss 257:7d404e9dc9e2 103 SPI_mutex.lock();
chaithanyarss 257:7d404e9dc9e2 104 gCS_RTC=1;
chaithanyarss 257:7d404e9dc9e2 105 gCS_RTC=0;
chaithanyarss 257:7d404e9dc9e2 106 spi.write(0x81); //register address with write flag
chaithanyarss 257:7d404e9dc9e2 107 spi.write(0x00);//disabling stop bit in the seconds register
chaithanyarss 257:7d404e9dc9e2 108 SPI_mutex.unlock();
chaithanyarss 261:1e54415b34d3 109 gPC.printf("sw on rtc\n");
ee12b079 209:63e9c8f8b5d2 110 }
ee12b079 209:63e9c8f8b5d2 111
ee12b079 245:da9d1bd999da 112 void CDMS_RTC_OFF()
ee12b079 209:63e9c8f8b5d2 113 {
chaithanyarss 257:7d404e9dc9e2 114 SPI_mutex.lock();
chaithanyarss 257:7d404e9dc9e2 115 gCS_RTC=1;
chaithanyarss 257:7d404e9dc9e2 116 gCS_RTC=0;
chaithanyarss 257:7d404e9dc9e2 117 spi.write(0x81); //register address with write flag
chaithanyarss 257:7d404e9dc9e2 118 spi.write(0x80);//enabling stop bit in the seconds register
chaithanyarss 257:7d404e9dc9e2 119 SPI_mutex.unlock();
chaithanyarss 261:1e54415b34d3 120 gPC.printf("sw off rtc\n");
ee12b079 209:63e9c8f8b5d2 121 }
ee12b079 209:63e9c8f8b5d2 122
ee12b079 245:da9d1bd999da 123 void SW_ON_BAE()
ee12b079 245:da9d1bd999da 124 {
ee12b079 245:da9d1bd999da 125 BAE_SW_EN_DS = 0;
chaithanyarss 261:1e54415b34d3 126 BAE_STATUS = DEVICE_POWERED;
chaithanyarss 261:1e54415b34d3 127 BAE_SW_STATUS = DEVICE_POWERED;
chaithanyarss 261:1e54415b34d3 128 FCTN_CDMS_WR_FLASH(1,DEVICE_POWERED);
chaithanyarss 261:1e54415b34d3 129 gPC.printf("sw on bae\n");
ee12b079 245:da9d1bd999da 130 }
ee12b079 245:da9d1bd999da 131
ee12b079 245:da9d1bd999da 132 void SW_OFF_BAE()
ee12b079 245:da9d1bd999da 133 {
ee12b079 245:da9d1bd999da 134 BAE_SW_EN_DS = 1;
chaithanyarss 261:1e54415b34d3 135 BAE_STATUS = DEVICE_DISABLED;
chaithanyarss 261:1e54415b34d3 136 BAE_SW_STATUS = DEVICE_DISABLED;
chaithanyarss 261:1e54415b34d3 137 FCTN_CDMS_WR_FLASH(1,DEVICE_DISABLED);
chaithanyarss 261:1e54415b34d3 138 gPC.printf("sw off bae\n");
ee12b079 245:da9d1bd999da 139 }
ee12b079 245:da9d1bd999da 140
ee12b079 245:da9d1bd999da 141 void SW_ON_PL_BEE()
ee12b079 245:da9d1bd999da 142 {
chaithanyarss 261:1e54415b34d3 143 PYLD_DFF_CLK = 0;
chaithanyarss 261:1e54415b34d3 144 PYLD_DFF = 1;
chaithanyarss 261:1e54415b34d3 145 wait_us(1);
chaithanyarss 261:1e54415b34d3 146 PYLD_DFF_CLK = 1;
chaithanyarss 261:1e54415b34d3 147 wait_us(1);
chaithanyarss 261:1e54415b34d3 148 PYLD_DFF_CLK = 0;
chaithanyarss 261:1e54415b34d3 149 wait_us(1);
chaithanyarss 261:1e54415b34d3 150 PL_STATUS = DEVICE_POWERED;
chaithanyarss 261:1e54415b34d3 151 PL_BEE_SW_STATUS = DEVICE_POWERED;
chaithanyarss 261:1e54415b34d3 152 FCTN_CDMS_WR_FLASH(3,DEVICE_POWERED);
ee12b079 245:da9d1bd999da 153 }
ee12b079 245:da9d1bd999da 154
ee12b079 245:da9d1bd999da 155 void SW_OFF_PL_BEE()
ee12b079 245:da9d1bd999da 156 {
ee12b079 245:da9d1bd999da 157 PYLD_DFF_CLK = 0;
ee12b079 245:da9d1bd999da 158 PYLD_DFF = 0;
ee12b079 245:da9d1bd999da 159 wait_us(1);
ee12b079 245:da9d1bd999da 160 PYLD_DFF_CLK = 1;
ee12b079 245:da9d1bd999da 161 wait_us(1);
ee12b079 245:da9d1bd999da 162 PYLD_DFF_CLK = 0;
ee12b079 245:da9d1bd999da 163 wait_us(1);
chaithanyarss 261:1e54415b34d3 164 PL_STATUS = DEVICE_DISABLED;
chaithanyarss 261:1e54415b34d3 165 PL_BEE_SW_STATUS = DEVICE_DISABLED;
chaithanyarss 261:1e54415b34d3 166 FCTN_CDMS_WR_FLASH(3,DEVICE_DISABLED);
ee12b079 245:da9d1bd999da 167 }
ee12b079 245:da9d1bd999da 168
ee12b079 245:da9d1bd999da 169 void SW_ON_PL_EPS()
ee12b079 245:da9d1bd999da 170 {
chaithanyarss 261:1e54415b34d3 171 PYLD_EPS_DFF_PWR_CLK = 0;
chaithanyarss 261:1e54415b34d3 172 PYLD_EPS_DFF_PWR = 1;
chaithanyarss 261:1e54415b34d3 173 wait_us(1);
chaithanyarss 261:1e54415b34d3 174 PYLD_EPS_DFF_PWR_CLK = 1;
chaithanyarss 261:1e54415b34d3 175 wait_us(1);
chaithanyarss 261:1e54415b34d3 176 PYLD_EPS_DFF_PWR_CLK = 0;
chaithanyarss 261:1e54415b34d3 177 wait_us(1);
chaithanyarss 261:1e54415b34d3 178 PL_EPS_LATCH_SW_EN = 1;
chaithanyarss 261:1e54415b34d3 179 FCTN_CDMS_WR_FLASH(4,1);
ee12b079 245:da9d1bd999da 180 }
ee12b079 245:da9d1bd999da 181
ee12b079 209:63e9c8f8b5d2 182 void SW_OFF_PL_EPS()
ee12b079 209:63e9c8f8b5d2 183 {
chaithanyarss 261:1e54415b34d3 184 PYLD_EPS_DFF_PWR_CLK = 0;
chaithanyarss 261:1e54415b34d3 185 PYLD_EPS_DFF_PWR = 0;
chaithanyarss 261:1e54415b34d3 186 wait_us(1);
chaithanyarss 261:1e54415b34d3 187 PYLD_EPS_DFF_PWR_CLK = 1;
chaithanyarss 261:1e54415b34d3 188 wait_us(1);
chaithanyarss 261:1e54415b34d3 189 PYLD_EPS_DFF_PWR_CLK = 0;
chaithanyarss 261:1e54415b34d3 190 wait_us(1);
chaithanyarss 261:1e54415b34d3 191 PL_EPS_LATCH_SW_EN = 0;
chaithanyarss 261:1e54415b34d3 192 FCTN_CDMS_WR_FLASH(4,0);
ee12b079 209:63e9c8f8b5d2 193 }
ee12b079 209:63e9c8f8b5d2 194
ee12b079 209:63e9c8f8b5d2 195 void SW_ON_V_A_EN()
ee12b079 209:63e9c8f8b5d2 196 {
chaithanyarss 257:7d404e9dc9e2 197 V_A_EN = 1;
chaithanyarss 261:1e54415b34d3 198 EPS_V_A_EN_STATUS = 1;
chaithanyarss 261:1e54415b34d3 199 FCTN_CDMS_WR_FLASH(0,1);
ee12b079 209:63e9c8f8b5d2 200 }
ee12b079 209:63e9c8f8b5d2 201
ee12b079 209:63e9c8f8b5d2 202 void SW_OFF_V_A_EN()
ee12b079 209:63e9c8f8b5d2 203 {
chaithanyarss 257:7d404e9dc9e2 204 V_A_EN = 0;
chaithanyarss 261:1e54415b34d3 205 EPS_V_A_EN_STATUS = 0;
chaithanyarss 261:1e54415b34d3 206 FCTN_CDMS_WR_FLASH(0,0);
ee12b079 209:63e9c8f8b5d2 207 }
ee12b079 209:63e9c8f8b5d2 208
ee12b079 209:63e9c8f8b5d2 209 void RST_SD()
ee12b079 209:63e9c8f8b5d2 210 {
ee12b079 245:da9d1bd999da 211 SD_SW_EN_DS = 1;
ee12b079 209:63e9c8f8b5d2 212 wait_ms(10);
ee12b079 209:63e9c8f8b5d2 213 SD_SW_EN_DS = 0;
chaithanyarss 261:1e54415b34d3 214 gPC.printf("rst sd\n");
ee12b079 245:da9d1bd999da 215 }
ee12b079 245:da9d1bd999da 216
ee12b079 245:da9d1bd999da 217 void SW_RST_BAE()
ee12b079 245:da9d1bd999da 218 {
ee12b079 245:da9d1bd999da 219 BAE_SW_EN_DS = 1;
ee12b079 245:da9d1bd999da 220 wait_ms(10);
ee12b079 245:da9d1bd999da 221 BAE_SW_EN_DS = 0;
chaithanyarss 261:1e54415b34d3 222 gPC.printf("rst bae\n");
ee12b079 245:da9d1bd999da 223 }
ee12b079 245:da9d1bd999da 224
ee12b079 245:da9d1bd999da 225 void SW_RST_PL_BEE()
ee12b079 245:da9d1bd999da 226 {
ee12b079 245:da9d1bd999da 227 PYLD_DFF = 1;
ee12b079 245:da9d1bd999da 228 wait_ms(10);
ee12b079 245:da9d1bd999da 229 PYLD_DFF = 0;
ee12b079 209:63e9c8f8b5d2 230 }
ee12b079 209:63e9c8f8b5d2 231
ee12b079 209:63e9c8f8b5d2 232 void RST_BAE()
ee12b079 209:63e9c8f8b5d2 233 {
ee12b079 245:da9d1bd999da 234 RESET_TO_BAE = 1;
ee12b079 209:63e9c8f8b5d2 235 wait_ms(10);
ee12b079 245:da9d1bd999da 236 RESET_TO_BAE = 0;
ee12b079 209:63e9c8f8b5d2 237 }
ee12b079 209:63e9c8f8b5d2 238
ee12b079 209:63e9c8f8b5d2 239 void RST_PL_BEE()
ee12b079 209:63e9c8f8b5d2 240 {
ee12b079 245:da9d1bd999da 241 RESET_TO_PYLD = 1;
ee12b079 209:63e9c8f8b5d2 242 wait_ms(10);
ee12b079 245:da9d1bd999da 243 RESET_TO_PYLD = 0;
ee12b079 245:da9d1bd999da 244 }
ee12b079 245:da9d1bd999da 245
ee12b079 245:da9d1bd999da 246 void CDMS_INTERNAL_RESET()
ee12b079 245:da9d1bd999da 247 {
ee12b079 245:da9d1bd999da 248 NVIC_SystemReset();
ee12b079 245:da9d1bd999da 249 }
ee12b079 245:da9d1bd999da 250
ee12b079 245:da9d1bd999da 251 void SYS_PWR_RESET() // Have to be decided with EPS team.
ee12b079 245:da9d1bd999da 252 {
chaithanyarss 257:7d404e9dc9e2 253 sys_pwr_rst = 1;
ee12b079 245:da9d1bd999da 254 }
ee12b079 245:da9d1bd999da 255
ee12b079 245:da9d1bd999da 256 void EPS_V_A_EN() // This is a reset function
ee12b079 245:da9d1bd999da 257 {
chaithanyarss 257:7d404e9dc9e2 258 V_A_EN = 0;
ee12b079 245:da9d1bd999da 259 wait_ms(10);
chaithanyarss 257:7d404e9dc9e2 260 V_A_EN = 1;
ee12b079 245:da9d1bd999da 261 }
ee12b079 245:da9d1bd999da 262
ee12b079 245:da9d1bd999da 263 void EPS_V_C_EN() // This is a reset function
ee12b079 245:da9d1bd999da 264 {
ee12b079 245:da9d1bd999da 265 COM_RX_CNTRL = 0;
ee12b079 245:da9d1bd999da 266 wait_ms(10);
ee12b079 245:da9d1bd999da 267 COM_RX_CNTRL = 1;
ee12b079 209:63e9c8f8b5d2 268 }
ee12b079 209:63e9c8f8b5d2 269
ee12b079 209:63e9c8f8b5d2 270 void RST_HK_COUNTER()
ee12b079 209:63e9c8f8b5d2 271 {
ee12b079 209:63e9c8f8b5d2 272 firstCount = true;
ee12b079 209:63e9c8f8b5d2 273 }
ee12b079 209:63e9c8f8b5d2 274
chaithanyarss 257:7d404e9dc9e2 275 int8_t CDMS_RD_SD_HK(uint8_t *sd_statusbits)
ee12b079 209:63e9c8f8b5d2 276 {
chaithanyarss 257:7d404e9dc9e2 277 int8_t p;
ee12b079 209:63e9c8f8b5d2 278 if(SD_SW_EN_DS != DEVICE_POWERED)
ee12b079 209:63e9c8f8b5d2 279 {
ee12b079 209:63e9c8f8b5d2 280 SD_RD_ERROR = 1;
chaithanyarss 257:7d404e9dc9e2 281 p = 1;
ee12b079 209:63e9c8f8b5d2 282 }
ee12b079 209:63e9c8f8b5d2 283 else
ee12b079 209:63e9c8f8b5d2 284 {
ee12b079 209:63e9c8f8b5d2 285 p = disk_read_statusbits(sd_statusbits);
ee12b079 209:63e9c8f8b5d2 286 }
chaithanyarss 257:7d404e9dc9e2 287 return p;
ee12b079 209:63e9c8f8b5d2 288 }
ee12b079 209:63e9c8f8b5d2 289
chaithanyarss 261:1e54415b34d3 290 void CDMS_CALIB_RTC(uint64_t time)
ee12b079 245:da9d1bd999da 291 {
chaithanyarss 257:7d404e9dc9e2 292 SPI_mutex.lock();
chaithanyarss 257:7d404e9dc9e2 293 gCS_RTC=1;
chaithanyarss 257:7d404e9dc9e2 294 spi.format(8,0);
chaithanyarss 257:7d404e9dc9e2 295 spi.frequency(1000000);
chaithanyarss 257:7d404e9dc9e2 296
chaithanyarss 257:7d404e9dc9e2 297 gCS_RTC=0;
chaithanyarss 257:7d404e9dc9e2 298 spi.write(0x82);
chaithanyarss 261:1e54415b34d3 299 spi.write((uint8_t)time);//set minutes
chaithanyarss 257:7d404e9dc9e2 300 gCS_RTC=1;
chaithanyarss 257:7d404e9dc9e2 301
chaithanyarss 257:7d404e9dc9e2 302 gCS_RTC=0;
chaithanyarss 257:7d404e9dc9e2 303 spi.write(0x83);
chaithanyarss 261:1e54415b34d3 304 spi.write((uint8_t)(time>>8) & 0x3F); //set hours
chaithanyarss 257:7d404e9dc9e2 305 gCS_RTC=1;
ee12b079 245:da9d1bd999da 306
chaithanyarss 257:7d404e9dc9e2 307 gCS_RTC=0;
chaithanyarss 257:7d404e9dc9e2 308 spi.write(0x85);
chaithanyarss 261:1e54415b34d3 309 spi.write((uint8_t)(time>>16) & 0x3F); //set date
chaithanyarss 257:7d404e9dc9e2 310 gCS_RTC=1;
chaithanyarss 257:7d404e9dc9e2 311
chaithanyarss 257:7d404e9dc9e2 312 gCS_RTC=0;
chaithanyarss 257:7d404e9dc9e2 313 spi.write(0x86);
chaithanyarss 261:1e54415b34d3 314 spi.write((uint8_t)(time>>24) & 0x1F); //set month
chaithanyarss 257:7d404e9dc9e2 315 gCS_RTC=1;
chaithanyarss 257:7d404e9dc9e2 316
chaithanyarss 257:7d404e9dc9e2 317 gCS_RTC=0;
chaithanyarss 257:7d404e9dc9e2 318 spi.write(0x87);
chaithanyarss 261:1e54415b34d3 319 spi.write((uint8_t)(time>>32)); //set year to 00(2000)
chaithanyarss 257:7d404e9dc9e2 320 gCS_RTC=1;
chaithanyarss 257:7d404e9dc9e2 321 gPC.puts("\n\r rtc initalised \n");
chaithanyarss 257:7d404e9dc9e2 322 SPI_mutex.unlock();
ee12b079 245:da9d1bd999da 323 }
ee12b079 245:da9d1bd999da 324
chaithanyarss 224:3ac1f91e0ebc 325 void CDMS_RESET()
chaithanyarss 224:3ac1f91e0ebc 326 {
chaithanyarss 224:3ac1f91e0ebc 327 NVIC_SystemReset();
chaithanyarss 224:3ac1f91e0ebc 328 }
chaithanyarss 224:3ac1f91e0ebc 329
ee12b079 245:da9d1bd999da 330 /*
ee12b079 245:da9d1bd999da 331 //void CDMS_INTERNAL_RESET()
ee12b079 209:63e9c8f8b5d2 332 {
ee12b079 209:63e9c8f8b5d2 333
ee12b079 245:da9d1bd999da 334 }
chaithanyarss 257:7d404e9dc9e2 335 */
chaithanyarss 257:7d404e9dc9e2 336
chaithanyarss 257:7d404e9dc9e2 337 //===============================MMS RAM functions==================================
chaithanyarss 257:7d404e9dc9e2 338
chaithanyarss 257:7d404e9dc9e2 339 void FCTN_CDMS_RD_L_RAM(Base_tm *);
chaithanyarss 257:7d404e9dc9e2 340
chaithanyarss 257:7d404e9dc9e2 341 void FCTN_CDMS_RD_L_RAM(Base_tm *tm_pointer)
chaithanyarss 257:7d404e9dc9e2 342 {
chaithanyarss 257:7d404e9dc9e2 343 for(int i=4;i<132;i++)
chaithanyarss 257:7d404e9dc9e2 344 tm_pointer->TM_string[i] = CDMS_HK_FRAME[i-4];
chaithanyarss 257:7d404e9dc9e2 345 }
chaithanyarss 257:7d404e9dc9e2 346
chaithanyarss 257:7d404e9dc9e2 347