General testings

Dependencies:   mbed

Fork of BEACON_CODE_NEW by Mohamed Azad

Files at this revision

API Documentation at this revision

Comitter:
shekhar
Date:
Mon Nov 02 14:09:45 2015 +0000
Parent:
28:5bac883a0372
Child:
30:ca96cddf25d0
Commit message:
Removed the redundant registers (e.g. rx regs)

Changed in this revision

BCN.cpp Show annotated file Show diff for this revision Revisions of this file
BCN.h Show annotated file Show diff for this revision Revisions of this file
--- a/BCN.cpp	Sun Nov 01 08:30:56 2015 +0000
+++ b/BCN.cpp	Mon Nov 02 14:09:45 2015 +0000
@@ -58,7 +58,7 @@
             {       
                     //transmit short beacon and long beacon
                     SHORT_BCN_TX();
-                    //LONG_BCN_TX();
+                    LONG_BCN_TX();
                     
                     if(Check_ACK_RECEIVED() == 1)
                     {
@@ -164,7 +164,7 @@
     cs = 1;
     
     //Set to Tx mode
-    writereg(RF22_REG_07_OPERATING_MODE1,0x09);
+    writereg(RF22_REG_07_OPERATING_MODE1,0x08);
     wait(0.1);  
     //Check for fifoThresh
     while(timeout_count--)if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x20) == 0x20)break;
@@ -193,12 +193,7 @@
     {
         Long_beacon[i] = 0xA0;
     }
-   
-   
-   
     
-    //setModeIdle();
-    writereg(RF22_REG_07_OPERATING_MODE1,0x01);        //ready mode    
     clearTxBuf();     
     //writing data first time
     cs = 0;
@@ -210,7 +205,7 @@
     cs = 1;
     
     //Set to Tx mode
-    writereg(RF22_REG_07_OPERATING_MODE1,0x09);
+    writereg(RF22_REG_07_OPERATING_MODE1,0x08);
     wait(0.1);
     
     //Check for fifoThresh
@@ -271,19 +266,13 @@
     writereg(RF22_REG_08_OPERATING_MODE2,0x01);
     writereg(RF22_REG_08_OPERATING_MODE2,0x00);
 }
-uint8_t setFrequency(double centre,float afcPullInRange)
+uint8_t setFrequency(double centre)
 {
     uint8_t fbsel = 0x40;
-    uint8_t afclimiter;
     if (centre >= 480.0) {
         centre /= 2;
         fbsel |= 0x20;
-        afclimiter = afcPullInRange * 1000000.0 / 1250.0;
-    } else {
-        if (afcPullInRange < 0.0 || afcPullInRange > 0.159375)
-            return false;
-        afclimiter = afcPullInRange * 1000000.0 / 625.0;
-    }
+    } 
     centre /= 10.0;
     double integerPart = floor(centre);
     double fractionalPart = centre - integerPart;
@@ -296,7 +285,6 @@
     writereg(RF22_REG_75_FREQUENCY_BAND_SELECT, fbsel);
     writereg(RF22_REG_76_NOMINAL_CARRIER_FREQUENCY1, fc >> 8);
     writereg(RF22_REG_77_NOMINAL_CARRIER_FREQUENCY0, fc & 0xff);
-    writereg(RF22_REG_2A_AFC_LIMITER, afclimiter);
     return 0;
 }
 
@@ -336,7 +324,7 @@
     writereg(RF22_REG_0B_GPIO_CONFIGURATION0,0x15); // TX state                        
     writereg(RF22_REG_0C_GPIO_CONFIGURATION1,0x12); // RX state                        
 
-    setFrequency(435.0,0.05);
+    setFrequency(435.0);
 
     if((readreg(RF22_REG_02_DEVICE_STATUS)& 0x08)!= 0x00)
         {
@@ -345,19 +333,7 @@
         }
 
     //set Modem Configuration
-    writereg(RF22_REG_1C_IF_FILTER_BANDWIDTH,0xdf);
-    writereg(RF22_REG_1F_CLOCK_RECOVERY_GEARSHIFT_OVERRIDE,0x03);
-    writereg(RF22_REG_20_CLOCK_RECOVERY_OVERSAMPLING_RATE,0x39);
-    writereg(RF22_REG_21_CLOCK_RECOVERY_OFFSET2,0x20);                     
-    writereg(RF22_REG_22_CLOCK_RECOVERY_OFFSET1,0x68);           //updated 20 to 25 reg values from excel sheet for 1.2 Khz freq. deviation,fsk
-    writereg(RF22_REG_23_CLOCK_RECOVERY_OFFSET0,0xdc);
-    writereg(RF22_REG_24_CLOCK_RECOVERY_TIMING_LOOP_GAIN1,0x00);
-    writereg(RF22_REG_25_CLOCK_RECOVERY_TIMING_LOOP_GAIN0,0x6B);
-    writereg(RF22_REG_2C_OOK_COUNTER_VALUE_1,0x2C);
-    writereg(RF22_REG_2D_OOK_COUNTER_VALUE_2,0x11);    //not required for fsk (OOK counter value)
-    writereg(RF22_REG_2E_SLICER_PEAK_HOLD,0x2A);         //??
     writereg(RF22_REG_58,0x80);
-    writereg(RF22_REG_69_AGC_OVERRIDE1,0x60);
     
     //Data rate set later
       
--- a/BCN.h	Sun Nov 01 08:30:56 2015 +0000
+++ b/BCN.h	Mon Nov 02 14:09:45 2015 +0000
@@ -26,7 +26,7 @@
 void writereg(uint8_t,uint8_t);
 uint8_t readreg(uint8_t);
 void clearTxBuf();
-uint8_t setFrequency(double,float);
+uint8_t setFrequency(double);
 bool Check_ACK_RECEIVED();
 void reset_rfm();