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.
Fork of BAE_hw_test1_5 by
Revision 9:7936b618a879, committed 2015-04-06
- Comitter:
- greenroshks
- Date:
- Mon Apr 06 15:53:24 2015 +0000
- Parent:
- 8:6d856d863537
- Commit message:
- pcb test start
Changed in this revision
--- a/ACS.cpp Wed Mar 04 18:14:01 2015 +0000 +++ b/ACS.cpp Mon Apr 06 15:53:24 2015 +0000 @@ -7,8 +7,8 @@ //PWM output comes from pins p6 Serial pc1(USBTX, USBRX); SPI spi_acs (PIN16, PIN17, PIN15); // mosi, miso, sclk PTE18,19,17 -DigitalOut SSN_MAG (PTC16); // ssn for magnetometer PTB11 -DigitalInOut DRDY (PTE3); // drdy for magnetometer PTA17 +DigitalOut SSN_MAG (PIN61); // ssn for magnetometer PTB11 +DigitalInOut DRDY (PIN47); // drdy for magnetometer PTA17 DigitalOut ssn_gyr (PTE2); //Slave Select pin of gyroscope PTB16 InterruptIn dr(PTC6); //Interrupt pin for gyro PTC5 PwmOut PWM1(D2); //Functions used to generate PWM signal @@ -228,7 +228,7 @@ DRDY.write(0); int a; a = DRDY; - printf("\n\r DRDY is %d\n\r",a); + //printf("\n\r DRDY is %d\n\r",a); SSN_MAG=0; //enabling slave to measure the values wait_ms(10); spi_acs.write(0x82); //initiates measurement @@ -355,12 +355,12 @@ for(i=0;i<3;i++) { - printf("\n\rreached here\n\r"); + // printf("\n\rreached here\n\r"); if(den!=0) b[i]=b[i]/den; //there is a problem here. The code gets stuck here. Maf value is required } - + //printf("\nhere\n"); // select kz, kmu, gamma if(b[0]>0.9 || b[0]<-0.9) { @@ -368,6 +368,7 @@ kmu = kmu2; gamma = gamma2; } + printf("\nhere\n"); // calculate Mu, v, dv, z, u for(i=0;i<2;i++) {
--- a/main.cpp Wed Mar 04 18:14:01 2015 +0000 +++ b/main.cpp Mon Apr 06 15:53:24 2015 +0000 @@ -7,6 +7,7 @@ #include "fault.h" #include "slave.h" #include "mnm.h" +#include "pin_config.h" Serial pc(USBTX, USBRX); @@ -107,8 +108,8 @@ printf("\n\rTHIS IS ACS %f\n\r",t1.read()); t.start(); mag_field= FUNC_ACS_MAG_EXEC(); //actual execution - omega = FUNC_ACS_EXEC_GYR(); - printf("\n\r gyr 1 value %f",omega[0]); + //omega = FUNC_ACS_EXEC_GYR(); + //printf("\n\r gyr 1 value %f",omega[0]); mnm_data=EXECUTE_PNI(); //the angular velocity is stored in the first 3 values and magnetic field values in next 3 printf("\n\rmnm gyro values\n"); //printing the angular velocity and magnetic field values for(int i=0; i<3; i++) @@ -119,17 +120,24 @@ for(int i=3; i<6; i++) { printf("%f\t",mnm_data[i]); } - for(int i = 0 ; i<3;i++) + /*for(int i = 0 ; i<3;i++) { omega1[i] = mnm_data[i]; } for( int i = 3;i<6;i++) { mag_field1[i-3] = mnm_data[i]; - } + }*/ + acs_pflag =1; //to be changed later 5/4/15 + omega1[0] = 1; + omega1[1] = 1; + omega1[2] = 1; + mag_field[0] = -38; + mag_field[1] = 1; + mag_field[2] = 5; if(acs_pflag == 1) { - FUNC_ACS_CNTRLALGO(mag_field1,omega1,tauc1); + FUNC_ACS_CNTRLALGO(mag_field,omega1,tauc1); //mag field to be in micro tesla printf("\n\r control algo values "); for(int i=0; i<3; i++) { @@ -147,7 +155,8 @@ t.reset(); } -}/* +} +/* void T_ACS_WRITE2FLASH(void const *args) { while(1) @@ -404,12 +413,12 @@ if(schedcount%1==0) { ptr_t_acs -> signal_set(0x1); - ptr_t_wdt -> signal_set(0x5); + // ptr_t_wdt -> signal_set(0x5); } if(schedcount%2==0) { // ptr_t_fault -> signal_set(0x2); - ptr_t_hk_acq -> signal_set(0x2); + // ptr_t_hk_acq -> signal_set(0x2); } if(schedcount%beacon_sc==0) @@ -417,7 +426,7 @@ if(beac_flag==0) { - ptr_t_bea -> signal_set(0x3); + // ptr_t_bea -> signal_set(0x3); } } schedcount++; @@ -434,7 +443,7 @@ INIT_PNI(); FUNC_ACS_MAG_INIT(); - FUNC_ACS_INIT_GYR(); + //FUNC_ACS_INIT_GYR(); slave.address(0x20); ptr_t_hk_acq = new Thread(T_HK_ACQ); @@ -447,7 +456,7 @@ //ptr_t_sc = new Thread(T_SC); ptr_t_wdt = new Thread(T_WDT); - interrupt_fault(); + //interrupt_fault(); //ptr_t_fault -> set_priority(osPriorityRealtime); ptr_t_acs->set_priority(osPriorityAboveNormal);
--- a/mnm.cpp Wed Mar 04 18:14:01 2015 +0000 +++ b/mnm.cpp Mon Apr 06 15:53:24 2015 +0000 @@ -2,7 +2,7 @@ #include "mnm.h" #include "pni.h" //pni header file Serial mnm(USBTX,USBRX); //for usb communication -I2C i2c (PTC9,PTC8); //PTC2-sda,PTC1-scl +I2C i2c (PIN85,PIN84); //PTC2-sda,PTC1-scl /*void INIT_PNI(void); //initialization of registers happens float *EXECUTE_PNI(); //data is obtained void T_OUT(); //timeout function to stop infinite loop*/
--- a/mnm.h Wed Mar 04 18:14:01 2015 +0000 +++ b/mnm.h Mon Apr 06 15:53:24 2015 +0000 @@ -1,3 +1,4 @@ +#include "pin_config.h" void INIT_PNI(void); //initialization of registers happens float *EXECUTE_PNI(); //data is obtained void T_OUT(); //timeout function to stop infinite loop