diff options
author | michael-west <michael.west@ettus.com> | 2018-11-29 12:20:16 -0800 |
---|---|---|
committer | Brent Stapleton <bstapleton@g.hmc.edu> | 2018-12-10 19:14:18 -0800 |
commit | d82d21246d4bc32997f6c92d0dd56cc0b5ef38a1 (patch) | |
tree | be0dc8c6ac70acef0cd96d28b63bf1c2bf7d580d /host/lib | |
parent | 575a676ec33a1f5e5103e4a800a84169fa0bf1dd (diff) | |
download | uhd-d82d21246d4bc32997f6c92d0dd56cc0b5ef38a1.tar.gz uhd-d82d21246d4bc32997f6c92d0dd56cc0b5ef38a1.tar.bz2 uhd-d82d21246d4bc32997f6c92d0dd56cc0b5ef38a1.zip |
TwinRX: Tuning improvements
- Added delay for VTUNE calibration as per ADF5355 and ADF5356 data sheets
- Increased SPI clock to 10 MHz
- Removed write to register 10 during tuning of ADF5356 to match ADF5355 code and reduce tune time
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/include/uhdlib/usrp/common/adf535x.hpp | 18 | ||||
-rw-r--r-- | host/lib/usrp/common/adf535x.cpp | 10 | ||||
-rw-r--r-- | host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp | 9 |
3 files changed, 20 insertions, 17 deletions
diff --git a/host/lib/include/uhdlib/usrp/common/adf535x.hpp b/host/lib/include/uhdlib/usrp/common/adf535x.hpp index 110c7e2dc..5ae92c3ef 100644 --- a/host/lib/include/uhdlib/usrp/common/adf535x.hpp +++ b/host/lib/include/uhdlib/usrp/common/adf535x.hpp @@ -25,9 +25,10 @@ class adf535x_iface public: typedef std::shared_ptr<adf535x_iface> sptr; typedef std::function<void(std::vector<uint32_t>)> write_fn_t; + typedef std::function<void(uint32_t)> wait_fn_t; - static sptr make_adf5355(write_fn_t write); - static sptr make_adf5356(write_fn_t write); + static sptr make_adf5355(write_fn_t write, wait_fn_t wait); + static sptr make_adf5356(write_fn_t write, wait_fn_t wait); virtual ~adf535x_iface() = default; @@ -82,8 +83,9 @@ template <typename adf535x_regs_t> class adf535x_impl : public adf535x_iface { public: - explicit adf535x_impl(write_fn_t write_fn) : + explicit adf535x_impl(write_fn_t write_fn, wait_fn_t wait_fn) : _write_fn(std::move(write_fn)), + _wait_fn(std::move(wait_fn)), _regs(), _rewrite_regs(true), _wait_time_us(0), @@ -272,6 +274,7 @@ private: //Members typedef std::vector<uint32_t> addr_vtr_t; write_fn_t _write_fn; + wait_fn_t _wait_fn; adf535x_regs_t _regs; bool _rewrite_regs; uint32_t _wait_time_us; @@ -359,10 +362,9 @@ inline void adf535x_impl<adf5355_regs_t>::_commit() regs.push_back(_regs.get_reg(addr)); } _write_fn(regs); - // TODO Add FPGA based delay between these writes + _wait_fn(_wait_time_us); _write_fn(addr_vtr_t(ONE_REG, _regs.get_reg(0))); _rewrite_regs = false; - } else { //Frequency update sequence from data sheet _write_fn(addr_vtr_t(ONE_REG, _regs.get_reg(6))); @@ -374,7 +376,6 @@ inline void adf535x_impl<adf5355_regs_t>::_commit() _write_fn(addr_vtr_t(ONE_REG, _regs.get_reg(0))); _regs.counter_reset = adf5355_regs_t::COUNTER_RESET_DISABLED; _write_fn(addr_vtr_t(ONE_REG, _regs.get_reg(4))); - // TODO Add FPGA based delay between these writes _regs.autocal_en = adf5355_regs_t::AUTOCAL_EN_ENABLED; _write_fn(addr_vtr_t(ONE_REG, _regs.get_reg(0))); } @@ -458,18 +459,15 @@ inline void adf535x_impl<adf5356_regs_t>::_commit() regs.push_back(_regs.get_reg(addr)); } _write_fn(regs); - // TODO Add FPGA based delay between these writes + _wait_fn(_wait_time_us); _write_fn(addr_vtr_t(ONE_REG, _regs.get_reg(0))); _rewrite_regs = false; - } 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(10))); _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))); - // TODO Add FPGA based delay between these writes _write_fn(addr_vtr_t(ONE_REG, _regs.get_reg(0))); } } diff --git a/host/lib/usrp/common/adf535x.cpp b/host/lib/usrp/common/adf535x.cpp index 67a94bcc1..ab81fbee7 100644 --- a/host/lib/usrp/common/adf535x.cpp +++ b/host/lib/usrp/common/adf535x.cpp @@ -6,12 +6,12 @@ #include <uhdlib/usrp/common/adf535x.hpp> -adf535x_iface::sptr adf535x_iface::make_adf5355(write_fn_t write) +adf535x_iface::sptr adf535x_iface::make_adf5355(write_fn_t write, wait_fn_t wait) { - return std::make_shared<adf535x_impl<adf5355_regs_t>>(write); + return std::make_shared<adf535x_impl<adf5355_regs_t>>(write, wait); } -adf535x_iface::sptr adf535x_iface::make_adf5356(write_fn_t write) +adf535x_iface::sptr adf535x_iface::make_adf5356(write_fn_t write, wait_fn_t wait) { - return std::make_shared<adf535x_impl<adf5356_regs_t>>(write); -}
\ No newline at end of file + return std::make_shared<adf535x_impl<adf5356_regs_t>>(write, wait); +} diff --git a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp index 1b45805e7..55b74753c 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp @@ -25,7 +25,7 @@ namespace { const double TWINRX_DESIRED_REFERENCE_FREQ = 50e6; const double TWINRX_REV_AB_PFD_FREQ = 6.25e6; const double TWINRX_REV_C_PFD_FREQ = 12.5e6; - const double TWINRX_SPI_CLOCK_FREQ = 3e6; + const double TWINRX_SPI_CLOCK_FREQ = 10e6; } class twinrx_ctrl_impl : public twinrx_ctrl { @@ -99,14 +99,19 @@ public: _lo1_iface[i] = adf535x_iface::make_adf5356( [this](const std::vector<uint32_t>& regs) { _write_lo_spi(dboard_iface::UNIT_TX, regs); + }, + [this](uint32_t microseconds) { + _db_iface->sleep(boost::chrono::microseconds(microseconds)); } ); _lo1_iface[i]->set_pfd_freq(TWINRX_REV_C_PFD_FREQ); - } else { _lo1_iface[i] = adf535x_iface::make_adf5355( [this](const std::vector<uint32_t>& regs) { _write_lo_spi(dboard_iface::UNIT_TX, regs); + }, + [this](uint32_t microseconds) { + _db_iface->sleep(boost::chrono::microseconds(microseconds)); } ); _lo1_iface[i]->set_pfd_freq(TWINRX_REV_AB_PFD_FREQ); |