First X310 Calibration and harmonization of B210 and X310 configuration
This commit is contained in:
@@ -171,17 +171,30 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
if (cc>1) {
|
||||
// receive multiple channels (e.g. RF A and RF B)
|
||||
std::vector<void *> buff_ptrs;
|
||||
|
||||
for (int i=0;i<cc;i++) buff_ptrs.push_back(buff_tmp[i]);
|
||||
samples_received = s->rx_stream->recv(buff_ptrs, nsamps, s->rx_md);
|
||||
} else {
|
||||
// receive a single channel (e.g. from connector RF A)
|
||||
samples_received = s->rx_stream->recv(buff_tmp[0], nsamps, s->rx_md);
|
||||
}*/
|
||||
|
||||
if (cc>1) {
|
||||
// receive multiple channels (e.g. RF A and RF B)
|
||||
std::vector<void *> buff_ptrs;
|
||||
|
||||
for (int i=0;i<cc;i++) buff_ptrs.push_back(buff[i]);
|
||||
samples_received = s->rx_stream->recv(buff_ptrs, nsamps, s->rx_md);
|
||||
} else {
|
||||
// receive a single channel (e.g. from connector RF A)
|
||||
samples_received = s->rx_stream->recv(buff[0], nsamps, s->rx_md);
|
||||
}
|
||||
|
||||
/*
|
||||
// bring RX data into 12 LSBs for softmodem RX
|
||||
for (int i=0;i<cc;i++) {
|
||||
for (int j=0; j<nsamps2; j++) {
|
||||
@@ -196,6 +209,8 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
|
||||
#endif
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (samples_received < nsamps) {
|
||||
printf("[recv] received %d samples out of %d\n",samples_received,nsamps);
|
||||
|
||||
@@ -279,7 +294,7 @@ int trx_usrp_set_gains(openair0_device* device,
|
||||
exit(-1);
|
||||
}
|
||||
s->usrp->set_rx_gain(openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0]);
|
||||
printf("Setting USRP RX gain to %f\n", openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0]);
|
||||
printf("Setting USRP RX gain to %f (rx_gain %f,gain_range.stop() %f)\n", openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0],openair0_cfg[0].rx_gain[0],gain_range.stop());
|
||||
|
||||
return(0);
|
||||
}
|
||||
@@ -289,7 +304,7 @@ int trx_usrp_stop(int card) {
|
||||
}
|
||||
|
||||
|
||||
rx_gain_calib_table_t calib_table[] = {
|
||||
rx_gain_calib_table_t calib_table_b210[] = {
|
||||
{3500000000.0,46.0},
|
||||
{2660000000.0,53.0},
|
||||
{2300000000.0,54.0},
|
||||
@@ -297,19 +312,29 @@ rx_gain_calib_table_t calib_table[] = {
|
||||
{816000000.0,62.0},
|
||||
{-1,0}};
|
||||
|
||||
rx_gain_calib_table_t calib_table_x310[] = {
|
||||
{3500000000.0,77.0},
|
||||
{2660000000.0,80.0},
|
||||
{2300000000.0,81.0},
|
||||
{1880000000.0,82.0},
|
||||
{816000000.0,89},
|
||||
{-1,0}};
|
||||
|
||||
void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) {
|
||||
|
||||
int i=0;
|
||||
// loop through calibration table to find best adjustment factor for RX frequency
|
||||
double min_diff = 6e9,diff;
|
||||
|
||||
while (calib_table[i].freq>0) {
|
||||
diff = fabs(openair0_cfg->rx_freq[chain_index] - calib_table[i].freq);
|
||||
|
||||
while (openair0_cfg->rx_gain_calib_table[i].freq>0) {
|
||||
diff = fabs(openair0_cfg->rx_freq[chain_index] - openair0_cfg->rx_gain_calib_table[i].freq);
|
||||
printf("cal %d: freq %f, offset %f, diff %f\n",
|
||||
i,calib_table[i].freq,calib_table[i].offset,diff);
|
||||
i,
|
||||
openair0_cfg->rx_gain_calib_table[i].freq,
|
||||
openair0_cfg->rx_gain_calib_table[i].offset,diff);
|
||||
if (min_diff > diff) {
|
||||
min_diff = diff;
|
||||
openair0_cfg->rx_gain_offset[chain_index] = calib_table[i].offset;
|
||||
openair0_cfg->rx_gain_offset[chain_index] = openair0_cfg->rx_gain_calib_table[i].offset;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -375,6 +400,8 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
|
||||
// this is not working yet, master clock has to be set via constructor
|
||||
// set master clock rate and sample rate for tx & rx for streaming
|
||||
//s->usrp->set_master_clock_rate(usrp_master_clock);
|
||||
|
||||
openair0_cfg[0].rx_gain_calib_table = calib_table_x310;
|
||||
} else {
|
||||
printf("Found USRP B200");
|
||||
s->usrp = uhd::usrp::multi_usrp::make(args);
|
||||
@@ -387,6 +414,8 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
|
||||
// s->usrp->set_clock_source("internal");
|
||||
// set master clock rate and sample rate for tx & rx for streaming
|
||||
s->usrp->set_master_clock_rate(30.72e6);
|
||||
|
||||
openair0_cfg[0].rx_gain_calib_table = calib_table_b210;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user