frequency error is actually twice of what we thought.
authorHarald Welte <laforge@gnumonks.org>
Thu, 18 Feb 2010 18:32:07 +0000 (19:32 +0100)
committerHarald Welte <laforge@gnumonks.org>
Thu, 18 Feb 2010 18:32:07 +0000 (19:32 +0100)
The cause is really not clear.  The formual using 2*Pi to convert
from radians to frequency is perfectly correct.

However, measurements with various test equipment (including Racal 6103)
have shown our frequency error estimate is always off by a power of two...

src/target/firmware/layer1/afc.c
src/target/firmware/layer1/sync.c

index 846d208..000bb35 100644 (file)
@@ -64,7 +64,8 @@ static struct afc_state afc_state = {
 #define AFC_NORM_FACTOR_DCS    ((1<<15) / 1894)
 
 /* we assume 4.9ppb per LSB, equals 0.0049 * 32768 == 160 */
-#define AFC_SLOPE              160
+//#define AFC_SLOPE            160
+#define AFC_SLOPE              320
 //#define AFC_SLOPE            141
 
 /* The DSP can measure the frequency error in the following ranges:
index 088b2ea..a4d48a5 100644 (file)
@@ -155,8 +155,9 @@ static void l1ddsp_meas_read(uint8_t nbmeas, uint16_t *pm)
 
 /* Convert an angle in fx1.15 notatinon into Hz */
 #define BITFREQ_DIV_2PI                43104   /* 270kHz / 2 * pi */
+#define BITFREQ_DIV_PI         86208   /* 270kHz / pi */
 #define ANG2FREQ_SCALING       (2<<15) /* 2^15 scaling factor for fx1.15 */
-#define ANGLE_TO_FREQ(angle)   ((int16_t)angle * BITFREQ_DIV_2PI / ANG2FREQ_SCALING)
+#define ANGLE_TO_FREQ(angle)   ((int16_t)angle * BITFREQ_DIV_PI / ANG2FREQ_SCALING)
 
 #define AFC_MAX_ANGLE          328     /* 0.01 radian in fx1.15 */
 #define AFC_SNR_THRESHOLD      2560    /* 2.5 dB in fx6.10 */