To be debugged
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of TFR_BAE_vr1_1_Debug153 by
Revision 9:f66c57a01e05, committed 2016-02-03
- Comitter:
- Bragadeesh153
- Date:
- Wed Feb 03 18:41:17 2016 +0000
- Parent:
- 8:aad4f22221b1
- Commit message:
- To be debugged
Changed in this revision
ACS.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/ACS.cpp Mon Jan 25 17:27:26 2016 +0000 +++ b/ACS.cpp Wed Feb 03 18:41:17 2016 +0000 @@ -24,10 +24,15 @@ DigitalOut phase_TR_x(PIN27); // PHASE pin for x-torquerod DigitalOut phase_TR_y(PIN28); // PHASE pin for y-torquerod DigitalOut phase_TR_z(PIN86); // PHASE pin for z-torquerod +DigitalOut TRZ_EN(PIN88); -extern PwmOut PWM1; //x //Functions used to generate PWM signal -extern PwmOut PWM2; //y -extern PwmOut PWM3; //z //PWM output comes from pins p6 +//extern PwmOut PWM1; //x //Functions used to generate PWM signal +//extern PwmOut PWM2; //y +//extern PwmOut PWM3; //z //PWM output comes from pins p6 + +PwmOut PWM1(PIN93); //x //Functions used to generate PWM signal +PwmOut PWM2(PIN94); //y +PwmOut PWM3(PIN95); //z //PWM output comes from pins p6 int g_err_flag_TR_x=0; // setting x-flag to zero int g_err_flag_TR_y=0; // setting y-flag to zero @@ -451,6 +456,8 @@ void FCTN_ACS_INIT() { + + TRZ_EN = 1; ACS_INIT_STATUS = 's'; //set ACS_INIT_STATUS flag //FLAG(); pc_acs.printf("Attitude sensor init called \n \r"); @@ -599,7 +606,9 @@ l_moment_x = abs(l_moment_x); } - l_current_x = l_moment_x * TR_CONSTANT ; //Moment and Current always have the linear relationship + // l_current_x = l_moment_x * TR_CONSTANT ; + + l_current_x = 0.153; //Moment and Current always have the linear relationship pc_acs.printf("current in trx is %f \r \n",l_current_x); if( l_current_x>0 && l_current_x < 0.0016 ) //Current and Duty cycle have the linear relationship between 1% and 100% { @@ -642,6 +651,8 @@ float l_moment_y = Moment[1]; //Moment in y direction phase_TR_y = 1; // setting the default current direction + + if (l_moment_y <0) { phase_TR_y = 0; //if the moment value is negative, we send the abs value of corresponding current in opposite direction by setting the phase pin high @@ -649,7 +660,9 @@ } - l_current_y = l_moment_y * TR_CONSTANT ; //Moment and Current always have the linear relationship + //l_current_y = l_moment_y * TR_CONSTANT ; //Moment and Current always have the linear relationship + + l_current_y = 0.153; pc_acs.printf("current in try is %f \r \n",l_current_y); if( l_current_y>0 && l_current_y < 0.0016 ) //Current and Duty cycle have the linear relationship between 1% and 100% { @@ -697,7 +710,9 @@ } - l_current_z = l_moment_z * TR_CONSTANT ; //Moment and Current always have the linear relationship + // l_current_z = l_moment_z * TR_CONSTANT ; //Moment and Current always have the linear relationship + + l_current_z = 0.153; pc_acs.printf("current in trz is %f \r \n",l_current_z); if( l_current_z>0 && l_current_z < 0.0016 ) //Current and Duty cycle have the linear relationship between 1% and 100% { @@ -737,6 +752,10 @@ printf("\n\rExited executable PWMGEN function\n\r"); // stating the successful exit of TR function + //PWM1 = 0.95; + //PWM2 = 0.95; + //PWM3 = 0.95; + }
--- a/main.cpp Mon Jan 25 17:27:26 2016 +0000 +++ b/main.cpp Wed Feb 03 18:41:17 2016 +0000 @@ -8,11 +8,13 @@ #define tm_len 134 #define tc_len 135 + #define batt_heat_low 20 //***************************************************** flags *************************************************************// uint32_t BAE_STATUS = 0x00000000; uint32_t BAE_ENABLE = 0xFFFFFFFF; + //i2c// char data_send_flag = 'h'; @@ -82,9 +84,9 @@ DigitalOut batt_heat(PIN96); //gpo1 = 0; -PwmOut PWM1(PIN93); //x //Functions used to generate PWM signal -PwmOut PWM2(PIN94); //y -PwmOut PWM3(PIN95); //z //PWM output comes from pins p6 +//PwmOut PWM1(PIN93); //x //Functions used to generate PWM signal +//PwmOut PWM2(PIN94); //y +//PwmOut PWM3(PIN95); //z //PWM output comes from pins p6 //........faults //Polled Faults @@ -108,6 +110,10 @@ DigitalOut BCN_SW(PIN14); //Beacon switch DigitalOut DRV_XY_SLP(PIN82); +extern PwmOut PWM1; //x //Functions used to generate PWM signal +extern PwmOut PWM2; //y +extern PwmOut PWM3; //z //PWM output comes from pins p6 + @@ -195,9 +201,9 @@ //Thread::signal_wait(0x1); ACS_MAIN_STATUS = 's'; //set ACS_MAIN_STATUS flag - PWM1 = 0; //clear pwm pins - PWM2 = 0; //clear pwm pins - PWM3 = 0; //clear pwm pins + //PWM1 = 0; //clear pwm pins + //PWM2 = 0; //clear pwm pins + //PWM3 = 0; //clear pwm pins pc.printf("\n\rEntered ACS %f\n",t_start.read()); if(ACS_DATA_ACQ_ENABLE == 'e')// check if ACS_DATA_ACQ_ENABLE = 1? @@ -269,11 +275,17 @@ ACS_STATUS = '4'; // set ACS_STATUS = ACS_NOMINAL_ONLY FCTN_ACS_CNTRLALGO(moment,actual_data.Bvalue_actual,actual_data.AngularSpeed_actual,b_old,alarmmode, flag_firsttime, controlmode); printf("\n\r moment values returned by control algo \n"); + moment[0] = moment[1] = moment[2] = 0.8 ; + for(int i=0; i<3; i++) { printf("%f\t",moment[i]); + } - FCTN_ACS_GENPWM_MAIN(moment) ; + FCTN_ACS_GENPWM_MAIN(moment) ; + //PWM1 = 0.95; + //PWM3 = 0.95; + //PWM2 = 0.95; } else { @@ -595,7 +607,7 @@ if(schedcount%2==0) { - F_EPS(); + //F_EPS(); } if(schedcount%3==0) { @@ -723,7 +735,7 @@ EPS_BATTERY_HEAT_ENABLE = 'e'; //............................// FCTN_ACS_INIT(); - FCTN_EPS_INIT(); + //FCTN_EPS_INIT(); //P_BCN_INIT(); @@ -748,6 +760,7 @@ gpo1 = 0; FLAG(); FCTN_BAE_INIT(); + actual_data.power_mode = 2; //...i2c..