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:
- 97:36a91c432cb1
- Parent:
- 96:6603fedb6b69
- Child:
- 98:321edb143f26
--- a/main.cpp Wed Jan 25 09:09:43 2017 +0000 +++ b/main.cpp Fri Feb 10 19:12:15 2017 +0000 @@ -933,6 +933,7 @@ // pc.printf("\n\r intrpet"); if( slave.receive() == 0) { + //pc.printf("\n\r case 0"); pdir_ss1=PTE->PDIR; /////////edited irpt_2_mstr = 0; data_send_flag = 'h'; @@ -943,9 +944,9 @@ } pdir_ss2=PTE->PDIR; pc.printf("\n\rSlave not addressed"); - pc.printf("\n\rPTE->DIR = 0x%08X",pdir_ss1); + pc.printf("\n\rPTE->DIR1 = 0x%08X",pdir_ss1); #if PRINT2 - pc.printf("\n\rPTE->DIR = 0x%08X",pdir_ss2); + pc.printf("\n\rPTE->DIR2 = 0x%08X",pdir_ss2); #endif } else if( slave.receive() == 1) // slave writes to master @@ -956,13 +957,15 @@ { irpt_2_mstr =1; //pc.printf("\n\r hk "); //wait till cdms code is changed - FCTN_APPEND_HKDATA(); + //FCTN_APPEND_HKDATA(); uint8_t i2c_count =0; //crc is already being added - write_ack=slave.write((char*)BAE_chardata,134); + // write_ack=slave.write((char*)BAE_chardata,134); + write_ack=slave.write((char*)LONG_HK_data[1],134); wait_ms(1); //for correct values of register to be updated pdir_tm1=PTE->PDIR; - irpt_2_mstr = 0; + irpt_2_mstr = 0; + // pc.printf("\n\r case 0.1"); if(write_ack==0)// wait till cdms code is changed { /*checking the tc timings*/ @@ -986,13 +989,13 @@ { #if baby pc.printf("\n\rWrite HK failed"); - pc.printf("\n\rPTE->PDIR = 0x%08X",pdir_tm1); + /// pc.printf("\n\rPTE->PDIR1 = 0x%08X",pdir_tm1); #endif wait_ms(20); //should be atleast 7ms for correct operation but fix this value as 20ms I2C_busreset(); #if baby2 pdir_tm2 = PTE->PDIR; - pc.printf("\n\rPTE->PDIR = 0x%08X",pdir_tm2); + pc.printf("\n\rPTE->PDIR2 = 0x%08X",pdir_tm2); #endif } } @@ -1000,12 +1003,12 @@ { #if baby1 pc.printf("\n\rWrite Ack failed(HK)"); - pc.printf("\n\rPTE->PDIR = 0x%08X",pdir_tm1); + pc.printf("\n\rPTE->PDIR3 = 0x%08X",pdir_tm1); #endif I2C_busreset(); #if baby2 pdir_tm2 = PTE->PDIR; - pc.printf("\n\rPTE->PDIR = 0x%08X",pdir_tm2); + pc.printf("\n\rPTE->PDIR4 = 0x%08X",pdir_tm2); #endif } i2c_count=0; @@ -1037,13 +1040,13 @@ { #if baby pc.printf("\n\rWrite TM failed"); - pc.printf("\n\rPTE->PDIR = 0x%08X",pdir_tm1); + pc.printf("\n\rPTE->PDIR5 = 0x%08X",pdir_tm1); #endif wait_ms(20); //should be atleast 7ms for correct operation but fix this value as 20ms I2C_busreset(); #if baby2 pdir_tm2 = PTE->PDIR; - pc.printf("\n\rPTE->PDIR = 0x%08X",pdir_tm2); + pc.printf("\n\rPTE->PDIR6 = 0x%08X",pdir_tm2); #endif } } @@ -1051,12 +1054,12 @@ { #if baby pc.printf("\n\rWrite Ack failed"); - pc.printf("\n\rPTE->PDIR = 0x%08X",pdir_tm1); + pc.printf("\n\rPTE->PDIR7 = 0x%08X",pdir_tm1); #endif I2C_busreset(); #if baby2 pdir_tm2 = PTE->PDIR; - pc.printf("\n\rPTE->PDIR = 0x%08X",pdir_tm2); + pc.printf("\n\rPTE->PDIR8 = 0x%08X",pdir_tm2); #endif } i2c_count=0; @@ -1066,6 +1069,7 @@ } else if( slave.receive()==3 || slave.receive()==2) // slave read { + pc.printf("\n\r the value %d \n\r",telecommand[0]); BAE_I2C_COUNTER++; /*checking the tc timings*/ @@ -1073,6 +1077,11 @@ uint8_t i2c_count = 0; read_ack=slave.read((char *)telecommand,135); //read() function returns acknowledgement + + + pc.printf("\n\r the value %d \n\r",telecommand[0]); + + wait_ms(1); pdir_tc1=PTE->PDIR; if(read_ack==0) //read() says it was successful @@ -1109,12 +1118,12 @@ { #if baby pc.printf("\n\rRead TC failed"); - pc.printf("\n\rPTE->PDIR = 0x%08X",pdir_tm1); + pc.printf("\n\rPTE->PDIR9 = 0x%08X",pdir_tm1); #endif I2C_busreset(); #if baby2 pdir_tm2 = PTE->PDIR; - pc.printf("\n\rPTE->PDIR = 0x%08X",pdir_tm2); + pc.printf("\n\rPTE->PDIR10 = 0x%08X",pdir_tm2); #endif gen_I_TM(); data_send_flag = 't'; @@ -1125,12 +1134,12 @@ { #if baby pc.printf("\n\rRead Ack failed"); - pc.printf("\n\rPTE->PDIR = 0x%08X",pdir_tm1); + pc.printf("\n\rPTE->PDIR11 = 0x%08X",pdir_tm1); #endif I2C_busreset(); #if baby2 pdir_tm2 = PTE->PDIR; - pc.printf("\n\rPTE->PDIR = 0x%08X",pdir_tm2); + pc.printf("\n\rPTE->PDIR12 = 0x%08X",pdir_tm2); #endif //pc.printf("\n\r no data case"); gen_I_TM(); @@ -1218,6 +1227,7 @@ timer_F_ACS.reset(); timer_F_ACS.start(); F_ACS(); + FCTN_APPEND_HKDATA(); timer_F_ACS.stop(); /*pc.printf("\n\r timer_F_ACS is %f",timer_F_ACS.read()); pc.printf("\n\r timer_SENSOR_INIT is %f",timer_SENSOR_INIT.read()); @@ -1241,6 +1251,12 @@ timer_F_ESP.start(); F_EPS(); timer_F_ESP.stop(); + int zz; + pc.printf("\n\r"); + for(zz=0;zz<134;zz++) + { + pc.printf("%x ",LONG_HK_data[0][zz]); + } pc.printf("\n\r timer_F_ESP is %f",timer_F_ESP.read()); /* pc.printf("\n\r timer_FCTN_BATTERYGAUGE_INIT is %f",timer_FCTN_BATTERYGAUGE_INIT.read()); pc.printf("\n\r timer_alertFlags is %f",timer_alertFlags.read()); @@ -1491,7 +1507,7 @@ irpt_2_mstr = 0; ptr_t_i2c = new Thread(T_TC); - ptr_t_i2c->set_priority(osPriorityHigh);////osPriorityRealtime + ptr_t_i2c->set_priority(osPriorityRealtime);////osPriorityHigh irpt_4m_mstr.enable_irq(); irpt_4m_mstr.rise(&FCTN_I2C_ISR);