summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-04-16 17:51:05 +0100
committerJosh Blum <josh@joshknows.com>2011-04-16 17:51:05 +0100
commit546b5b882902a065c667b45d0529978340457786 (patch)
treee77942998c2f0c750fa9568a3593544bcace828d /host/lib/usrp/dboard
parentcaff65d7e140d6340cef6ccd64ef250a735c09f9 (diff)
downloaduhd-546b5b882902a065c667b45d0529978340457786.tar.gz
uhd-546b5b882902a065c667b45d0529978340457786.tar.bz2
uhd-546b5b882902a065c667b45d0529978340457786.zip
rfx: reverted change, now prefer R divider to clock divider
There seems to be some issue using lower clock rates, at least on E100, I am reverting this now until I can figure out why it happens, or until I can find a more stable way to offer this feature.
Diffstat (limited to 'host/lib/usrp/dboard')
-rw-r--r--host/lib/usrp/dboard/db_rfx.cpp39
1 files changed, 17 insertions, 22 deletions
diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp
index f938c749a..725b5cc03 100644
--- a/host/lib/usrp/dboard/db_rfx.cpp
+++ b/host/lib/usrp/dboard/db_rfx.cpp
@@ -312,8 +312,7 @@ double rfx_xcvr::set_lo_freq(
(8, adf4360_regs_t::BAND_SELECT_CLOCK_DIV_8)
;
- std::vector<double> clock_rates = this->get_iface()->get_clock_rates(unit);
- double actual_freq = 0, ref_freq = 0;
+ double actual_freq=0, ref_freq = this->get_iface()->get_clock_rate(unit);
int R=0, BS=0, P=0, B=0, A=0;
/*
@@ -326,31 +325,27 @@ double rfx_xcvr::set_lo_freq(
* fvco = [P*B + A] * fref/R
* fvco*R/fref = P*B + A = N
*/
- for(R = 1; R <= 32; R+=((R==1)?1:2)){
- BOOST_FOREACH(ref_freq, uhd::reversed(uhd::sorted(clock_rates))){
- BOOST_FOREACH(BS, bandsel_to_enum.keys()){
- if (ref_freq/R/BS > 1e6) continue; //constraint on band select clock
- BOOST_FOREACH(P, prescaler_to_enum.keys()){
- //calculate B and A from N
- double N = target_freq*R/ref_freq;
- B = int(std::floor(N/P));
- A = boost::math::iround(N - P*B);
- if (B < A or B > 8191 or B < 3 or A > 31) continue; //constraints on A, B
- //calculate the actual frequency
- actual_freq = double(P*B + A)*ref_freq/R;
- if (actual_freq/P > 300e6) continue; //constraint on prescaler output
- //constraints met: exit loop
- goto done_loop;
- }
+ for(R = 2; R <= 32; R+=2){
+ BOOST_FOREACH(BS, bandsel_to_enum.keys()){
+ if (ref_freq/R/BS > 1e6) continue; //constraint on band select clock
+ BOOST_FOREACH(P, prescaler_to_enum.keys()){
+ //calculate B and A from N
+ double N = target_freq*R/ref_freq;
+ B = int(std::floor(N/P));
+ A = boost::math::iround(N - P*B);
+ if (B < A or B > 8191 or B < 3 or A > 31) continue; //constraints on A, B
+ //calculate the actual frequency
+ actual_freq = double(P*B + A)*ref_freq/R;
+ if (actual_freq/P > 300e6) continue; //constraint on prescaler output
+ //constraints met: exit loop
+ goto done_loop;
}
}
} done_loop:
if (rfx_debug) std::cerr << boost::format(
- "RFX tune: R=%d, BS=%d, P=%d, B=%d, A=%d, DIV2=%d, ref=%fMHz"
- ) % R % BS % P % B % A % int(_div2[unit] && (!is_rx_rfx400)) % (ref_freq/1e6) << std::endl;
-
- this->get_iface()->set_clock_rate(unit, ref_freq);
+ "RFX tune: R=%d, BS=%d, P=%d, B=%d, A=%d, DIV2=%d"
+ ) % R % BS % P % B % A % int(_div2[unit] && (!is_rx_rfx400)) << std::endl;
//load the register values
adf4360_regs_t regs;