aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/x300
diff options
context:
space:
mode:
authorMichael West <michael.west@ettus.com>2018-04-10 12:25:29 -0700
committerMartin Braun <martin.braun@ettus.com>2018-07-17 09:35:31 -0700
commitb75ca6cd9143a730d827c3b5e353a9086a79d210 (patch)
tree78e9e503184be80722372289d2871c37936a7515 /host/lib/usrp/x300
parent08855405d6511774f65d2b7c7a976202e215bb7d (diff)
downloaduhd-b75ca6cd9143a730d827c3b5e353a9086a79d210.tar.gz
uhd-b75ca6cd9143a730d827c3b5e353a9086a79d210.tar.bz2
uhd-b75ca6cd9143a730d827c3b5e353a9086a79d210.zip
UBX: Add support for phase synchronization at LTE clock rates
Diffstat (limited to 'host/lib/usrp/x300')
-rw-r--r--host/lib/usrp/x300/x300_impl.cpp17
-rw-r--r--host/lib/usrp/x300/x300_regs.hpp12
2 files changed, 28 insertions, 1 deletions
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp
index 4a8c12e04..051242e0a 100644
--- a/host/lib/usrp/x300/x300_impl.cpp
+++ b/host/lib/usrp/x300/x300_impl.cpp
@@ -888,12 +888,27 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
//Initialize clock control registers. NOTE: This does not configure the LMK yet.
const double requested_mcr = dev_addr.cast<double>("master_clock_rate", X300_DEFAULT_TICK_RATE);
+ //Some daughterboards may require other rates, but these defaults
+ //work best for all newer daughterboards (i.e. CBX, WBX, SBX, UBX,
+ //and TwinRX).
+ double default_dboard_clk_rate = requested_mcr;
+ if (math::frequencies_are_equal(requested_mcr, 200e6)) {
+ default_dboard_clk_rate = 50e6;
+ } else if (math::frequencies_are_equal(requested_mcr, 184.32e6)) {
+ default_dboard_clk_rate = 46.08e6;
+ } else if (math::frequencies_are_equal(requested_mcr, 120e6)) {
+ default_dboard_clk_rate = 40e6;
+ }
mb.clock = x300_clock_ctrl::make(mb.zpu_spi,
1 /*slaveno*/,
mb.hw_rev,
requested_mcr,
- dev_addr.cast<double>("dboard_clock_rate", requested_mcr / 4),
+ dev_addr.cast<double>("dboard_clock_rate", default_dboard_clk_rate),
dev_addr.cast<double>("system_ref_rate", X300_DEFAULT_SYSREF_RATE));
+ mb.fw_regmap->ref_freq_reg.write(
+ fw_regmap_t::ref_freq_reg_t::REF_FREQ,
+ uint32_t(dev_addr.cast<double>("system_ref_rate",
+ X300_DEFAULT_SYSREF_RATE)));
//Initialize clock source to use internal reference and generate
//a valid radio clock. This may change after configuration is done.
diff --git a/host/lib/usrp/x300/x300_regs.hpp b/host/lib/usrp/x300/x300_regs.hpp
index 68b405dfe..b54c5c2bb 100644
--- a/host/lib/usrp/x300/x300_regs.hpp
+++ b/host/lib/usrp/x300/x300_regs.hpp
@@ -30,6 +30,7 @@ static const int ZPU_SR_LEDS = 00;
static const int ZPU_SR_SW_RST = 01;
static const int ZPU_SR_CLOCK_CTRL = 02;
static const int ZPU_SR_XB_LOCAL = 03;
+static const int ZPU_SR_REF_FREQ = 04;
static const int ZPU_SR_SPI = 32;
static const int ZPU_SR_ETHINT0 = 40;
static const int ZPU_SR_ETHINT1 = 56;
@@ -204,9 +205,20 @@ namespace uhd { namespace usrp { namespace x300 {
clk_status_reg_t(): uhd::soft_reg32_ro_t(SR_ADDR(SET0_BASE, ZPU_RB_CLK_STATUS)) {}
} clock_status_reg;
+ class ref_freq_reg_t : public uhd::soft_reg32_wo_t {
+ public:
+ UHD_DEFINE_SOFT_REG_FIELD(REF_FREQ, /*width*/ 32, /*shift*/ 0);
+
+ ref_freq_reg_t(): uhd::soft_reg32_wo_t(SR_ADDR(SET0_BASE, ZPU_SR_REF_FREQ)) {
+ //Initial values
+ set(REF_FREQ, 10000000);
+ }
+ } ref_freq_reg;
+
fw_regmap_t() : soft_regmap_t("fw_regmap") {
add_to_map(clock_ctrl_reg, "clock_ctrl_reg", PUBLIC);
add_to_map(clock_status_reg, "clock_status_reg", PUBLIC);
+ add_to_map(ref_freq_reg, "ref_freq_reg", PUBLIC);
}
};