diff options
author | Nicholas Corgan <nick.corgan@ettus.com> | 2012-11-16 13:42:05 -0800 |
---|---|---|
committer | Nicholas Corgan <nick.corgan@ettus.com> | 2012-11-16 15:53:28 -0800 |
commit | 3d01dec1aba85bb9fe936cbb1ca653a82961e181 (patch) | |
tree | 7fa5836c9e1c5effa1af18e25994280be6b05dc1 /host | |
parent | 7b1f83fd55457903b626d47f173b64714c5bff2b (diff) | |
download | uhd-3d01dec1aba85bb9fe936cbb1ca653a82961e181.tar.gz uhd-3d01dec1aba85bb9fe936cbb1ca653a82961e181.tar.bz2 uhd-3d01dec1aba85bb9fe936cbb1ca653a82961e181.zip |
utils: cal apps immediately fail if dboard has no serial instead of after test runs
Diffstat (limited to 'host')
-rw-r--r-- | host/docs/calibration.rst | 8 | ||||
-rw-r--r-- | host/utils/uhd_cal_rx_iq_balance.cpp | 5 | ||||
-rw-r--r-- | host/utils/uhd_cal_tx_dc_offset.cpp | 5 | ||||
-rw-r--r-- | host/utils/uhd_cal_tx_iq_balance.cpp | 5 | ||||
-rw-r--r-- | host/utils/usrp_cal_utils.hpp | 28 |
5 files changed, 47 insertions, 4 deletions
diff --git a/host/docs/calibration.rst b/host/docs/calibration.rst index c97eebfd5..1945c4dd5 100644 --- a/host/docs/calibration.rst +++ b/host/docs/calibration.rst @@ -47,6 +47,14 @@ Each utility will take several minutes to complete. See the output given by --help for more advanced options, such as: manually choosing the frequency range and step size for the sweeps. +**Note:** +Your daughterboard needs a serial number to run a calibration utility. Some older daughterboards +may not have a serial number. If this is the case, run the following command to burn a serial number +into the daughterboard's EEPROM: +:: + + <install dir>/share/uhd/utils/usrp_burn_db_eeprom --ser=<desired serial> --args=<optional device args> + ******************************************** Calibration Data ******************************************** diff --git a/host/utils/uhd_cal_rx_iq_balance.cpp b/host/utils/uhd_cal_rx_iq_balance.cpp index 7b6f10f3b..68d0443da 100644 --- a/host/utils/uhd_cal_rx_iq_balance.cpp +++ b/host/utils/uhd_cal_rx_iq_balance.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010,2012 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -135,6 +135,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ usrp->set_rx_antenna("CAL"); usrp->set_tx_antenna("CAL"); + //fail if daughterboard has no serial + check_for_empty_serial(usrp, "RX", "rx", args); + //set optimum defaults set_optimum_defaults(usrp); diff --git a/host/utils/uhd_cal_tx_dc_offset.cpp b/host/utils/uhd_cal_tx_dc_offset.cpp index 1b2510ba4..8f69b3ce1 100644 --- a/host/utils/uhd_cal_tx_dc_offset.cpp +++ b/host/utils/uhd_cal_tx_dc_offset.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010,2012 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -138,6 +138,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ usrp->set_rx_antenna("CAL"); usrp->set_tx_antenna("CAL"); + //fail if daughterboard has no serial + check_for_empty_serial(usrp, "TX", "tx", args); + //set optimum defaults set_optimum_defaults(usrp); diff --git a/host/utils/uhd_cal_tx_iq_balance.cpp b/host/utils/uhd_cal_tx_iq_balance.cpp index cff3d1646..5478b07e3 100644 --- a/host/utils/uhd_cal_tx_iq_balance.cpp +++ b/host/utils/uhd_cal_tx_iq_balance.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010,2012 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -138,6 +138,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ usrp->set_rx_antenna("CAL"); usrp->set_tx_antenna("CAL"); + //fail if daughterboard has no serial + check_for_empty_serial(usrp, "TX", "tx", args); + //set optimum defaults set_optimum_defaults(usrp); diff --git a/host/utils/usrp_cal_utils.hpp b/host/utils/usrp_cal_utils.hpp index 364b68bbe..4a2303d34 100644 --- a/host/utils/usrp_cal_utils.hpp +++ b/host/utils/usrp_cal_utils.hpp @@ -19,11 +19,14 @@ #include <uhd/property_tree.hpp> #include <uhd/usrp/multi_usrp.hpp> #include <uhd/usrp/dboard_eeprom.hpp> +#include <uhd/utils/paths.hpp> #include <boost/filesystem.hpp> +#include <boost/format.hpp> #include <iostream> #include <vector> #include <complex> #include <cmath> +#include <cstdlib> #include <fstream> namespace fs = boost::filesystem; @@ -99,6 +102,30 @@ static inline void set_optimum_defaults(uhd::usrp::multi_usrp::sptr usrp){ } /*********************************************************************** + * Check for empty serial + **********************************************************************/ + +void check_for_empty_serial( + uhd::usrp::multi_usrp::sptr usrp, + std::string XX, + std::string xx, + std::string uhd_args +){ + + //extract eeprom + uhd::property_tree::sptr tree = usrp->get_device()->get_tree(); + const uhd::fs_path db_path = "/mboards/0/dboards/A/" + xx + "_eeprom"; + const uhd::usrp::dboard_eeprom_t db_eeprom = tree->access<uhd::usrp::dboard_eeprom_t>(db_path).get(); + + std::string args_str = ""; + if(uhd_args != "") args_str = str(boost::format(" --args=%s") % uhd_args); + + std::string error_string = str(boost::format("This %s dboard has no serial!\n\nPlease see the Calibration documentation for details on how to fix this.") % XX); + + if (db_eeprom.serial.empty()) throw std::runtime_error(error_string); +} + +/*********************************************************************** * Sinusoid wave table **********************************************************************/ class wave_table{ @@ -160,7 +187,6 @@ static void store_results( uhd::property_tree::sptr tree = usrp->get_device()->get_tree(); const uhd::fs_path db_path = "/mboards/0/dboards/A/" + xx + "_eeprom"; const uhd::usrp::dboard_eeprom_t db_eeprom = tree->access<uhd::usrp::dboard_eeprom_t>(db_path).get(); - if (db_eeprom.serial.empty()) throw std::runtime_error(XX + " dboard has empty serial!"); //make the calibration file path fs::path cal_data_path = fs::path(uhd::get_app_path()) / ".uhd"; |