diff options
author | Trung N Tran <trung.tran@ettus.com> | 2018-02-05 11:26:18 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-02-08 22:24:21 +0100 |
commit | 20a776bce3eec84c093b23e79d01b715f8756d72 (patch) | |
tree | fde15a5b4c4499a13da27b817dedec09dac90ccf /host/lib | |
parent | d76918974ad467a4364d4c32948ce00a3afb59ff (diff) | |
download | uhd-20a776bce3eec84c093b23e79d01b715f8756d72.tar.gz uhd-20a776bce3eec84c093b23e79d01b715f8756d72.tar.bz2 uhd-20a776bce3eec84c093b23e79d01b715f8756d72.zip |
mg : implement set_bandwidth
Diffstat (limited to 'host/lib')
4 files changed, 27 insertions, 17 deletions
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.cpp b/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.cpp index 9a91a316a..983de72fa 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.cpp @@ -73,9 +73,10 @@ double magnesium_ad9371_iface::set_gain( double magnesium_ad9371_iface::set_bandwidth(const double bandwidth, const size_t chan, const direction_t dir) { - // TODO: implement - UHD_LOG_WARNING(_L, "Ignoring attempt to set bandwidth"); - return 0.0; + auto const which = _get_which(dir, chan); + auto retval = request<double>("set_bw_filter", which, bandwidth); + UHD_LOG_TRACE(_L, _rpc_prefix << "set_bw_filter returned " << retval); + return retval; } double magnesium_ad9371_iface::get_frequency( diff --git a/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp b/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp index dda2aea44..94b9cf502 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp @@ -13,6 +13,12 @@ static constexpr size_t FPGPIO_MASTER_RADIO = 0; +static constexpr double AD9371_RX_MIN_BANDWIDTH = 20.0e6; // HZ +static constexpr double AD9371_RX_MAX_BANDWIDTH = 100.0e6; // HZ + +static constexpr double AD9371_TX_MIN_BANDWIDTH = 20.0e6; // HZ +static constexpr double AD9371_TX_MAX_BANDWIDTH = 100.0e6; // HZ + static constexpr double AD9371_MIN_FREQ = 300.0e6; // Hz static constexpr double AD9371_MAX_FREQ = 6.0e9; // Hz diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp index 1d7627370..1c6a1733f 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp @@ -383,8 +383,12 @@ double magnesium_radio_ctrl_impl::set_rx_bandwidth( const size_t chan ) { std::lock_guard<std::mutex> l(_set_lock); - radio_ctrl_impl::set_rx_bandwidth(bandwidth, chan); - return _ad9371->set_bandwidth(bandwidth, chan, RX_DIRECTION); + _ad9371->set_bandwidth(bandwidth, chan, RX_DIRECTION); + // FIXME: setting analog bandwidth on AD9371 take no effect. + // Remove this warning when ADI can confirm that it works. + UHD_LOG_WARNING(unique_id(), + "set_tx_bandwidth take no effect on AD9371. Default analog bandwidth is 100MHz"); + return AD9371_RX_MAX_BANDWIDTH; } double magnesium_radio_ctrl_impl::set_tx_bandwidth( @@ -392,8 +396,12 @@ double magnesium_radio_ctrl_impl::set_tx_bandwidth( const size_t chan ) { std::lock_guard<std::mutex> l(_set_lock); - //radio_ctrl_impl::set_rx_bandwidth(bandwidth, chan); - return _ad9371->set_bandwidth(bandwidth, chan, TX_DIRECTION); + _ad9371->set_bandwidth(bandwidth, chan, TX_DIRECTION); + // FIXME: setting analog bandwidth on AD9371 take no effect. + // Remove this warning when ADI can confirm that it works. + UHD_LOG_WARNING(unique_id(), + "set_tx_bandwidth take no effect on AD9371. Default analog bandwidth is 100MHz"); + return AD9371_TX_MAX_BANDWIDTH ; } double magnesium_radio_ctrl_impl::set_tx_gain( diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp index 85e4a5e30..6f1e42946 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp @@ -26,7 +26,7 @@ namespace { }; constexpr double MAGNESIUM_DEFAULT_FREQ = 2.5e9; // Hz - constexpr double MAGNESIUM_DEFAULT_BANDWIDTH = 40e6; // Hz + constexpr double MAGNESIUM_DEFAULT_BANDWIDTH = 100e6; // Hz constexpr char MAGNESIUM_DEFAULT_RX_ANTENNA[] = "RX2"; constexpr char MAGNESIUM_DEFAULT_TX_ANTENNA[] = "TX/RX"; @@ -286,16 +286,13 @@ void magnesium_radio_ctrl_impl::_init_frontend_subtree( ; // TX bandwidth subtree->create<double>(tx_fe_path / "bandwidth" / "value") + .set(AD9371_TX_MAX_BANDWIDTH) .set_coercer([this, chan_idx](const double bw){ return this->set_tx_bandwidth(bw, chan_idx); }) - .set_publisher([this, chan_idx](){ - //return this->get_tx_bandwidth(chan_idx); - return 0.0; // FIXME - }) ; subtree->create<meta_range_t>(tx_fe_path / "bandwidth" / "range") - .set(meta_range_t(0.0, 0.0, 0.0)) // FIXME + .set(meta_range_t(AD9371_TX_MIN_BANDWIDTH, AD9371_TX_MAX_BANDWIDTH)) .add_coerced_subscriber([](const meta_range_t &){ throw uhd::runtime_error( "Attempting to update bandwidth range!"); @@ -303,15 +300,13 @@ void magnesium_radio_ctrl_impl::_init_frontend_subtree( ; // RX bandwidth subtree->create<double>(rx_fe_path / "bandwidth" / "value") + .set(AD9371_RX_MAX_BANDWIDTH) .set_coercer([this, chan_idx](const double bw){ return this->set_rx_bandwidth(bw, chan_idx); }) - .set_publisher([this, chan_idx](){ - return this->get_rx_bandwidth(chan_idx); - }) ; subtree->create<meta_range_t>(rx_fe_path / "bandwidth" / "range") - .set(meta_range_t(0.0, 0.0, 0.0)) // FIXME + .set(meta_range_t(AD9371_RX_MIN_BANDWIDTH, AD9371_RX_MAX_BANDWIDTH)) .add_coerced_subscriber([](const meta_range_t &){ throw uhd::runtime_error( "Attempting to update bandwidth range!"); |