From 1d5553317c39ddbb5af27b921dd94dc0d34532d2 Mon Sep 17 00:00:00 2001 From: Mark Meserve Date: Tue, 28 Aug 2018 15:57:38 -0500 Subject: twinrx: revise adf5356 frac2 register calculation - If FRAC2 isn't exactly FRAC1 at certain frequencies, drifting spurs can be seen in the spectrum --- host/lib/include/uhdlib/usrp/common/adf535x.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/include/uhdlib/usrp/common/adf535x.hpp b/host/lib/include/uhdlib/usrp/common/adf535x.hpp index 8380c9d04..110c7e2dc 100644 --- a/host/lib/include/uhdlib/usrp/common/adf535x.hpp +++ b/host/lib/include/uhdlib/usrp/common/adf535x.hpp @@ -424,7 +424,7 @@ inline double adf535x_impl::_set_frequency(double target_freq, d const double gcd = boost::math::gcd(static_cast(_pfd_freq), static_cast(freq_resolution)); const auto MOD2 = static_cast(std::min(floor(_pfd_freq / gcd), static_cast(ADF535X_MAX_MOD2))); - const auto FRAC2 = static_cast(std::min(ceil(residue * MOD2), static_cast(ADF535X_MAX_FRAC2))); + const auto FRAC2 = static_cast(std::min(round(residue * MOD2), static_cast(ADF535X_MAX_FRAC2))); const double coerced_vco_freq = _pfd_freq * ( double(INT) + ( -- cgit v1.2.3