Dheeraj M Pai
/
October_22_11AM____Worksproperly_till_bbram
Works properly tilll bbram
Diff: main.cpp
- Revision:
- 1:9cd986151b11
- Parent:
- 0:cb8104f3ae71
- Child:
- 2:3ad3165e4d6c
diff -r cb8104f3ae71 -r 9cd986151b11 main.cpp --- a/main.cpp Thu Oct 22 09:43:36 2015 +0000 +++ b/main.cpp Thu Oct 22 10:01:48 2015 +0000 @@ -28,7 +28,7 @@ /****************************/ SPI adf(PTA16, MISO_PIN, PTA15); //MOSI, MISO, CLOCK -DigitalOut CS(D9); +DigitalOut CS(D7); //DigitalOut CS(PTD4);//D10==PTD4 Serial PC(USBTX, USBRX); DigitalOut ledr(LED1); @@ -307,12 +307,12 @@ adf.write(0xFF);//Put Low CS=1; wait_us(80); - CS=0; + // CS=0; // a[r]=t.read_us(); j++; // r++; - CS=1; +// CS=1; wait_us(1); } @@ -369,9 +369,10 @@ } /*******ADDITIONAL STUFF****************/ unsigned char check_status(void){ + unsigned char stat=0; CS=0; adf.write(0xFF); - unsigned char stat = adf.write(0xFF); + stat = adf.write(0xFF); CS=1; return stat; } @@ -476,7 +477,7 @@ adf.write(CMD_HW_RESET); CS=1; wait_ms(2);// Typically 1 ms - while(count<1000 && miso_err_cnt<1000){ + while(count<10 && miso_err_cnt<10){ if(MISO_PIN){ if(!assrt_phy_off(0,0,0)){ @@ -489,7 +490,7 @@ miso_err_cnt++; } } - if(count==1000 ||miso_err_cnt==1000){ + if(count==10 ||miso_err_cnt==10){ return hardware_reset(bcn_call+1); } else @@ -517,6 +518,7 @@ } else{ hardware_reset(0); // Asserts Hardware for 20sec(20times). PHY_OFF for 20,000 times + hw_reset_err_cnt++; } } state_0=assrt_phy_off(0,0,0);// We actually do not need this but make sure "we do not need this"