
Repository for CDMS code
Dependencies: SimpleDMA mbed-rtos mbed eeprom
Fork of COM_MNG_TMTC_SIMPLE by
Revision 166:2174ce7f153e, committed 2016-04-19
- Comitter:
- ee12b079
- Date:
- Tue Apr 19 17:49:26 2016 +0000
- Parent:
- 165:60a4a23131a3
- Commit message:
- Not working;
Changed in this revision
adf.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/adf.h Tue Apr 19 17:03:29 2016 +0000 +++ b/adf.h Tue Apr 19 17:49:26 2016 +0000 @@ -232,7 +232,11 @@ gCS_ADF=1;\ SPI_mutex.unlock();\ } - + +bool data_err= false; +unsigned char temp11=0x00; +int data_err_arr[400]; +int j1=0; #define write_data {\ SPI_mutex.lock();\ gCS_ADF=0;\ @@ -240,6 +244,8 @@ spi.write(0x36);\ spi.write(0xFF);\ gCS_ADF=1;\ + data_err=true;\ + while(data_err){\ gCS_ADF=0;\ if(buffer_state){\ spi.write(0x18);\ @@ -264,21 +270,43 @@ }\ }\ gCS_ADF=1;\ + wait_us(1);\ + data_err=false;\ + gCS_ADF=0;\ + if(buffer_state){\ + spi.write(0x38);\ + spi.write(0x20);\ + spi.write(0xFF);\ + for(unsigned char i=0; i<112;i++){\ + if(buffer_112[i]!=spi.write(0xFF)){\ + data_err=true;\ + }\ + /*gPC.printf("0x%X,",spi.write(buffer_112[i]));*/\ + }\ + }\ + else{\ + spi.write(0x38);\ + spi.write(0x90);\ + spi.write(0xFF);\ + for(unsigned char i=0; i<112;i++){\ + if(buffer_112[i]!=spi.write(0xFF)){\ + data_err=true;\ + }\ + /*gPC.printf("0x%X,",spi.write(buffer_112[i]));*/\ + }\ + }\ + gCS_ADF=1;\ + data_err_arr[j1]++;\ + }\ SPI_mutex.unlock();\ buffer_state = !buffer_state;\ if(last_buffer){\ finish_write_data = true;\ /*gPC.puts("adf_off\r\n");*/\ }\ + j1++;\ } -/* -void check(){ - if(IRQ){ - gCOM_MNG_TMTC_THREAD->signal_set(signal); - } -}*/ - #define send_data {\ if(sent_tmfrom_SDcard){\ @@ -298,6 +326,9 @@ }else{\ snd_tm.transmit_data(buffer_112,&last_buffer);\ }\ + for(unsigned char i=0; i<112;i++){\ + data_err_arr[i]=-1;\ + }\ SPI_mutex.lock();\ gCS_ADF=0;\ spi.write(0xB1);\ @@ -354,6 +385,11 @@ spi.write(0xB1);\ gCS_ADF=1;\ SPI_mutex.unlock();\ + for(unsigned int i=0;i<400;i++){\ + gPC.puts("%d\t",data_err_arr[i]);\ + if(i%28==0)\ + gPC.puts("\n");\ + }\ loop_on = false;\ gPC.puts("Transmission done\r\n");\ gLEDR = 1;\