From 7149658fbbee12114429183f8015effd5f59a5f6 Mon Sep 17 00:00:00 2001
From: "Matthias P. Braendli" <matthias.braendli@mpb.li>
Date: Fri, 15 Jul 2016 11:43:17 +0200
Subject: Autoconfigure refclk frequency if LEA-M8F detected

This should make this branch compatible with both Ettus GPSDO
using 10MHz refclk and the LEA-M8F using 30.72MHz
---
 host/lib/usrp/b200/b200_impl.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'host/lib/usrp/b200/b200_impl.cpp')

diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp
index 4b17b27f0..a4d43f6b9 100644
--- a/host/lib/usrp/b200/b200_impl.cpp
+++ b/host/lib/usrp/b200/b200_impl.cpp
@@ -722,6 +722,13 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s
     //GPS installed: use external ref, time, and init time spec
     if (_gps and _gps->gps_detected())
     {
+        if (_gps->gps_detected_lea_m8f()) {
+            // Switch REFCLK Frequency to 30.72MHz before setting clock_source to gpsdo
+            if (not _adf4001_iface->set_refclk_frequency(30720)) {
+                throw uhd::value_error("Could not set refclk frequency to 30.72MHz for LEA-M8F!");
+            }
+        }
+
         UHD_MSG(status) << "Setting references to the internal GPSDO" << std::endl;
         _tree->access<std::string>(mb_path / "time_source" / "value").set("gpsdo");
         _tree->access<std::string>(mb_path / "clock_source" / "value").set("gpsdo");
-- 
cgit v1.2.3