Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of workinQM_5thJan_azad by
Diff: main.cpp
- Revision:
- 99:2cc5c0c98cb3
- Parent:
- 98:321edb143f26
- Child:
- 100:af43bc82d3eb
diff -r 321edb143f26 -r 2cc5c0c98cb3 main.cpp --- a/main.cpp Tue Feb 14 16:18:16 2017 +0000 +++ b/main.cpp Thu Mar 09 07:42:15 2017 +0000 @@ -51,6 +51,8 @@ extern Timer timer_Set_BCN_TX_STATUS_RF_SILENCE; extern Timer timer_Set_BCN_TX_STATUS_SUCCESS; extern Timer timer_Set_BCN_TX_STATUS_FAILURE; +extern float Read_I_D_IN_COMTX(); +extern void Read_V_D_IN_COMTX(); #define DISABLE_WDOG 0; @@ -83,6 +85,7 @@ void RETURN_UPTIME(float time, uint8_t *day,uint8_t *hour,uint8_t *min) { + printf("\n\r the time relayed is %f\n",time); *day = time/(3600*24); time = (int)time % (3600*24); *hour = time/(3600); @@ -153,10 +156,18 @@ //fctn to pass the data to bcn long type //uint8_t CDMS_HK_data[134]; now implemented as LONG_HK_data[0][134]; uint8_t LONG_HK_data[2][134]; +extern uint16_t crc_hk_data_type(); + void FCTN_CDMS_HK_TC(uint8_t tc[]) { for(int i=0;i<134;i++) - LONG_HK_data[0][i] = tc[i]; + LONG_HK_data[0][i] = tc[i]; + + uint16_t crc; + crc = crc_hk_data_type(); + LONG_HK_data[0][132] = (uint8_t)(crc >> 8); + LONG_HK_data[0][133] = crc; + } uint8_t BAE_STANDBY=0x07;// as Bcn Acs Eps last three bits BAE order , refer to switch off.//old convection now *****0***** means off @@ -389,8 +400,8 @@ DigitalOut CDMS_OC_ENA(PIN70,1); -//DigitalOut BCN_SW(PIN64,1); // PIN changed to 64 (previous 65 ) //IN TEMPORARY SBC -DigitalOut BCN_SW(PIN14,1); //Beacon switch //IN QM SBC, TO BE CHANGED +DigitalOut BCN_SW(PIN64,1); // PIN changed to 64 (previous 65 ) //IN TEMPORARY SBC +//DigitalOut BCN_SW(PIN14,1); //Beacon switch //IN QM SBC, TO BE CHANGED //================================================================================ //default flash array some filler bits added (detail in MMS file) @@ -1037,6 +1048,15 @@ pc.printf("\n\rWrite TM success"); I2C_last.reset(); I2C_last.start(); + // wait_ms(5); + /* Read_I_D_IN_COMTX(); + wait_ms(2); + Read_I_D_IN_COMTX(); + wait_ms(2); + Read_V_D_IN_COMTX(); + wait_ms(2); + Read_V_D_IN_COMTX(); + */ } else { @@ -1071,21 +1091,25 @@ } else if( slave.receive()==3 || slave.receive()==2) // slave read { - pc.printf("\n\r the value %d \n\r",telecommand[0]); + // pc.printf("\n\r the value %d \n\r",telecommand[0]); BAE_I2C_COUNTER++; /*checking the tc timings*/ time_wdog = 1; - uint8_t i2c_count = 0; + uint8_t i2c_count = 0; + wait_ms(1); read_ack=slave.read((char *)telecommand,135); //read() function returns acknowledgement - pc.printf("\n\r the value %d \n\r",telecommand[0]); + // pc.printf("\n\r the value %d \n\r",telecommand[0]); - wait_ms(1); + //wait_ms(1); pdir_tc1=PTE->PDIR; + + pc.printf("\n\r pdir_tc1 0x%08X \n\r",pdir_tc1); + if(read_ack==0) //read() says it was successful { while(((pdir_tc1 & 0x00000003)!=3)&& i2c_count<10)//checking if SDA and SCL lines are logic 0 and not more than 10 times(10ms) @@ -1138,7 +1162,9 @@ pc.printf("\n\rRead Ack failed"); pc.printf("\n\rPTE->PDIR11 = 0x%08X",pdir_tm1); #endif + wait_ms(1); I2C_busreset(); + wait_ms(1); #if baby2 pdir_tm2 = PTE->PDIR; pc.printf("\n\rPTE->PDIR12 = 0x%08X",pdir_tm2);