diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-02-18 19:32:07 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-02-18 19:32:07 +0100 |
commit | 2df0b01363992deecf35cd8aee7cd5fec9aae7c6 (patch) | |
tree | 2f3d95b217ecef21883c9216235490362f632367 /src/target/firmware/layer1 | |
parent | 18ab2998bb1c90829d485487190f8151088300c3 (diff) |
frequency error is actually twice of what we thought.
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...
Diffstat (limited to 'src/target/firmware/layer1')
-rw-r--r-- | src/target/firmware/layer1/afc.c | 3 | ||||
-rw-r--r-- | src/target/firmware/layer1/sync.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/target/firmware/layer1/afc.c b/src/target/firmware/layer1/afc.c index 846d208f..000bb358 100644 --- a/src/target/firmware/layer1/afc.c +++ b/src/target/firmware/layer1/afc.c @@ -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: diff --git a/src/target/firmware/layer1/sync.c b/src/target/firmware/layer1/sync.c index 088b2ea7..a4d48a57 100644 --- a/src/target/firmware/layer1/sync.c +++ b/src/target/firmware/layer1/sync.c @@ -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 */ |