aboutsummaryrefslogtreecommitdiffstats
path: root/mpm
diff options
context:
space:
mode:
authordjepson1 <daniel.jepson@ni.com>2017-06-06 14:40:29 -0500
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:03:59 -0800
commit07b8682239f1d10d49274e1db5a731b5dc9ed53d (patch)
treef2c5997591046e2e99a76736c4088494895316a8 /mpm
parenteae3ab9c7f6fb8c9aa7f4240cbf9b81406cd6948 (diff)
downloaduhd-07b8682239f1d10d49274e1db5a731b5dc9ed53d.tar.gz
uhd-07b8682239f1d10d49274e1db5a731b5dc9ed53d.tar.bz2
uhd-07b8682239f1d10d49274e1db5a731b5dc9ed53d.zip
mpmd/cores: Removed PPS disable logic from TDC routine and added comments
Diffstat (limited to 'mpm')
-rw-r--r--mpm/python/usrp_mpm/cores/tdc_sync.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/mpm/python/usrp_mpm/cores/tdc_sync.py b/mpm/python/usrp_mpm/cores/tdc_sync.py
index cc5158525..cc9981205 100644
--- a/mpm/python/usrp_mpm/cores/tdc_sync.py
+++ b/mpm/python/usrp_mpm/cores/tdc_sync.py
@@ -131,12 +131,14 @@ class ClockSynchronizer(object):
self.log.trace("Running clock synchronization...")
- # Reset and disable TDC, disable PPS crossing, and enable re-runs. Confirm the
- # core is in reset and PPS is cleared.
- self.poke32(self.TDC_CONTROL, 0x2121)
+ # Reset and disable TDC, and enable re-runs. Confirm the core is in
+ # reset and PPS is cleared. Do not disable the PPS crossing.
+ self.poke32(self.TDC_CONTROL, 0x0121)
reset_status = self.peek32(self.TDC_STATUS) & 0xFF
if reset_status != 0x01:
- self.log.error("TDC Failed to Reset! Status: 0x{:x}".format(reset_status))
+ self.log.error("TDC Failed to Reset! Status: 0x{:x}".format(
+ reset_status
+ ))
raise RuntimeError("TDC Failed to reset.")
# Set the RSP and RTC values based on the Radio Clock and Reference Clock
@@ -164,11 +166,10 @@ class ClockSynchronizer(object):
if reset_status != 0x00:
self.log.error(
"TDC Reset Failed to Clear! " \
- "Check that your clocks are toggling. Status: 0x{:x}".format(reset_status)
- )
+ "Check that your clocks are toggling. Status: 0x{:x}".format(
+ reset_status
+ ))
raise RuntimeError("TDC Reset Failed.")
-
-
self.log.trace("Enabling the TDC")
# Enable the TDC.
# As long as PPS is actually a PPS, this doesn't have to happen "synchronously"
@@ -185,7 +186,7 @@ class ClockSynchronizer(object):
raise RuntimeError("Failed to capture PPS.")
self.log.trace("PPS Captured!")
-
+
meas_clk_freq = 170.542641116e6
measure_offset = lambda: self.read_tdc_meas(
1/meas_clk_freq, 1/self.ref_clk_freq, 1/self.radio_clk_freq
@@ -232,7 +233,11 @@ class ClockSynchronizer(object):
time.sleep(0.5)
if not self.lmk.check_plls_locked():
raise RuntimeError("LMK PLLs lost lock during clock synchronization!")
- self.poke32(self.TDC_CONTROL, 0x1000) # Re-enable PPS
+ # After shifting the clocks, we enable the PPS crossing from the
+ # RefClk into the SampleClk domain. We never explicitly turn off the
+ # crossing from this point forward, even if we re-run this routine.
+ self.poke32(self.TDC_CONTROL, 0x1000)
+
return distance_to_target