From 0db669b3ce4dc5ec6cd38d8d80159d9030393288 Mon Sep 17 00:00:00 2001 From: michael-west Date: Fri, 13 Jun 2014 11:58:29 -0700 Subject: Enhancement #512: B210: Need an Internal PPS - Added support for internal PPS selection (set as default) --- host/lib/usrp/b200/b200_impl.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'host/lib/usrp/b200') diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 98141dbaa..91a3cb037 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -427,7 +427,7 @@ b200_impl::b200_impl(const device_addr_t &device_addr) //setup time source props _tree->create(mb_path / "time_source" / "value") .subscribe(boost::bind(&b200_impl::update_time_source, this, _1)); - static const std::vector time_sources = boost::assign::list_of("none")("external")("gpsdo"); + static const std::vector time_sources = boost::assign::list_of("none")("internal")("external")("gpsdo"); _tree->create >(mb_path / "time_source" / "options").set(time_sources); //setup reference source props _tree->create(mb_path / "clock_source" / "value") @@ -464,10 +464,6 @@ 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"); - //GPS installed: use external ref, time, and init time spec if (_gps and _gps->gps_detected()) { @@ -477,6 +473,10 @@ b200_impl::b200_impl(const device_addr_t &device_addr) UHD_MSG(status) << "Initializing time to the internal GPSDO" << std::endl; const time_t tp = time_t(_gps->get_sensor("gps_time").to_int()+1); _tree->access(mb_path / "time" / "pps").set(time_spec_t(tp)); + } else { + //init to internal clock and time source + _tree->access(mb_path / "clock_source/value").set("internal"); + _tree->access(mb_path / "time_source/value").set("internal"); } } @@ -785,11 +785,17 @@ void b200_impl::update_clock_source(const std::string &source) void b200_impl::update_time_source(const std::string &source) { - if (source == "none"){} - else if (source == "external"){} - else if (source == "gpsdo"){} + boost::uint32_t value = 0; + if (source == "none") + value = 3; + else if (source == "internal") + value = 2; + else if (source == "external") + value = 1; + else if (source == "gpsdo") + value = 0; else throw uhd::key_error("update_time_source: unknown source: " + source); - _local_ctrl->poke32(TOREG(SR_CORE_PPS_SEL), (source == "external")? 1 : 0); + _local_ctrl->poke32(TOREG(SR_CORE_PPS_SEL), value); } /*********************************************************************** -- cgit v1.2.3 From 248df215aa0b382e2c54877680abfc1ca823bb6b Mon Sep 17 00:00:00 2001 From: michael-west Date: Wed, 18 Jun 2014 12:43:10 -0700 Subject: Fix for BUG #516: B210: Fails to Run with 30.72 MHz Clock - Corrected clock rate checks for B2x0 --- host/lib/usrp/b200/b200_impl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'host/lib/usrp/b200') diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 261183128..40b316175 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -681,7 +681,7 @@ void b200_impl::enforce_tick_rate_limits(size_t chan_count, double tick_rate, co else { const double max_tick_rate = ((chan_count <= 1) ? AD9361_1_CHAN_CLOCK_RATE_MAX : AD9361_2_CHAN_CLOCK_RATE_MAX); - if (tick_rate > max_tick_rate) + if (tick_rate > max_tick_rate and (tick_rate - max_tick_rate > 1.0)) { throw uhd::value_error(boost::str( boost::format("current master clock rate (%.2f MHz) exceeds maximum possible master clock rate (%.2f MHz) when using %d %s channels") @@ -696,12 +696,12 @@ void b200_impl::enforce_tick_rate_limits(size_t chan_count, double tick_rate, co double b200_impl::set_tick_rate(const double rate) { - UHD_MSG(status) << "Asking for clock rate " << rate/1e6 << " MHz\n"; + UHD_MSG(status) << (boost::format("Asking for clock rate %.2f MHz\n") % (rate/1e6)); check_tick_rate_with_current_streamers(rate); // Defined in b200_io_impl.cpp _tick_rate = _codec_ctrl->set_clock_rate(rate); - UHD_MSG(status) << "Actually got clock rate " << _tick_rate/1e6 << " MHz\n"; + UHD_MSG(status) << (boost::format("Actually got clock rate %.2f MHz\n") % (_tick_rate/1e6)); //reset after clock rate change this->reset_codec_dcm(); -- cgit v1.2.3 From 016430b3f8b3535b59e70592fc1029f783cf6cd0 Mon Sep 17 00:00:00 2001 From: michael-west Date: Wed, 18 Jun 2014 13:42:24 -0700 Subject: Fix for BUG #516: B210: Fails to Run with 30.72 MHz Clock - Corrected clock rate checks for B2x0 --- host/lib/usrp/b200/b200_impl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'host/lib/usrp/b200') diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 40b316175..72dd25904 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -684,7 +684,7 @@ void b200_impl::enforce_tick_rate_limits(size_t chan_count, double tick_rate, co if (tick_rate > max_tick_rate and (tick_rate - max_tick_rate > 1.0)) { throw uhd::value_error(boost::str( - boost::format("current master clock rate (%.2f MHz) exceeds maximum possible master clock rate (%.2f MHz) when using %d %s channels") + boost::format("current master clock rate (%.6f MHz) exceeds maximum possible master clock rate (%.6f MHz) when using %d %s channels") % (tick_rate/1e6) % (max_tick_rate/1e6) % chan_count @@ -696,12 +696,12 @@ void b200_impl::enforce_tick_rate_limits(size_t chan_count, double tick_rate, co double b200_impl::set_tick_rate(const double rate) { - UHD_MSG(status) << (boost::format("Asking for clock rate %.2f MHz\n") % (rate/1e6)); + UHD_MSG(status) << (boost::format("Asking for clock rate %.6f MHz\n") % (rate/1e6)); check_tick_rate_with_current_streamers(rate); // Defined in b200_io_impl.cpp _tick_rate = _codec_ctrl->set_clock_rate(rate); - UHD_MSG(status) << (boost::format("Actually got clock rate %.2f MHz\n") % (_tick_rate/1e6)); + UHD_MSG(status) << (boost::format("Actually got clock rate %.6f MHz\n") % (_tick_rate/1e6)); //reset after clock rate change this->reset_codec_dcm(); -- cgit v1.2.3 From 487e7fc2b41deb3867d24d8e4dacb10d2cafebb1 Mon Sep 17 00:00:00 2001 From: michael-west Date: Thu, 10 Jul 2014 14:37:38 -0700 Subject: BUG #516: B210: Fails to Run with 30.72 MHz Clock - Addressed feedback from review. --- host/lib/usrp/b200/b200_impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host/lib/usrp/b200') diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 72dd25904..d8c8db9ae 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -681,7 +681,7 @@ void b200_impl::enforce_tick_rate_limits(size_t chan_count, double tick_rate, co else { const double max_tick_rate = ((chan_count <= 1) ? AD9361_1_CHAN_CLOCK_RATE_MAX : AD9361_2_CHAN_CLOCK_RATE_MAX); - if (tick_rate > max_tick_rate and (tick_rate - max_tick_rate > 1.0)) + if (tick_rate - max_tick_rate >= 1.0) { throw uhd::value_error(boost::str( boost::format("current master clock rate (%.6f MHz) exceeds maximum possible master clock rate (%.6f MHz) when using %d %s channels") -- cgit v1.2.3