aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python/usrp_mpm/dboard_manager
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-10-18 13:21:36 -0700
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:04:02 -0800
commitf2bcec594593bb2050a128a766510d500874b4f8 (patch)
treec5a3c6821caf9df039f16a45852294ccbb967035 /mpm/python/usrp_mpm/dboard_manager
parent99c5b6fff8426dd9f2fb8f0d26b12fc9405697f4 (diff)
downloaduhd-f2bcec594593bb2050a128a766510d500874b4f8.tar.gz
uhd-f2bcec594593bb2050a128a766510d500874b4f8.tar.bz2
uhd-f2bcec594593bb2050a128a766510d500874b4f8.zip
mpm: Replace MMCM lock and TDC PPS sleeps with poll_with_timeout
This increases init speed by replacing worst-case sleeps with polls.
Diffstat (limited to 'mpm/python/usrp_mpm/dboard_manager')
-rw-r--r--mpm/python/usrp_mpm/dboard_manager/magnesium.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/mpm/python/usrp_mpm/dboard_manager/magnesium.py b/mpm/python/usrp_mpm/dboard_manager/magnesium.py
index 48934af1f..b71be6901 100644
--- a/mpm/python/usrp_mpm/dboard_manager/magnesium.py
+++ b/mpm/python/usrp_mpm/dboard_manager/magnesium.py
@@ -34,6 +34,7 @@ from usrp_mpm.periph_manager.udev import get_eeprom_paths
from usrp_mpm.cores import ClockSynchronizer
from ..sysfs_gpio import SysFSGPIO
from usrp_mpm.bfrfs import BufferFS
+from usrp_mpm.mpmutils import poll_with_timeout
def create_spidev_iface(dev_node):
"""
@@ -595,12 +596,14 @@ class DboardClockControl(object):
"""
self.log.trace("Un-resetting MMCM...")
self.poke32(self.RADIO_CLK_MMCM, 0x2)
- time.sleep(0.5) # Replace with poll and timeout TODO
- mmcm_locked = bool(self.peek32(self.RADIO_CLK_MMCM) & 0x10)
- if not mmcm_locked:
+ if not poll_with_timeout(
+ lambda: bool(self.peek32(self.RADIO_CLK_MMCM) & 0x10),
+ 500,
+ 10,
+ ):
self.log.error("MMCM not locked!")
raise RuntimeError("MMCM not locked!")
- self.log.trace("Enabling output MMCM clocks...")
+ self.log.trace("MMCM locked. Enabling output MMCM clocks...")
self.enable_outputs(True)
def check_refclk(self):