aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/common/adf4001_ctrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/common/adf4001_ctrl.cpp')
-rw-r--r--host/lib/usrp/common/adf4001_ctrl.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/host/lib/usrp/common/adf4001_ctrl.cpp b/host/lib/usrp/common/adf4001_ctrl.cpp
index 076385050..e38142f93 100644
--- a/host/lib/usrp/common/adf4001_ctrl.cpp
+++ b/host/lib/usrp/common/adf4001_ctrl.cpp
@@ -101,8 +101,8 @@ adf4001_ctrl::adf4001_ctrl(uhd::spi_iface::sptr _spi, int slaveno):
spi_config.mosi_edge = spi_config_t::EDGE_RISE;
//set defaults
- adf4001_regs.ref_counter = 96;
- adf4001_regs.n = 125;
+ adf4001_regs.ref_counter = 1;
+ adf4001_regs.n = 4;
adf4001_regs.charge_pump_current_1 = 7;
adf4001_regs.charge_pump_current_2 = 7;
adf4001_regs.muxout = adf4001_regs_t::MUXOUT_DLD;
@@ -125,6 +125,22 @@ void adf4001_ctrl::set_lock_to_ext_ref(bool external) {
program_regs();
}
+bool adf4001_ctrl::set_refclk_frequency(int refclk_kHz)
+{
+ if (refclk_kHz == 30720) {
+ adf4001_regs.ref_counter = 96;
+ adf4001_regs.n = 125;
+ } else if (refclk_kHz == 10000) {
+ adf4001_regs.ref_counter = 1;
+ adf4001_regs.n = 4;
+ } else {
+ return false;
+ }
+
+ program_regs();
+ return true;
+}
+
void adf4001_ctrl::program_regs(void) {
//no control over CE, only LE, therefore we use the initialization latch method
write_reg(3);