aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python/usrp_mpm/dboard_manager/magnesium.py
diff options
context:
space:
mode:
Diffstat (limited to 'mpm/python/usrp_mpm/dboard_manager/magnesium.py')
-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):