/* Set up frequency of each carrier */
for(c=0; c<NC/2; c++) {
- carrier_freq = (-NC/2 + c)*FSEP + FCENTRE;
+ carrier_freq = (-NC/2 + c)*FSEP + FDMDV_FCENTRE;
f->freq[c].real = cos(2.0*PI*carrier_freq/FS);
f->freq[c].imag = sin(2.0*PI*carrier_freq/FS);
}
for(c=NC/2; c<NC; c++) {
- carrier_freq = (-NC/2 + c + 1)*FSEP + FCENTRE;
+ carrier_freq = (-NC/2 + c + 1)*FSEP + FDMDV_FCENTRE;
f->freq[c].real = cos(2.0*PI*carrier_freq/FS);
f->freq[c].imag = sin(2.0*PI*carrier_freq/FS);
}
- f->freq[NC].real = cos(2.0*PI*FCENTRE/FS);
- f->freq[NC].imag = sin(2.0*PI*FCENTRE/FS);
+ f->freq[NC].real = cos(2.0*PI*FDMDV_FCENTRE/FS);
+ f->freq[NC].imag = sin(2.0*PI*FDMDV_FCENTRE/FS);
/* Generate DBPSK pilot Look Up Table (LUT) */
foff_rect->real = cos(2.0*PI*foff/FS);
foff_rect->imag = sin(2.0*PI*foff/FS);
for(i=0; i<nin; i++) {
- *foff_phase_rect = cmult(*foff_phase_rect, cconj(*foff_rect));
+ *foff_phase_rect = cmult(*foff_phase_rect, *foff_rect);
rx_fdm_fcorr[i] = cmult(rx_fdm[i], *foff_phase_rect);
}
if (fdmdv->coarse_fine == COARSE)
fdmdv->foff = foff_coarse;
- fdmdv_freq_shift(rx_fdm_fcorr, rx_fdm, fdmdv->foff, &fdmdv->foff_rect, &fdmdv->foff_phase_rect, *nin);
+ fdmdv_freq_shift(rx_fdm_fcorr, rx_fdm, -fdmdv->foff, &fdmdv->foff_rect, &fdmdv->foff_phase_rect, *nin);
/* baseband processing */
#define FDMDV_MAX_SAMPLES_PER_FRAME 200 /* max demod samples/frame, use this to allocate storage */
#define FDMDV_SCALE 1000 /* suggested scaling for 16 bit shorts */
#define FDMDV_NSYM 15
+#define FDMDV_FCENTRE 1200 /* Centre frequency, Nc/2 carriers below this, Nc/2 carriers above (Hz) */
/* 8 to 48 kHz sample rate conversion */
#define FS 8000 /* sample rate in Hz */
#define T (1.0/FS) /* sample period in seconds */
#define RS 50 /* symbol rate in Hz */
-#define NC 14 /* number of carriers */
+#define NC 14 /* number of data carriers (plus one pilot in the centre) */
#define NB 2 /* Bits/symbol for QPSK modulation */
#define RB (NC*RS*NB) /* bit rate */
#define M (FS/RS) /* oversampling factor */
#define NFILTER (NSYM*M) /* size of tx/rx filters at sample rate M */
#define FSEP 75 /* Separation between carriers (Hz) */
-#define FCENTRE 1200 /* Centre frequency, Nc/2 carriers below this, Nc/2 carriers above (Hz) */
#define NT 5 /* number of symbols we estimate timing over */
#define P 4 /* oversample factor used for initial rx symbol filtering */
#define COARSE 0
#define FINE 1
-#define TRACK_COEFF 0.5
+/* averaging filter coeffs */
+
+#define TRACK_COEFF 0.5
#define SNR_COEFF 0.9 /* SNR est averaging filter coeff */
/*---------------------------------------------------------------------------*\
A FIFO design useful in gluing the FDMDV modem and codec together in
integrated applications. The unittest/tfifo indicates these
- routines are thread safe without the need for syncronisisation
+ routines are thread safe without the need for syncronisation
object, e.g. a different thread can read and write to a fifo at the
same time.