diff options
author | Josh Blum <josh@joshknows.com> | 2011-11-15 16:22:18 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-11-15 16:22:18 -0800 |
commit | 18abd4dbbf29ec9372bdd2ee83288fc94c20534c (patch) | |
tree | 325ce37ad5dbec664bca112c9fae96604fe82073 /host | |
parent | f68a9271f448a8c8878e2f0fb03b801f345287b3 (diff) | |
download | uhd-18abd4dbbf29ec9372bdd2ee83288fc94c20534c.tar.gz uhd-18abd4dbbf29ec9372bdd2ee83288fc94c20534c.tar.bz2 uhd-18abd4dbbf29ec9372bdd2ee83288fc94c20534c.zip |
uhd: support for applying cal corrections B100
Diffstat (limited to 'host')
-rw-r--r-- | host/docs/calibration.rst | 13 | ||||
-rw-r--r-- | host/lib/usrp/b100/b100_impl.cpp | 21 | ||||
-rw-r--r-- | host/lib/usrp/b100/b100_impl.hpp | 2 | ||||
-rw-r--r-- | host/utils/uhd_cal_rx_iq_balance.cpp | 2 | ||||
-rw-r--r-- | host/utils/uhd_cal_tx_dc_offset.cpp | 2 | ||||
-rw-r--r-- | host/utils/uhd_cal_tx_iq_balance.cpp | 2 | ||||
-rw-r--r-- | host/utils/usrp_cal_utils.hpp | 2 |
7 files changed, 34 insertions, 10 deletions
diff --git a/host/docs/calibration.rst b/host/docs/calibration.rst index 26a1064c9..0aaace8f4 100644 --- a/host/docs/calibration.rst +++ b/host/docs/calibration.rst @@ -28,11 +28,12 @@ The following RF frontends are supported by the self-calibration utilities: * more to come... ******************************************** -Basic tool usage +Calibration utilities ******************************************** - UHD installs the calibration utilities into <install-path>/bin. -Run the following from the command line: +**Disconnect** any extrernal hardware from the RF antenna ports, +and run the following from the command line. +Each utility will take several minutes to complete. :: uhd_cal_rx_iq_balance --verbose --args=<optional device args> @@ -43,13 +44,13 @@ See the output given by --help for more advanced options, such as: manually choosing the frequency range and step size for the sweeps. ******************************************** -Calibration files +Calibration data ******************************************** Calibration files are stored in the user's home/application directory. They can easily be moved from machine to another by copying the "cal" directory. Re-running a calibration utility will replace the existing calibration file. The old calibration file will be renamed so it may be recovered by the user. - * **Unix:** ${HOME}/.uhd/cal - * **Windows:** %APPDATA%\.uhd\cal + * **Unix:** ${HOME}/.uhd/cal/ + * **Windows:** %APPDATA%\\.uhd\\cal\\ diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp index 067fe8d47..7674a0fcf 100644 --- a/host/lib/usrp/b100/b100_impl.cpp +++ b/host/lib/usrp/b100/b100_impl.cpp @@ -15,6 +15,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // +#include "apply_corrections.hpp" #include "b100_impl.hpp" #include "b100_ctrl.hpp" #include "fpga_regs_standard.h" @@ -408,6 +409,18 @@ b100_impl::b100_impl(const device_addr_t &device_addr){ _dboard_iface, _tree->subtree(mb_path / "dboards/A") ); + //bind frontend corrections to the dboard freq props + const fs_path db_tx_fe_path = mb_path / "dboards" / "A" / "tx_frontends"; + BOOST_FOREACH(const std::string &name, _tree->list(db_tx_fe_path)){ + _tree->access<double>(db_tx_fe_path / name / "freq" / "value") + .subscribe(boost::bind(&b100_impl::set_tx_fe_corrections, this, _1)); + } + const fs_path db_rx_fe_path = mb_path / "dboards" / "A" / "rx_frontends"; + BOOST_FOREACH(const std::string &name, _tree->list(db_rx_fe_path)){ + _tree->access<double>(db_rx_fe_path / name / "freq" / "value") + .subscribe(boost::bind(&b100_impl::set_rx_fe_corrections, this, _1)); + } + //initialize io handling this->io_init(); @@ -501,3 +514,11 @@ sensor_value_t b100_impl::get_ref_locked(void){ const bool lock = _clock_ctrl->get_locked(); return sensor_value_t("Ref", lock, "locked", "unlocked"); } + +void b100_impl::set_rx_fe_corrections(const double lo_freq){ + apply_rx_fe_corrections(this->get_tree()->subtree("/mboards/0"), "A", lo_freq); +} + +void b100_impl::set_tx_fe_corrections(const double lo_freq){ + apply_tx_fe_corrections(this->get_tree()->subtree("/mboards/0"), "A", lo_freq); +} diff --git a/host/lib/usrp/b100/b100_impl.hpp b/host/lib/usrp/b100/b100_impl.hpp index 0984260be..96d90b14c 100644 --- a/host/lib/usrp/b100/b100_impl.hpp +++ b/host/lib/usrp/b100/b100_impl.hpp @@ -125,6 +125,8 @@ private: void clear_fpga_fifo(void); void handle_async_message(uhd::transport::managed_recv_buffer::sptr); uhd::sensor_value_t get_ref_locked(void); + void set_rx_fe_corrections(const double); + void set_tx_fe_corrections(const double); }; #endif /* INCLUDED_b100_IMPL_HPP */ diff --git a/host/utils/uhd_cal_rx_iq_balance.cpp b/host/utils/uhd_cal_rx_iq_balance.cpp index 7924323a5..a05df60b2 100644 --- a/host/utils/uhd_cal_rx_iq_balance.cpp +++ b/host/utils/uhd_cal_rx_iq_balance.cpp @@ -249,7 +249,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ result.delta = best_suppression - initial_suppression; results.push_back(result); if (vm.count("verbose")){ - std::cout << boost::format("%f MHz: best suppression %fdB, corrected %fdB") % (rx_lo/1e6) % result.best % result.delta << std::endl; + std::cout << boost::format("%f MHz: best suppression %f dB, corrected %f dB") % (rx_lo/1e6) % result.best % result.delta << std::endl; } else std::cout << "." << std::flush; } diff --git a/host/utils/uhd_cal_tx_dc_offset.cpp b/host/utils/uhd_cal_tx_dc_offset.cpp index 8615e231c..ed1b85bb3 100644 --- a/host/utils/uhd_cal_tx_dc_offset.cpp +++ b/host/utils/uhd_cal_tx_dc_offset.cpp @@ -246,7 +246,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ result.delta = initial_dc_dbrms - lowest_offset; results.push_back(result); if (vm.count("verbose")){ - std::cout << boost::format("%f MHz: lowest offset %fdB, corrected %fdB") % (tx_lo/1e6) % result.best % result.delta << std::endl; + std::cout << boost::format("%f MHz: lowest offset %f dB, corrected %f dB") % (tx_lo/1e6) % result.best % result.delta << std::endl; } else std::cout << "." << std::flush; } diff --git a/host/utils/uhd_cal_tx_iq_balance.cpp b/host/utils/uhd_cal_tx_iq_balance.cpp index 29b6f5ede..8b49ef170 100644 --- a/host/utils/uhd_cal_tx_iq_balance.cpp +++ b/host/utils/uhd_cal_tx_iq_balance.cpp @@ -251,7 +251,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ result.delta = best_suppression - initial_suppression; results.push_back(result); if (vm.count("verbose")){ - std::cout << boost::format("%f MHz: best suppression %fdB, corrected %fdB") % (tx_lo/1e6) % result.best % result.delta << std::endl; + std::cout << boost::format("%f MHz: best suppression %f dB, corrected %f dB") % (tx_lo/1e6) % result.best % result.delta << std::endl; } else std::cout << "." << std::flush; } diff --git a/host/utils/usrp_cal_utils.hpp b/host/utils/usrp_cal_utils.hpp index 5378b0d69..3058cd928 100644 --- a/host/utils/usrp_cal_utils.hpp +++ b/host/utils/usrp_cal_utils.hpp @@ -73,7 +73,7 @@ static inline void set_optimum_gain(uhd::usrp::multi_usrp::sptr usrp){ static inline std::vector<std::complex<float> > gen_table(void){ std::vector<std::complex<float> > wave_table(wave_table_len); for (size_t i = 0; i < wave_table_len; i++){ - wave_table[i] = std::polar<float>(1.0, (tau*i)/wave_table_len); + wave_table[i] = std::complex<float>(std::polar(1.0, (tau*i)/wave_table_len)); } return wave_table; } |