Skip to content

Commit

Permalink
host/common: Apply nominal DC offset values at end of cal routines
Browse files Browse the repository at this point in the history
The nominal DC offset values were being left up to the caller to
apply. However, the bladeRF-cli was not doing this.

For convenience, these functions now apply the resulting nominal
values identified before exiting.
  • Loading branch information
Jon Szymaniak committed Feb 10, 2016
1 parent 630264c commit 7c55150
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions host/common/src/dc_calibration.c
Expand Up @@ -704,6 +704,13 @@ static int perform_rx_cal(struct rx_cal *cal, struct dc_calibration_params *p)
&p->corr_i, &p->corr_q,
&p->error_i, &p->error_q);

if (status != 0) {
return status;
}

/* Apply the nominal correction values */
status = set_rx_dc_corr(cal->dev, p->corr_i, p->corr_q);

return status;
}

Expand Down Expand Up @@ -907,6 +914,21 @@ static const float tx_cal_filt[] = {
static const unsigned int tx_cal_filt_num_taps =
(sizeof(tx_cal_filt) / sizeof(tx_cal_filt[0]));

static inline int set_tx_dc_corr(struct bladerf *dev, int16_t i, int16_t q)
{
int status;

status = bladerf_set_correction(dev, BLADERF_MODULE_TX,
BLADERF_CORR_LMS_DCOFF_I, i);
if (status != 0) {
return status;
}

status = bladerf_set_correction(dev, BLADERF_MODULE_TX,
BLADERF_CORR_LMS_DCOFF_Q, q);
return status;
}

static int get_tx_cal_backup(struct bladerf *dev, struct tx_cal_backup *b)
{
int status;
Expand Down Expand Up @@ -1477,6 +1499,9 @@ static int perform_tx_cal(struct tx_cal *state, struct dc_calibration_params *p)
return status;
}

/* Apply the resulting nominal values */
status = set_tx_dc_corr(state->dev, p->corr_i, p->corr_q);

return status;
}

Expand Down

0 comments on commit 7c55150

Please sign in to comment.