From 1256821f3e61ec677cd4b4e75be14f0f376f5215 Mon Sep 17 00:00:00 2001 From: Michael West Date: Thu, 23 Aug 2018 17:07:00 -0700 Subject: X300: Add recovery for duplicate IP addresses in EEPROM - Limit initialization to ZPU communication if recover_mb_eeprom=1 is set in device args. --- host/lib/usrp/multi_usrp.cpp | 2 +- host/lib/usrp/x300/x300_impl.cpp | 30 ++++++++++++------------------ 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index 019502ee7..5e45df298 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -389,7 +389,7 @@ public: _tree = _dev->get_tree(); _is_device3 = bool(boost::dynamic_pointer_cast(_dev)); - if (is_device3()) { + if (is_device3() and not addr.has_key("recover_mb_eeprom")) { _legacy_compat = rfnoc::legacy_compat::make(get_device3(), addr); } } diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index cc4f94065..0b173beb3 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -720,6 +720,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) UHD_LOGGER_WARNING("X300") << "UHD is operating in EEPROM Recovery Mode which disables hardware version " "checks.\nOperating in this mode may cause hardware damage and unstable " "radio performance!"; + return; } //////////////////////////////////////////////////////////////////// @@ -871,18 +872,15 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) //////////////////////////////////////////////////////////////////// // read hardware revision and compatibility number //////////////////////////////////////////////////////////////////// - const bool recover_mb_eeprom = mb.args.get_recover_mb_eeprom(); mb.hw_rev = 0; if(mb_eeprom.has_key("revision") and not mb_eeprom["revision"].empty()) { try { mb.hw_rev = boost::lexical_cast(mb_eeprom["revision"]); } catch(...) { - if (not recover_mb_eeprom) - throw uhd::runtime_error("Revision in EEPROM is invalid! Please reprogram your EEPROM."); + throw uhd::runtime_error("Revision in EEPROM is invalid! Please reprogram your EEPROM."); } } else { - if (not recover_mb_eeprom) - throw uhd::runtime_error("No revision detected. MB EEPROM must be reprogrammed!"); + throw uhd::runtime_error("No revision detected. MB EEPROM must be reprogrammed!"); } size_t hw_rev_compat = 0; @@ -891,12 +889,10 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) try { hw_rev_compat = boost::lexical_cast(mb_eeprom["revision_compat"]); } catch(...) { - if (not recover_mb_eeprom) - throw uhd::runtime_error("Revision compat in EEPROM is invalid! Please reprogram your EEPROM."); + throw uhd::runtime_error("Revision compat in EEPROM is invalid! Please reprogram your EEPROM."); } } else { - if (not recover_mb_eeprom) - throw uhd::runtime_error("No revision compat detected. MB EEPROM must be reprogrammed!"); + throw uhd::runtime_error("No revision compat detected. MB EEPROM must be reprogrammed!"); } } else { //For older HW just assume that revision_compat = revision @@ -904,15 +900,13 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) } if (hw_rev_compat > X300_REVISION_COMPAT) { - if (not recover_mb_eeprom) - throw uhd::runtime_error(str(boost::format( - "Hardware is too new for this software. Please upgrade to a driver that supports hardware revision %d.") - % mb.hw_rev)); + throw uhd::runtime_error(str(boost::format( + "Hardware is too new for this software. Please upgrade to a driver that supports hardware revision %d.") + % mb.hw_rev)); } else if (mb.hw_rev < X300_REVISION_MIN) { //Compare min against the revision (and not compat) to give us more leeway for partial support for a compat - if (not recover_mb_eeprom) - throw uhd::runtime_error(str(boost::format( - "Software is too new for this hardware. Please downgrade to a driver that supports hardware revision %d.") - % mb.hw_rev)); + throw uhd::runtime_error(str(boost::format( + "Software is too new for this hardware. Please downgrade to a driver that supports hardware revision %d.") + % mb.hw_rev)); } //////////////////////////////////////////////////////////////////// @@ -1105,7 +1099,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) mb.radios, mb.args.get_ext_adc_self_test_duration() ); - } else if (not recover_mb_eeprom){ + } else { for (size_t i = 0; i < mb.radios.size(); i++) { mb.radios.at(i)->self_test_adc(); } -- cgit v1.2.3