diff options
Diffstat (limited to 'host/lib')
| -rw-r--r-- | host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp | 28 | 
1 files changed, 10 insertions, 18 deletions
| diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp index ce34a771d..5b5c2d663 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp @@ -56,6 +56,7 @@ double _lo_set_frequency(adf435x_iface::sptr lo_iface,      lo_iface->set_output_power(          adf435x_iface::RF_OUTPUT_B, adf435x_iface::OUTPUT_POWER_2DBM);      lo_iface->set_charge_pump_current(adf435x_iface::CHARGE_PUMP_CURRENT_0_31MA); +    lo_iface->set_tuning_mode(adf435x_iface::TUNING_MODE_LOW_SPUR);      return actual_freq;  } @@ -248,24 +249,21 @@ double magnesium_radio_control_impl::set_tx_frequency(      const std::string ad9371_source  = this->get_tx_lo_source(MAGNESIUM_LO1, chan);      const std::string adf4351_source = this->get_tx_lo_source(MAGNESIUM_LO2, chan);      UHD_ASSERT_THROW(adf4351_source == "internal"); -    double coerced_if_freq = freq; +    double coerced_if_freq = 0;      if (_map_freq_to_tx_band(_tx_band_map, freq) == tx_band::LOWBAND) {          _is_low_band[TX_DIRECTION]    = true; -        const double desired_low_freq = MAGNESIUM_TX_IF_FREQ - freq;          coerced_if_freq = -            this->_set_tx_lo_freq(adf4351_source, MAGNESIUM_LO2, desired_low_freq, chan) -            + freq; +            this->_set_tx_lo_freq(adf4351_source, MAGNESIUM_LO2, MAGNESIUM_TX_IF_FREQ, chan);          RFNOC_LOG_TRACE("coerced_if_freq = " << coerced_if_freq);      } else {          _is_low_band[TX_DIRECTION] = false;          _lo_disable(_tx_lo);      }      // external LO required to tune at 2xdesired_frequency. -    const double desired_if_freq = (ad9371_source == "internal") ? coerced_if_freq -                                                                 : 2 * coerced_if_freq; +    const double lo1_freq = (ad9371_source == "internal" ? 1 : 2) * (coerced_if_freq + freq); -    this->_set_tx_lo_freq(ad9371_source, MAGNESIUM_LO1, desired_if_freq, chan); +    this->_set_tx_lo_freq(ad9371_source, MAGNESIUM_LO1, lo1_freq, chan);      this->_update_freq(chan, TX_DIRECTION);      this->_update_gain(chan, TX_DIRECTION);      return radio_control_impl::get_tx_frequency(chan); @@ -323,20 +321,17 @@ double magnesium_radio_control_impl::set_rx_frequency(      if (_map_freq_to_rx_band(_rx_band_map, freq) == rx_band::LOWBAND) {          _is_low_band[RX_DIRECTION]    = true; -        const double desired_low_freq = MAGNESIUM_RX_IF_FREQ - freq;          coerced_if_freq = -            this->_set_rx_lo_freq(adf4351_source, MAGNESIUM_LO2, desired_low_freq, chan) -            + freq; +            this->_set_rx_lo_freq(adf4351_source, MAGNESIUM_LO2, MAGNESIUM_RX_IF_FREQ, chan);          RFNOC_LOG_TRACE("coerced_if_freq = " << coerced_if_freq);      } else {          _is_low_band[RX_DIRECTION] = false;          _lo_disable(_rx_lo);      }      // external LO required to tune at 2xdesired_frequency. -    const double desired_if_freq = ad9371_source == "internal" ? coerced_if_freq -                                                               : 2 * coerced_if_freq; +    const double lo1_freq = (ad9371_source == "internal" ? 1 : 2) * coerced_if_freq + freq; -    this->_set_rx_lo_freq(ad9371_source, MAGNESIUM_LO1, desired_if_freq, chan); +    this->_set_rx_lo_freq(ad9371_source, MAGNESIUM_LO1, lo1_freq, chan);      this->_update_freq(chan, RX_DIRECTION);      this->_update_gain(chan, RX_DIRECTION); @@ -836,8 +831,7 @@ double magnesium_radio_control_impl::_set_rx_lo_freq(const std::string source,              coerced_lo_freq            = _ad9371->set_frequency(freq, chan, RX_DIRECTION);              _ad9371_freq[RX_DIRECTION] = coerced_lo_freq;          } else if (name == MAGNESIUM_LO2) { -            // TODO: no hardcode the init_n_mode -            coerced_lo_freq = _lo_enable(_rx_lo, freq, _master_clock_rate, false); +            coerced_lo_freq = _lo_enable(_rx_lo, freq, _master_clock_rate, true);              _adf4351_freq[RX_DIRECTION] = coerced_lo_freq;          } else {              RFNOC_LOG_WARNING("There's no LO with this name of " @@ -954,9 +948,7 @@ double magnesium_radio_control_impl::_set_tx_lo_freq(const std::string source,              coerced_lo_freq            = _ad9371->set_frequency(freq, chan, TX_DIRECTION);              _ad9371_freq[TX_DIRECTION] = coerced_lo_freq;          } else if (name == MAGNESIUM_LO2) { -            // TODO: no hardcode the int_n_mode -            const bool int_n_mode = false; -            coerced_lo_freq = _lo_enable(_tx_lo, freq, _master_clock_rate, int_n_mode); +            coerced_lo_freq = _lo_enable(_tx_lo, freq, _master_clock_rate, true);              _adf4351_freq[TX_DIRECTION] = coerced_lo_freq;          } else {              RFNOC_LOG_WARNING("There's no LO with this name of " | 
