Change in osmo-trx[master]: uhd: ensure configured clock source is actually used

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Hoernchen gerrit-no-reply at lists.osmocom.org
Fri May 28 19:20:34 UTC 2021


Hoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-trx/+/24447 )


Change subject: uhd: ensure configured clock source is actually used
......................................................................

uhd: ensure configured clock source is actually used

We wouldn't want to get caught running with unlocked external clock
sources, right?!

Change-Id: Ie38d85617f46eb5ab7d9527ddf6aaab4d3edf6bf
---
M Transceiver52M/device/uhd/UHDDevice.cpp
1 file changed, 14 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/47/24447/1

diff --git a/Transceiver52M/device/uhd/UHDDevice.cpp b/Transceiver52M/device/uhd/UHDDevice.cpp
index 010fa8c..cb69a50 100644
--- a/Transceiver52M/device/uhd/UHDDevice.cpp
+++ b/Transceiver52M/device/uhd/UHDDevice.cpp
@@ -620,6 +620,20 @@
 
 	usrp_dev->set_clock_source(refstr);
 
+	std::vector<std::string> sensor_names = usrp_dev->get_mboard_sensor_names();
+	if (std::find(sensor_names.begin(), sensor_names.end(), "ref_locked") != sensor_names.end()) {
+		LOGC(DDEV, INFO) << "Waiting for clock reference lock (max 5s)..." << std::flush;
+		int counter = 5;
+		while (!usrp_dev->get_mboard_sensor("ref_locked", 0).to_bool() && counter-- > 0)
+			std::this_thread::sleep_for(std::chrono::seconds(1));
+
+		if (counter < 0) {
+			LOGC(DDEV, ALERT) << "Locking to external 10Mhz failed!";
+			return -1;
+			}
+		}
+	LOGC(DDEV, INFO) << "Selected clock source is " << usrp_dev->get_clock_source(0);
+
 	try {
 		set_rates();
         } catch (const std::exception &e) {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/24447
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Ie38d85617f46eb5ab7d9527ddf6aaab4d3edf6bf
Gerrit-Change-Number: 24447
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210528/965f3468/attachment.htm>


More information about the gerrit-log mailing list