From 6a5807ecab1c8580b2b187da441017735189fd53 Mon Sep 17 00:00:00 2001 From: michael-west Date: Tue, 12 Jan 2021 11:21:49 -0800 Subject: TwinRX: Spur cleanup - Reduce FRAC2 and MOD2 values on ADF5356 - Add write to register 10 and delay during retune on ADF5356 - Make negative bleed conditional on integer or fractional N mode for ADF5356 - Tune unused LOs out of band to remove interference Signed-off-by: michael-west --- host/lib/include/uhdlib/usrp/common/adf535x.hpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'host/lib/include') diff --git a/host/lib/include/uhdlib/usrp/common/adf535x.hpp b/host/lib/include/uhdlib/usrp/common/adf535x.hpp index 736018da1..61dd88451 100644 --- a/host/lib/include/uhdlib/usrp/common/adf535x.hpp +++ b/host/lib/include/uhdlib/usrp/common/adf535x.hpp @@ -112,6 +112,7 @@ public: , _wait_fn(std::move(wait_fn)) , _regs() , _rewrite_regs(true) + , _neg_bleed_changed(false) , _wait_time_us(0) , _ref_freq(0.0) , _pfd_freq(0.0) @@ -350,6 +351,7 @@ private: // Members wait_fn_t _wait_fn; adf535x_regs_t _regs; bool _rewrite_regs; + bool _neg_bleed_changed; uint32_t _wait_time_us; double _ref_freq; double _pfd_freq; @@ -602,6 +604,14 @@ inline double adf535x_impl::_set_frequency( _regs.mod2_msb = narrow_cast(MOD2 >> 14); _regs.phase_24_bit = 0; + auto negative_bleed = FRAC1 != 0 or FRAC2 != 0 ? + adf5356_regs_t::NEGATIVE_BLEED_ENABLED : + adf5356_regs_t::NEGATIVE_BLEED_DISABLED; + if (negative_bleed != _regs.negative_bleed) { + _regs.negative_bleed = negative_bleed; + _neg_bleed_changed = true; + } + if (flush) commit(); return coerced_out_freq; @@ -630,9 +640,14 @@ inline void adf535x_impl::_commit() } else { // Frequency update sequence from data sheet _write_fn(addr_vtr_t(ONE_REG, _regs.get_reg(13))); - _write_fn(addr_vtr_t(ONE_REG, _regs.get_reg(6))); + _write_fn(addr_vtr_t(ONE_REG, _regs.get_reg(10))); + if (_neg_bleed_changed) { + _write_fn(addr_vtr_t(ONE_REG, _regs.get_reg(6))); + } _write_fn(addr_vtr_t(ONE_REG, _regs.get_reg(2))); _write_fn(addr_vtr_t(ONE_REG, _regs.get_reg(1))); + _wait_fn(_wait_time_us); _write_fn(addr_vtr_t(ONE_REG, _regs.get_reg(0))); } + _neg_bleed_changed = false; } -- cgit v1.2.3