Skip to content

Commit

Permalink
Fixed TXRX filter length mismatch. Now lengths are calculated first a…
Browse files Browse the repository at this point in the history
…nd minimum is used during design process.

Signed-off-by: Travis Collins <[email protected]>
  • Loading branch information
tfcollins committed Apr 5, 2018
1 parent 53cad0f commit 93d4a22
Show file tree
Hide file tree
Showing 18 changed files with 4,827 additions and 4,705 deletions.
1 change: 1 addition & 0 deletions ad9361.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ struct filter_design_parameters {
double phEQ;
double HB2;
double HB3;
double maxTaps;
};

struct ad9361_bb_conf {
Expand Down
36 changes: 34 additions & 2 deletions ad9361_design_taps.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ int ad9361_generate_fir_taps(struct filter_design_parameters *parameters,
parameters->phEQ, parameters->HB2, parameters->HB3, parameters->Type,
parameters->RxTx, parameters->RFbw, parameters->DAC_div,
parameters->converter_rate, parameters->PLL_rate, parameters->Fcenter,
parameters->wnom, parameters->FIRdBmin, parameters->int_FIR, taps,
&dnum_taps, &dgain);
parameters->wnom, parameters->FIRdBmin, parameters->int_FIR,
parameters->maxTaps, taps, &dnum_taps, &dgain);
internal_design_filter_cg_terminate();
*num_taps = (int)dnum_taps;
*gain = (int)dgain;
Expand Down Expand Up @@ -93,6 +93,37 @@ double calculate_rfbw(double pll_rate, double caldiv, bool TX,
return rfbw;
}

void set_max_taps(struct filter_design_parameters *fdpTX,
struct filter_design_parameters *fdpRX)
{
// RX side
int N,M,K;
if (fdpRX->HB3 == 3)
N = 16*floor(fdpRX->converter_rate/(fdpRX->Rdata));
else
N = 16*floor(fdpRX->converter_rate/(2*fdpRX->Rdata));
if (N>128)
N = 128;
// TX side
if (fdpTX->FIR==1)
M = 64;
else
M = 128;
K = 16*floor(fdpTX->converter_rate*fdpTX->DAC_div/(2*fdpTX->Rdata));
if (K<M)
M = K;

// Pick the smallest
if (M>N) {
fdpTX->maxTaps = N;
fdpRX->maxTaps = N;
} else {
fdpTX->maxTaps = M;
fdpRX->maxTaps = M;
}
}


int ad9361_calculate_rf_clock_chain_fdp(struct filter_design_parameters *fdpTX,
struct filter_design_parameters *fdpRX,
unsigned long sample_rate)
Expand Down Expand Up @@ -157,6 +188,7 @@ int ad9361_calculate_rf_clock_chain_fdp(struct filter_design_parameters *fdpTX,
if (fdp->RFbw < 0)
return -EINVAL;
}
set_max_taps(fdpTX,fdpRX);

return 0;

Expand Down
Loading

0 comments on commit 93d4a22

Please sign in to comment.