From e56809a09aeffa2ccaec4582f6ca2fc0d4b4949e Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 9 Apr 2014 16:17:15 +0200 Subject: b200: Set sensible defaults for freq, gain and rate at startup --- host/lib/usrp/b200/b200_impl.cpp | 20 +++++++++++++++----- host/lib/usrp/b200/b200_impl.hpp | 4 ++++ 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'host/lib/usrp') diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 5c9324cb9..33a3b0e04 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -493,6 +493,16 @@ b200_impl::b200_impl(const device_addr_t &device_addr) _tree->access(mb_path / "rx_subdev_spec").set(rx_spec); _tree->access(mb_path / "tx_subdev_spec").set(tx_spec); + //init to internal clock and time source + _tree->access(mb_path / "clock_source/value").set("internal"); + _tree->access(mb_path / "time_source/value").set("none"); + + // Set default rates (can't be done in setup_radio() because tick rate is not yet set) + for (size_t i = 0; i < _radio_perifs.size(); i++) { + _tree->access(mb_path / "rx_dsps" / str(boost::format("%u") % i)/ "rate/value").set(B200_DEFAULT_RATE); + _tree->access(mb_path / "tx_dsps" / str(boost::format("%u") % i) / "rate/value").set(B200_DEFAULT_RATE); + } + //GPS installed: use external ref, time, and init time spec if (_gps and _gps->gps_detected()) { @@ -557,7 +567,7 @@ void b200_impl::setup_radio(const size_t dspno) _tree->create(rx_dsp_path / "rate" / "value") .coerce(boost::bind(&rx_dsp_core_3000::set_host_rate, perif.ddc, _1)) .subscribe(boost::bind(&b200_impl::update_rx_samp_rate, this, dspno, _1)) - .set(1e6); + .set(0.0); // Can only set this after tick rate is initialized. _tree->create(rx_dsp_path / "freq" / "value") .coerce(boost::bind(&rx_dsp_core_3000::set_freq, perif.ddc, _1)) .set(0.0); @@ -581,7 +591,7 @@ void b200_impl::setup_radio(const size_t dspno) _tree->create(tx_dsp_path / "rate" / "value") .coerce(boost::bind(&tx_dsp_core_3000::set_host_rate, perif.duc, _1)) .subscribe(boost::bind(&b200_impl::update_tx_samp_rate, this, dspno, _1)) - .set(1e6); + .set(0.0); // Can only set this after tick rate is initialized. _tree->create(tx_dsp_path / "freq" / "value") .coerce(boost::bind(&tx_dsp_core_3000::set_freq, perif.duc, _1)) .set(0.0); @@ -614,7 +624,7 @@ void b200_impl::setup_radio(const size_t dspno) _tree->create(rf_fe_path / "gains" / name / "value") .coerce(boost::bind(&ad9361_ctrl::set_gain, _codec_ctrl, key, _1)) - .set(0.0); + .set(x == "rx" ? B200_DEFAULT_RX_GAIN : B200_DEFAULT_TX_GAIN); } _tree->create(rf_fe_path / "connection").set("IQ"); _tree->create(rf_fe_path / "enabled").set(true); @@ -625,9 +635,9 @@ void b200_impl::setup_radio(const size_t dspno) _tree->create(rf_fe_path / "bandwidth" / "range") .publish(boost::bind(&ad9361_ctrl::get_bw_filter_range, key)); _tree->create(rf_fe_path / "freq" / "value") - .set(0.0) .coerce(boost::bind(&ad9361_ctrl::tune, _codec_ctrl, key, _1)) - .subscribe(boost::bind(&b200_impl::update_bandsel, this, key, _1)); + .subscribe(boost::bind(&b200_impl::update_bandsel, this, key, _1)) + .set(B200_DEFAULT_FREQ); _tree->create(rf_fe_path / "freq" / "range") .publish(boost::bind(&ad9361_ctrl::get_rf_freq_range)); diff --git a/host/lib/usrp/b200/b200_impl.hpp b/host/lib/usrp/b200/b200_impl.hpp index 155ff699c..ea2d63628 100644 --- a/host/lib/usrp/b200/b200_impl.hpp +++ b/host/lib/usrp/b200/b200_impl.hpp @@ -50,6 +50,10 @@ static const boost::uint8_t B200_FW_COMPAT_NUM_MINOR = 0x00; static const boost::uint16_t B200_FPGA_COMPAT_NUM = 0x04; static const double B200_BUS_CLOCK_RATE = 100e6; static const double B200_DEFAULT_TICK_RATE = 32e6; +static const double B200_DEFAULT_FREQ = 100e6; // Hz +static const double B200_DEFAULT_RATE = 250e3; // Sps +static const double B200_DEFAULT_RX_GAIN = 0; // dB +static const double B200_DEFAULT_TX_GAIN = 0; // dB static const boost::uint32_t B200_GPSDO_ST_NONE = 0x83; static const size_t B200_MAX_RATE_USB2 = 32000000; // bytes/s -- cgit v1.2.3