aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python/usrp_mpm/chips
diff options
context:
space:
mode:
authorDaniel Jepson <daniel.jepson@ni.com>2017-05-30 18:10:23 -0700
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:03:58 -0800
commit273b959fd3af317ddde34a88f845e21a689dc8a0 (patch)
tree89aca49590d09c1a2feedda49ecb153029db654a /mpm/python/usrp_mpm/chips
parentfc89cd3c42e67af5c5f46b880d6da309d4104c48 (diff)
downloaduhd-273b959fd3af317ddde34a88f845e21a689dc8a0.tar.gz
uhd-273b959fd3af317ddde34a88f845e21a689dc8a0.tar.bz2
uhd-273b959fd3af317ddde34a88f845e21a689dc8a0.zip
mpm/eiscat: Updates to LMK04828 driver
Diffstat (limited to 'mpm/python/usrp_mpm/chips')
-rw-r--r--mpm/python/usrp_mpm/chips/lmk04828.py28
1 files changed, 25 insertions, 3 deletions
diff --git a/mpm/python/usrp_mpm/chips/lmk04828.py b/mpm/python/usrp_mpm/chips/lmk04828.py
index 3b9a35bae..a67ca05fd 100644
--- a/mpm/python/usrp_mpm/chips/lmk04828.py
+++ b/mpm/python/usrp_mpm/chips/lmk04828.py
@@ -28,7 +28,7 @@ class LMK04828(object):
def __init__(self, regs_iface, postfix=None):
postfix = postfix or ""
- self.log = get_logger("LMK04828"+postfix)
+ self.log = get_logger("LMK04828{}".format(postfix))
self.regs_iface = regs_iface
assert hasattr(self.regs_iface, 'peek8')
assert hasattr(self.regs_iface, 'poke8')
@@ -41,13 +41,13 @@ class LMK04828(object):
pokes8((0,1),(0,2)) is the same as calling poke8(0,1), poke8(0,2).
"""
for addr, val in addr_vals:
- self.regs_iface.poke8(addr, val)
+ self.poke8(addr, val)
def get_chip_id(self):
"""
Read back the chip ID
"""
- chip_id = self.regs_iface.peek8(0x03)
+ chip_id = self.peek8(0x03)
self.log.trace("Read chip ID: {}".format(chip_id))
return chip_id
@@ -61,3 +61,25 @@ class LMK04828(object):
return False
return True
+ def check_plls_locked(self):
+ """
+ Checks both PLLs are locked. Will throw an exception otherwise.
+ Returns True if both PLLs are locked, False otherwise.
+ """
+ self.log.trace("Checking PLL lock bits...")
+ def check_pll_lock(pll_id, addr):
+ """
+
+ pll_id -- A string defining the PLL (e.g. 'PLL1')
+ addr -- The address to peek to see if it's locked
+ """
+ pll_lock_status = self.regs_iface.peek8(addr)
+ if (pll_lock_status & 0x7) != 0x02:
+ self.log.error("LMK {} did not lock. Status: {:x}".format(pll_id, pll_lock_status))
+ return False
+ return True
+ lock_status = \
+ check_pll_lock("PLL1", 0x182) and \
+ check_pll_lock("PLL2", 0x183)
+ return lock_status
+