aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/lib/usrp/common/apply_corrections.cpp42
-rw-r--r--host/utils/CMakeLists.txt6
-rw-r--r--host/utils/usrp_cal_rx_iq_balance.cpp (renamed from host/utils/usrp_gen_rx_iq_cal_table.cpp)2
-rw-r--r--host/utils/usrp_cal_tx_dc_offset.cpp (renamed from host/utils/usrp_gen_tx_dc_cal_table.cpp)2
-rw-r--r--host/utils/usrp_cal_tx_iq_balance.cpp (renamed from host/utils/usrp_gen_tx_iq_cal_table.cpp)2
-rw-r--r--host/utils/usrp_cal_utils.hpp2
6 files changed, 46 insertions, 10 deletions
diff --git a/host/lib/usrp/common/apply_corrections.cpp b/host/lib/usrp/common/apply_corrections.cpp
index 720c51633..e3ec9baab 100644
--- a/host/lib/usrp/common/apply_corrections.cpp
+++ b/host/lib/usrp/common/apply_corrections.cpp
@@ -54,7 +54,7 @@ static bool fe_cal_comp(fe_cal_t a, fe_cal_t b){
static uhd::dict<std::string, std::vector<fe_cal_t> > fe_cal_cache;
-static std::complex<double> get_fe_iq_correction(
+static std::complex<double> get_fe_dc_correction(
const std::string &key, const double lo_freq
){
const std::vector<fe_cal_t> &datas = fe_cal_cache[key];
@@ -80,6 +80,35 @@ static std::complex<double> get_fe_iq_correction(
);
}
+static std::complex<double> get_fe_iq_correction(
+ const std::string &key, const double lo_freq
+){
+ const std::vector<fe_cal_t> &datas = fe_cal_cache[key];
+
+ //search for lo freq
+ size_t lo_index = 0;
+ size_t hi_index = datas.size()-1;
+ for (size_t i = 0; i < datas.size(); i++){
+ if (datas[i].lo_freq > lo_freq){
+ hi_index = i;
+ break;
+ }
+ lo_index = i;
+ }
+
+ if (lo_index == 0) return std::complex<double>(datas[lo_index].iq_corr_real, datas[lo_index].iq_corr_imag);
+ if (hi_index == lo_index) return std::complex<double>(datas[hi_index].iq_corr_real, datas[hi_index].iq_corr_imag);
+
+ const std::complex<double> lo_val(datas[lo_index].iq_corr_real, datas[lo_index].iq_corr_imag);
+ const std::complex<double> hi_val(datas[hi_index].iq_corr_real, datas[hi_index].iq_corr_imag);
+
+ //interpolation time
+ return std::polar<double>(
+ linear_interp(lo_freq, datas[lo_index].lo_freq, std::abs(lo_val), datas[hi_index].lo_freq, std::abs(hi_val)),
+ linear_interp(lo_freq, datas[lo_index].lo_freq, std::arg(lo_val), datas[hi_index].lo_freq, std::arg(hi_val))
+ );
+}
+
static void apply_fe_corrections(
uhd::property_tree::sptr sub_tree,
const uhd::fs_path &db_path,
@@ -124,8 +153,15 @@ static void apply_fe_corrections(
}
- sub_tree->access<std::complex<double> >(fe_path)
- .set(get_fe_iq_correction(cal_data_path.string(), lo_freq));
+ if (file_prefix.find("dc") != std::string::npos){
+ sub_tree->access<std::complex<double> >(fe_path)
+ .set(get_fe_dc_correction(cal_data_path.string(), lo_freq));
+ }
+ else if (file_prefix.find("iq") != std::string::npos){
+ sub_tree->access<std::complex<double> >(fe_path)
+ .set(get_fe_iq_correction(cal_data_path.string(), lo_freq));
+ }
+ else throw uhd::runtime_error("could not determine interpolation function");
}
/***********************************************************************
diff --git a/host/utils/CMakeLists.txt b/host/utils/CMakeLists.txt
index 6c17be22c..92807f882 100644
--- a/host/utils/CMakeLists.txt
+++ b/host/utils/CMakeLists.txt
@@ -37,9 +37,9 @@ ENDFOREACH(util_source)
SET(util_share_sources
usrp_burn_db_eeprom.cpp
usrp_burn_mb_eeprom.cpp
- usrp_gen_rx_iq_cal_table.cpp
- usrp_gen_tx_iq_cal_table.cpp
- usrp_gen_tx_dc_cal_table.cpp
+ usrp_cal_rx_iq_balance.cpp
+ usrp_cal_tx_dc_offset.cpp
+ usrp_cal_tx_iq_balance.cpp
)
IF(ENABLE_USB)
diff --git a/host/utils/usrp_gen_rx_iq_cal_table.cpp b/host/utils/usrp_cal_rx_iq_balance.cpp
index 71c447e65..7b7fdaec9 100644
--- a/host/utils/usrp_gen_rx_iq_cal_table.cpp
+++ b/host/utils/usrp_cal_rx_iq_balance.cpp
@@ -138,7 +138,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//print the help message
if (vm.count("help")){
- std::cout << boost::format("USRP Generate RX Frontend Calibration Table %s") % desc << std::endl;
+ std::cout << boost::format("USRP Generate RX IQ Balance Calibration Table %s") % desc << std::endl;
std::cout <<
"This application measures leakage between RX and TX on an XCVR daughterboard to self-calibrate.\n"
<< std::endl;
diff --git a/host/utils/usrp_gen_tx_dc_cal_table.cpp b/host/utils/usrp_cal_tx_dc_offset.cpp
index 570203496..2c75242c7 100644
--- a/host/utils/usrp_gen_tx_dc_cal_table.cpp
+++ b/host/utils/usrp_cal_tx_dc_offset.cpp
@@ -140,7 +140,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//print the help message
if (vm.count("help")){
- std::cout << boost::format("USRP Generate TX Frontend Calibration Table %s") % desc << std::endl;
+ std::cout << boost::format("USRP Generate TX DC Offset Calibration Table %s") % desc << std::endl;
std::cout <<
"This application measures leakage between RX and TX on an XCVR daughterboard to self-calibrate.\n"
<< std::endl;
diff --git a/host/utils/usrp_gen_tx_iq_cal_table.cpp b/host/utils/usrp_cal_tx_iq_balance.cpp
index a2b98d8e6..c7cda49c7 100644
--- a/host/utils/usrp_gen_tx_iq_cal_table.cpp
+++ b/host/utils/usrp_cal_tx_iq_balance.cpp
@@ -140,7 +140,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//print the help message
if (vm.count("help")){
- std::cout << boost::format("USRP Generate TX Frontend Calibration Table %s") % desc << std::endl;
+ std::cout << boost::format("USRP Generate TX IQ Balance Calibration Table %s") % desc << std::endl;
std::cout <<
"This application measures leakage between RX and TX on an XCVR daughterboard to self-calibrate.\n"
<< std::endl;
diff --git a/host/utils/usrp_cal_utils.hpp b/host/utils/usrp_cal_utils.hpp
index c9695d305..c08d869ed 100644
--- a/host/utils/usrp_cal_utils.hpp
+++ b/host/utils/usrp_cal_utils.hpp
@@ -39,7 +39,7 @@ static const size_t wave_table_len = 8192;
static const size_t num_search_steps = 5;
static const size_t num_search_iters = 7;
static const size_t skip_initial_samps = 20;
-static const double default_freq_step = 13.7e3;
+static const double default_freq_step = 13.7e6;
static const size_t default_num_samps = 10000;
/***********************************************************************