From a8c21f558191344754296d77fa02887b1c9f0533 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Fri, 21 Jan 2011 11:12:36 -0800 Subject: TVRX: fixed spectrum inversion on USRP1, hopefully for the last $%^&* time. --- host/lib/usrp/dboard/db_tvrx.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp index 4eb29c3e8..95657fef3 100644 --- a/host/lib/usrp/dboard/db_tvrx.cpp +++ b/host/lib/usrp/dboard/db_tvrx.cpp @@ -54,7 +54,7 @@ using namespace boost::assign; /*********************************************************************** * The tvrx constants **********************************************************************/ -static const bool tvrx_debug = false; +static const bool tvrx_debug = true; static const freq_range_t tvrx_freq_range(50e6, 860e6); @@ -383,7 +383,7 @@ static double get_alias(double freq, double fs) { double alias; freq = fmod(freq, fs); if(freq >= (fs/2)) { - alias = fs - freq; + alias = freq - fs; } else { alias = freq; } @@ -429,6 +429,14 @@ void tvrx::rx_get(const wax::obj &key_, wax::obj &val){ */ codec_rate = this->get_iface()->get_codec_rate(dboard_iface::UNIT_RX); val = (_lo_freq - tvrx_if_freq) + get_alias(tvrx_if_freq, codec_rate); + if(tvrx_debug) { + std::cout << "Getting TVRX freq..." << std::endl; + std::cout << "\tCodec rate: " << codec_rate << std::endl; + std::cout << "\tLO freq: " << _lo_freq << std::endl; + std::cout << "\tIF freq: " << tvrx_if_freq << std::endl; + std::cout << "\tAlias freq: " << get_alias(tvrx_if_freq, codec_rate) << std::endl; + std::cout << "\tCalculated freq: " << val.as() << std::endl; + } return; case SUBDEV_PROP_FREQ_RANGE: -- cgit v1.2.3