From 7b1f83fd55457903b626d47f173b64714c5bff2b Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Fri, 16 Nov 2012 14:50:05 -0800 Subject: utils: images downloader defaults to UHD_IMAGES_DIR instead of CMAKE_INSTALL_PREFIX --- host/utils/uhd_images_downloader.py.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'host/utils') diff --git a/host/utils/uhd_images_downloader.py.in b/host/utils/uhd_images_downloader.py.in index a57f9dc48..8c8d2df81 100644 --- a/host/utils/uhd_images_downloader.py.in +++ b/host/utils/uhd_images_downloader.py.in @@ -38,7 +38,7 @@ if __name__ == "__main__": #Command line options parser = OptionParser() - parser.add_option("--install-location", type="string", default="@CMAKE_INSTALL_PREFIX@/share/uhd/images", help="Set custom install location for images, [default=%default]") + parser.add_option("--install-location", type="string", default="", help="Set custom install location for images") parser.add_option("--buffer-size", type="int", default=8192, help="Set download buffer size, [default=%default]",) (options, args) = parser.parse_args() @@ -52,6 +52,8 @@ if __name__ == "__main__": #Configuring image destination if options.install_location != "": images_dir = options.install_location + elif os.environ.get("UHD_IMAGES_DIR") != "" and os.environ.get("UHD_IMAGES_DIR") != None: + images_dir = os.environ.get("UHD_IMAGES_DIR") else: images_dir = "@CMAKE_INSTALL_PREFIX@/share/uhd/images" -- cgit v1.2.3 From 3d01dec1aba85bb9fe936cbb1ca653a82961e181 Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Fri, 16 Nov 2012 13:42:05 -0800 Subject: utils: cal apps immediately fail if dboard has no serial instead of after test runs --- host/docs/calibration.rst | 8 ++++++++ host/utils/uhd_cal_rx_iq_balance.cpp | 5 ++++- host/utils/uhd_cal_tx_dc_offset.cpp | 5 ++++- host/utils/uhd_cal_tx_iq_balance.cpp | 5 ++++- host/utils/usrp_cal_utils.hpp | 28 +++++++++++++++++++++++++++- 5 files changed, 47 insertions(+), 4 deletions(-) (limited to 'host/utils') 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: +:: + + /share/uhd/utils/usrp_burn_db_eeprom --ser= --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 #include #include +#include #include +#include #include #include #include #include +#include #include namespace fs = boost::filesystem; @@ -98,6 +101,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(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 **********************************************************************/ @@ -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(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"; -- cgit v1.2.3