aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorBen Hilburn <ben.hilburn@ettus.com>2014-05-20 14:00:19 -0700
committerBen Hilburn <ben.hilburn@ettus.com>2014-05-20 14:00:19 -0700
commit54674084d36ea529290b4ad4493df3025ef0f041 (patch)
tree47a113f08273ad8488ff8f67a5fc1253fcddf780 /host/lib
parent3e49237e5d3a06a767c3e64d099570204452d23f (diff)
parentab5aa84557a79ff537844f25226b22c0459f7348 (diff)
downloaduhd-54674084d36ea529290b4ad4493df3025ef0f041.tar.gz
uhd-54674084d36ea529290b4ad4493df3025ef0f041.tar.bz2
uhd-54674084d36ea529290b4ad4493df3025ef0f041.zip
Fixing Bug #473 - Autoselection of VCO Frequency in DBSRX2
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/usrp/dboard/db_dbsrx2.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/host/lib/usrp/dboard/db_dbsrx2.cpp b/host/lib/usrp/dboard/db_dbsrx2.cpp
index 8a8f61a69..1debe3c8f 100644
--- a/host/lib/usrp/dboard/db_dbsrx2.cpp
+++ b/host/lib/usrp/dboard/db_dbsrx2.cpp
@@ -40,7 +40,7 @@ using namespace boost::assign;
/***********************************************************************
* The DBSRX2 constants
**********************************************************************/
-static const freq_range_t dbsrx2_freq_range(0.8e9, 2.4e9);
+static const freq_range_t dbsrx2_freq_range(0.8e9, 2.3e9);
//Multiplied by 2.0 for conversion to complex bandpass from lowpass
static const freq_range_t dbsrx2_bandwidth_range(2.0*4.0e6, 2.0*40.0e6);
@@ -245,7 +245,7 @@ double dbsrx2::set_lo_freq(double target_freq){
//target_freq = dbsrx2_freq_range.clip(target_freq);
//variables used in the calculation below
- int scaler = target_freq > 1125e6 ? 2 : 4;
+ int scaler = target_freq >= 1125e6 ? 2 : 4;
double ref_freq = this->get_iface()->get_clock_rate(dboard_iface::UNIT_RX);
int R, intdiv, fracdiv, ext_div;
double N;
@@ -279,8 +279,10 @@ double dbsrx2::set_lo_freq(double target_freq){
<< boost::format(" Actual Freq=%fMHz\n") % (_lo_freq/1e6)
<< std::endl;
- //send the registers
- send_reg(0x0, 0x7);
+ //send the registers 0x0 through 0x7
+ //writing register 0x4 (F divider LSB) starts the VCO auto seletion so it must be written last
+ send_reg(0x5, 0x7);
+ send_reg(0x0, 0x4);
//FIXME: probably unnecessary to call get_locked here
//get_locked();
@@ -304,7 +306,7 @@ static int gain_to_bbg_vga_reg(double &gain){
UHD_LOGV(often)
<< boost::format("DBSRX2 BBG Gain:\n")
- << boost::format(" %f dB, bbg: %d") % gain % reg
+ << boost::format(" %f dB, bbg: %d") % gain % reg
<< std::endl;
return reg;
@@ -329,7 +331,7 @@ static double gain_to_gc1_rfvga_dac(double &gain){
UHD_LOGV(often)
<< boost::format("DBSRX2 GC1 Gain:\n")
- << boost::format(" %f dB, dac_volts: %f V") % gain % dac_volts
+ << boost::format(" %f dB, dac_volts: %f V") % gain % dac_volts
<< std::endl;
//the actual gain setting