From 57d6ed2a0a3c45fcd6854dcdac6377be3f336830 Mon Sep 17 00:00:00 2001 From: Mark Meserve Date: Thu, 23 May 2019 17:36:18 -0500 Subject: ubx: add temperature compensation mode - This mode defaults to "disabled" (no change from current behavior) - Enabling this mode fixes some instances where the MAX287x would fail to lock when in integer-n mode - Enabling this mode increases the maximum lock time to up to 100ms --- host/lib/usrp/dboard/db_ubx.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'host/lib/usrp/dboard/db_ubx.cpp') diff --git a/host/lib/usrp/dboard/db_ubx.cpp b/host/lib/usrp/dboard/db_ubx.cpp index 2ab5abaad..305a69c52 100644 --- a/host/lib/usrp/dboard/db_ubx.cpp +++ b/host/lib/usrp/dboard/db_ubx.cpp @@ -161,6 +161,7 @@ static const std::vector ubx_tx_antennas{"TX/RX", "CAL"}; static const std::vector ubx_rx_antennas{"TX/RX", "RX2", "CAL"}; static const std::vector ubx_power_modes{"performance", "powersave"}; static const std::vector ubx_xcvr_modes{"FDX", "TX", "TX/RX", "RX"}; +static const std::vector ubx_temp_comp_modes{"enabled", "disabled"}; // clang-format off static const ubx_gpio_field_info_t ubx_proto_gpio_info[] = { @@ -445,6 +446,13 @@ public: get_rx_subtree()->create("xcvr_mode/value") .add_coerced_subscriber(boost::bind(&ubx_xcvr::set_xcvr_mode, this, _1)) .set("FDX"); + get_rx_subtree()->create >("temp_comp_mode/options") + .set(ubx_temp_comp_modes); + get_rx_subtree() + ->create("temp_comp_mode/value") + .add_coerced_subscriber( + [this](std::string mode) { this->set_temp_comp_mode(mode); }) + .set("disabled"); get_tx_subtree()->create >("power_mode/options") .set(ubx_power_modes); get_tx_subtree()->create("power_mode/value") @@ -455,6 +463,21 @@ public: get_tx_subtree()->create("xcvr_mode/value") .add_coerced_subscriber(boost::bind(&uhd::property::set, &get_rx_subtree()->access("xcvr_mode/value"), _1)) .set_publisher(boost::bind(&uhd::property::get, &get_rx_subtree()->access("xcvr_mode/value"))); + get_tx_subtree()->create >("temp_comp_mode/options") + .set(ubx_temp_comp_modes); + get_tx_subtree() + ->create("temp_comp_mode/value") + .add_coerced_subscriber([this](std::string mode) { + this->get_rx_subtree() + ->access("temp_comp_mode/value") + .set(mode); + }) + .set_publisher([this]() { + return this->get_rx_subtree() + ->access("temp_comp_mode/value") + .get(); + }); + //////////////////////////////////////////////////////////////////// // Register TX properties @@ -1279,6 +1302,24 @@ private: _rx_sync_delay = value; } + void set_temp_comp_mode(std::string mode) + { + const bool enabled = [mode]() { + if (mode == "enabled") { + return true; + } else if (mode == "disabled") { + return false; + } else { + throw uhd::value_error("invalid temperature_compensation_mode"); + } + }(); + + boost::mutex::scoped_lock lock(_mutex); + for (const auto& lo : {_txlo1, _txlo2, _rxlo1, _rxlo2}) { + lo->set_auto_retune(enabled); + } + } + /*********************************************************************** * Variables **********************************************************************/ -- cgit v1.2.3