From f3bf32df9f747aa47f8463516e817c305e731231 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 3 Dec 2010 15:54:04 -0500 Subject: usrp-n: set ad9777 mod mode to transmit above nyquist of DSP --- host/lib/usrp/usrp2/dsp_impl.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'host/lib/usrp/usrp2/dsp_impl.cpp') diff --git a/host/lib/usrp/usrp2/dsp_impl.cpp b/host/lib/usrp/usrp2/dsp_impl.cpp index 77ed594f5..8340f7cdd 100644 --- a/host/lib/usrp/usrp2/dsp_impl.cpp +++ b/host/lib/usrp/usrp2/dsp_impl.cpp @@ -20,6 +20,9 @@ #include #include #include +#include +#include +#include #include using namespace uhd; @@ -177,11 +180,23 @@ void usrp2_mboard_impl::duc_set(const wax::obj &key_, const wax::obj &val){ switch(key.as()){ case DSP_PROP_FREQ_SHIFT:{ + const double codec_rate = get_master_clock_freq(); double new_freq = val.as(); + + //calculate the DAC shift (multiples of rate) + const int sign = boost::math::sign(new_freq); + const int zone = std::min(boost::math::iround(new_freq/codec_rate), 2); + const double dac_shift = sign*zone*codec_rate; + new_freq -= dac_shift; //update FPGA DSP target freq + + //set the DAC shift (modulation mode) + if (zone == 0) _codec_ctrl->set_tx_mod_mode(0); //no shift + else _codec_ctrl->set_tx_mod_mode(sign*4/zone); //DAC interp = 4 + _iface->poke32(_iface->regs.dsp_tx_freq, - dsp_type1::calc_cordic_word_and_update(new_freq, get_master_clock_freq()) + dsp_type1::calc_cordic_word_and_update(new_freq, codec_rate) ); - _duc_freq = new_freq; //shadow + _duc_freq = new_freq + dac_shift; //shadow } return; -- cgit v1.2.3