Updated EPS code with flowchart v2.3 (CDMS and HW faults)
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of QM_BAE_review_1_EPS_faults by
Revision 8:82250e41da81, committed 2016-03-12
- Comitter:
- sakthipriya
- Date:
- Sat Mar 12 12:54:14 2016 +0000
- Parent:
- 7:a46a1dee4497
- Child:
- 9:194afacf7449
- Commit message:
- modifying tctm
Changed in this revision
--- a/ACS.cpp Sat Jan 23 11:35:20 2016 +0000 +++ b/ACS.cpp Sat Mar 12 12:54:14 2016 +0000 @@ -349,6 +349,7 @@ pc_acs.printf("DC for trx is %f \r \n",l_duty_cycle_x); PWM1.period(TIME_PERIOD); PWM1 = l_duty_cycle_x/100 ; + } else if( l_current_x >= 0.006 && l_current_x < 0.0116) {
--- a/TCTM.cpp Sat Jan 23 11:35:20 2016 +0000 +++ b/TCTM.cpp Sat Mar 12 12:54:14 2016 +0000 @@ -32,7 +32,7 @@ uint8_t service_type=(tc[2]&0xF0); uint8_t* tm; uint16_t crc16; - + switch(service_type) { @@ -50,9 +50,36 @@ case 0x02: { printf("Read from RAM\r\n"); - switch(tc[3]) + + uint16_t MID = ((uint16_t)tc[3] << 8) | tc[4]; + switch(MID ) { - case 0x01: + case 0x0010: + { + printf("Read MUX DATA\r\n"); + tm[0] = 0x60; + tm[1] = tc[0]; + tm[2] = ACK_CODE; + for(int i=0; i<3; i++) + FCTN_CONVERT_FLOAT(actual_data.Bvalue_actual[i],&tm[4+ (i*4)]); //tm[4] - tm[7] + for(int i=0; i<3; i++) + FCTN_CONVERT_FLOAT(actual_data.AngularSpeed_actual[i],&tm[35+(i*4)]); // + + for(int i=0; i<16; i++) //16*4 = 64 bytes //tm[4] to tm[67] filled + FCTN_CONVERT_FLOAT(actual_data.voltage_actual[i], &tm[4+(i*4)]); + for(int i=0; i<12; i++) //12*4 = 48 //tm[68] to tm[115] filled + FCTN_CONVERT_FLOAT(actual_data.current_actual[i],&tm[68 + (i*4)]); + for (int i=116; i<132;i++) + { + tm[i] = 0x00; + } + crc16 = CRC::crc16_gen(tm,132); + tm[132] = (uint8_t)((crc16&0xFF00)>>8); + tm[133] = (uint8_t)(crc16&0x00FF); + return tm; + } + //......................... + case 0x0010: { printf("Read MUX DATA\r\n"); tm[0] = 0x60; @@ -71,12 +98,18 @@ tm[133] = (uint8_t)(crc16&0x00FF); return tm; } - case 0x02: + //.......................................... + case 0x2: { printf("Read HK\r\n"); tm[0] = 0x60; tm[1] = tc[0]; tm[2] = ACK_CODE; + for(int i=0; i<3; i++) + FCTN_CONVERT_FLOAT(actual_data.Bvalue_actual[i],&tm[4+ (i*4)]); //tm[4] - tm[7] + for(int i=0; i<3; i++) + FCTN_CONVERT_FLOAT(actual_data.AngularSpeed_actual[i],&tm[35+(i*4)]); // + FCTN_CONVERT_FLOAT(actual_data.Batt_temp_actual[0],&tm[4]); //tm[4]-tm[7] FCTN_CONVERT_FLOAT(actual_data.Batt_temp_actual[1],&tm[8]); //tm[8]- tm[11] for(int i=0; i<4; i++) @@ -85,10 +118,6 @@ tm[32] = (uint8_t)actual_data.power_mode; tm[33] = actual_data.faultPoll_status; tm[34] = actual_data.faultIr_status; - for(int i=0; i<3; i++) - FCTN_CONVERT_FLOAT(actual_data.AngularSpeed_actual[i],&tm[35+(i*4)]); //35 -46 - for(int i=0; i<3; i++) - FCTN_CONVERT_FLOAT(actual_data.Bvalue_actual[i],&tm[47+(i*4)]); //47 -58 FCTN_CONVERT_FLOAT(actual_data.Batt_voltage_actual,&tm[59]); //59 - 62 for (int i=63; i<132;i++) { @@ -100,7 +129,7 @@ return tm; } - case 0x03: + case 0x3: { printf("Read min max data"); tm[0] = 0x60; @@ -152,7 +181,7 @@ tm[133] = (uint8_t)(crc16&0x00FF); return tm; } - case 0x04: + case 0x4: { printf("Read status"); tm[0] = 0x60;
--- a/main.cpp Sat Jan 23 11:35:20 2016 +0000 +++ b/main.cpp Sat Mar 12 12:54:14 2016 +0000 @@ -130,6 +130,12 @@ void F_ACS() { + + //........dummy check..........// + PWM1 = 0.56; + printf ("\n\r pwm1 value %f",PWM1); + //...................// + if(pf1check == 1) { if(iterP1 >= 3)