From 0d6454b27b99a137c55bc772a641e0df9d7ddaa0 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 23 Sep 2014 11:01:53 -0700 Subject: cbx: Fixed LO FRAC truncation --- host/lib/usrp/dboard/db_cbx.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'host/lib/usrp') diff --git a/host/lib/usrp/dboard/db_cbx.cpp b/host/lib/usrp/dboard/db_cbx.cpp index 78ecd9794..a64110fc7 100644 --- a/host/lib/usrp/dboard/db_cbx.cpp +++ b/host/lib/usrp/dboard/db_cbx.cpp @@ -19,6 +19,7 @@ #include "max2870_regs.hpp" #include "db_sbx_common.hpp" #include +#include using namespace uhd; using namespace uhd::usrp; @@ -94,10 +95,10 @@ double sbx_xcvr::cbx::set_lo_freq(dboard_iface::unit_t unit, double target_freq) vco_freq *= 2; RFdiv *= 2; } - + /* * The goal here is to loop though possible R dividers, - * band select clock dividers, N (int) dividers, and FRAC + * band select clock dividers, N (int) dividers, and FRAC * (frac) dividers. * * Calculate the N and F dividers for each set of values. @@ -122,7 +123,7 @@ double sbx_xcvr::cbx::set_lo_freq(dboard_iface::unit_t unit, double target_freq) N = int(vco_freq/pfd_freq); //Fractional-N calculation - FRAC = int((vco_freq/pfd_freq - N)*MOD); + FRAC = int(boost::math::round((vco_freq/pfd_freq - N)*MOD)); if(is_int_n) { if (FRAC > (MOD / 2)) { //Round integer such that actual freq is closest to target @@ -197,7 +198,8 @@ double sbx_xcvr::cbx::set_lo_freq(dboard_iface::unit_t unit, double target_freq) regs.r_counter_10_bit = R; regs.reference_divide_by_2 = T; regs.reference_doubler = D; - regs.band_select_clock_div = BS; + regs.band_select_clock_div = (BS & 0x0FF); + regs.bs_msb = (BS & 0x300) >>8; UHD_ASSERT_THROW(rfdivsel_to_enum.has_key(RFdiv)); regs.rf_divider_select = rfdivsel_to_enum[RFdiv]; regs.int_n_mode = (is_int_n) ? max2870_regs_t::INT_N_MODE_INT_N : max2870_regs_t::INT_N_MODE_FRAC_N; -- cgit v1.2.3 From df0c602c43959d15b5102fefe0b2d999a6b27141 Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Fri, 29 Aug 2014 10:06:47 -0700 Subject: usrp: don't print duplicate GPSDO detection messages --- host/lib/usrp/b200/b200_impl.cpp | 1 - host/lib/usrp/e100/e100_impl.cpp | 4 +--- host/lib/usrp/usrp2/usrp2_impl.cpp | 2 -- 3 files changed, 1 insertion(+), 6 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 bf5fdd251..7f92ae33a 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -304,7 +304,6 @@ b200_impl::b200_impl(const device_addr_t &device_addr) } else { - UHD_MSG(status) << "not found" << std::endl; _local_ctrl->poke32(TOREG(SR_CORE_GPSDO_ST), B200_GPSDO_ST_NONE); } } diff --git a/host/lib/usrp/e100/e100_impl.cpp b/host/lib/usrp/e100/e100_impl.cpp index b49ba64a2..1d026e2bf 100644 --- a/host/lib/usrp/e100/e100_impl.cpp +++ b/host/lib/usrp/e100/e100_impl.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010-2012 Ettus Research LLC +// Copyright 2010-2012,2014 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -259,7 +259,6 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){ } if (_gps and _gps->gps_detected()) { - UHD_MSG(status) << "found" << std::endl; BOOST_FOREACH(const std::string &name, _gps->get_sensors()) { _tree->create(mb_path / "sensors" / name) @@ -268,7 +267,6 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){ } else { - UHD_MSG(status) << "not found" << std::endl; std::ofstream(GPSDO_VOLATILE_PATH.string().c_str(), std::ofstream::binary) << "42" << std::endl; } } diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index d96a8ab7d..3414b7009 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -523,7 +523,6 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){ } if (_mbc[mb].gps and _mbc[mb].gps->gps_detected()) { - UHD_MSG(status) << "found" << std::endl; BOOST_FOREACH(const std::string &name, _mbc[mb].gps->get_sensors()) { _tree->create(mb_path / "sensors" / name) @@ -532,7 +531,6 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){ } else { - UHD_MSG(status) << "not found" << std::endl; _mbc[mb].iface->pokefw(U2_FW_REG_HAS_GPSDO, dont_look_for_gpsdo); } } -- cgit v1.2.3