From 59aaf137b8c86028c0686258837acc7f37eb9461 Mon Sep 17 00:00:00 2001 From: Derek Kozel Date: Tue, 25 Oct 2016 17:26:25 -0700 Subject: TwinRX: Use command time to schedule synchronous events --- host/lib/usrp/dboard/db_twinrx.cpp | 6 ++++ host/lib/usrp/dboard/twinrx/twinrx_experts.cpp | 24 ++++++++++++++++ host/lib/usrp/dboard/twinrx/twinrx_experts.hpp | 39 ++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) (limited to 'host/lib/usrp/dboard') diff --git a/host/lib/usrp/dboard/db_twinrx.cpp b/host/lib/usrp/dboard/db_twinrx.cpp index e960f134f..477412de0 100644 --- a/host/lib/usrp/dboard/db_twinrx.cpp +++ b/host/lib/usrp/dboard/db_twinrx.cpp @@ -75,6 +75,11 @@ public: get_rx_subtree()->create("bandwidth/range") .set(freq_range_t(BW, BW)); + // Command Time + expert_factory::add_data_node(_expert, prepend_ch("time/rx_frontend", _ch_name), time_spec_t(0.0)); + expert_factory::add_prop_node(_expert, get_rx_subtree(), + "time/cmd", prepend_ch("time/cmd", _ch_name), time_spec_t(0.0)); + //Frequency Specific get_rx_subtree()->create("freq/range") .set(freq_range_t(10e6, 6.0e9)); @@ -263,6 +268,7 @@ public: expert_factory::add_worker_node(_expert, _expert->node_retriever(), fe); expert_factory::add_worker_node(_expert, _expert->node_retriever(), fe); expert_factory::add_worker_node(_expert, _expert->node_retriever(), fe); + expert_factory::add_worker_node(_expert, _expert->node_retriever(), fe); expert_factory::add_worker_node(_expert, _expert->node_retriever(), fe, _db_iface); } diff --git a/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp b/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp index ddaa4211e..f0f64c7e1 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp @@ -29,6 +29,17 @@ using namespace uhd::experts; using namespace uhd::math; using namespace uhd::usrp::dboard::twinrx; +/*!--------------------------------------------------------- + * twinrx_scheduling_expert::resolve + * --------------------------------------------------------- + */ +void twinrx_scheduling_expert::resolve() +{ + // Currently a straight pass-through. To be expanded as needed + // when more advanced scheduling is needed + _rx_frontend_time = _command_time; +} + /*!--------------------------------------------------------- * twinrx_freq_path_expert::resolve * --------------------------------------------------------- @@ -222,6 +233,19 @@ void twinrx_freq_coercion_expert::resolve() */ void twinrx_nyquist_expert::resolve() { + // Do not execute when clear_command_time is called. + // This is a transition of the command time from non-zero to zero. + if (_rx_frontend_time == time_spec_t(0.0) and _cached_cmd_time != time_spec_t(0.0)) { + _cached_cmd_time = _rx_frontend_time; + return; + } + + // Do not execute twice for the same command time unless untimed + if (_rx_frontend_time == _cached_cmd_time and _rx_frontend_time != time_spec_t(0.0)) { + return; + } + _cached_cmd_time = _rx_frontend_time; + double if_freq_sign = 1.0; if (_lo1_inj_side == INJ_HIGH_SIDE) if_freq_sign *= -1.0; if (_lo2_inj_side == INJ_HIGH_SIDE) if_freq_sign *= -1.0; diff --git a/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp b/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp index 1617c9c80..9c83dbfa8 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp @@ -52,6 +52,38 @@ static const std::string lo_stage_str(lo_stage_t stage, bool lower = false) { return prefix + ((stage == STAGE_LO1) ? "1" : "2"); } + +/*!--------------------------------------------------------- + * twinrx_scheduling_expert + * + * This expert is responsible for scheduling time sensitive actions + * in other experts. It responds to changes in the command time and + * selectively causes experts to run in order to ensure a synchronized + * system. + * + * --------------------------------------------------------- + */ +class twinrx_scheduling_expert : public experts::worker_node_t { +public: + twinrx_scheduling_expert(const experts::node_retriever_t& db, std::string ch) + : experts::worker_node_t(prepend_ch("twinrx_scheduling_expert", ch)), + _command_time (db, prepend_ch("time/cmd", ch)), + _rx_frontend_time (db, prepend_ch("time/rx_frontend", ch)) + { + bind_accessor(_command_time); + bind_accessor(_rx_frontend_time); + } + +private: + virtual void resolve(); + + //Inputs + experts::data_reader_t _command_time; + + //Outputs + experts::data_writer_t _rx_frontend_time; +}; + /*!--------------------------------------------------------- * twinrx_freq_path_expert * @@ -271,6 +303,7 @@ public: _if_freq_d (db, prepend_ch("if_freq/desired", ch)), _lo1_inj_side (db, prepend_ch("ch/LO1/inj_side", ch)), _lo2_inj_side (db, prepend_ch("ch/LO2/inj_side", ch)), + _rx_frontend_time (db, prepend_ch("time/rx_frontend", ch)), _if_freq_c (db, prepend_ch("if_freq/coerced", ch)), _db_iface (db_iface) { @@ -280,6 +313,7 @@ public: bind_accessor(_lo1_inj_side); bind_accessor(_lo2_inj_side); bind_accessor(_if_freq_c); + bind_accessor(_rx_frontend_time); } private: @@ -293,9 +327,14 @@ private: experts::data_reader_t _if_freq_d; experts::data_reader_t _lo1_inj_side; experts::data_reader_t _lo2_inj_side; + experts::data_reader_t _rx_frontend_time; + //Outputs experts::data_writer_t _if_freq_c; dboard_iface::sptr _db_iface; + + //Misc + time_spec_t _cached_cmd_time; }; /*!--------------------------------------------------------- -- cgit v1.2.3 From c516916c97e17c7bb07b248b8d41ae139049b469 Mon Sep 17 00:00:00 2001 From: Derek Kozel Date: Tue, 25 Oct 2016 17:27:14 -0700 Subject: TwinRX: Remove unhelpful warning --- host/lib/usrp/dboard/twinrx/twinrx_experts.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'host/lib/usrp/dboard') diff --git a/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp b/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp index f0f64c7e1..3b41972da 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp @@ -594,10 +594,6 @@ void twinrx_settings_expert::_resolve_lox_freq( ch0_freq_c = _set_lox_synth_freq(lo_stage, twinrx_ctrl::CH2, ch0_freq_d); } else if (synth0_mapping == MAPPING_SHARED or synth1_mapping == MAPPING_SHARED) { // If any synthesizer is being shared then we are not in hopping mode - if (rf_freq_ppm_t(ch0_freq_d) != ch1_freq_d) { - UHD_MSG(warning) << - "Incompatible RF/LO frequencies for LO sharing. Using Ch0 settings for both channels."; - } twinrx_ctrl::channel_t ch = (synth0_mapping == MAPPING_SHARED) ? twinrx_ctrl::CH1 : twinrx_ctrl::CH2; ch0_freq_c = _set_lox_synth_freq(lo_stage, ch, ch0_freq_d); ch1_freq_c = ch0_freq_c; @@ -621,10 +617,6 @@ void twinrx_settings_expert::_resolve_lox_freq( ch1_freq_c = _set_lox_synth_freq(lo_stage, twinrx_ctrl::CH2, ch1_freq_d); } else if (synth0_mapping == MAPPING_SHARED or synth1_mapping == MAPPING_SHARED) { // If any synthesizer is being shared then we are not in hopping mode - if (rf_freq_ppm_t(ch0_freq_d) != ch1_freq_d) { - UHD_MSG(warning) << - "Incompatible RF/LO frequencies for LO sharing. Using Ch0 settings for both channels."; - } twinrx_ctrl::channel_t ch = (synth0_mapping == MAPPING_SHARED) ? twinrx_ctrl::CH1 : twinrx_ctrl::CH2; ch0_freq_c = _set_lox_synth_freq(lo_stage, ch, ch0_freq_d); ch1_freq_c = ch0_freq_c; -- cgit v1.2.3 From 50b9281003ccbc8c6291825abf840c10aa31c96e Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 27 Oct 2016 11:59:57 -0700 Subject: xcvr: Removed some compiler warnings --- host/lib/usrp/dboard/db_xcvr2450.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host/lib/usrp/dboard') diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp index aa0bae8b8..0f839b03e 100644 --- a/host/lib/usrp/dboard/db_xcvr2450.cpp +++ b/host/lib/usrp/dboard/db_xcvr2450.cpp @@ -372,7 +372,7 @@ double xcvr2450::set_lo_freq_core(double target_freq){ //variables used in the calculation below double scaler = xcvr2450::is_highband(target_freq)? (4.0/5.0) : (4.0/3.0); double ref_freq = this->get_iface()->get_clock_rate(dboard_iface::UNIT_TX); - int R, intdiv, fracdiv; + int R, intdiv = 131, fracdiv = 0; //loop through values until we get a match for(_ad9515div = 2; _ad9515div <= 3; _ad9515div++){ -- cgit v1.2.3