Skip to content
Snippets Groups Projects
Commit 2b6a92f7 authored by GijsSchoonderbeek's avatar GijsSchoonderbeek
Browse files

Update lock read-out.

parent c2d40fc8
Branches
No related tags found
1 merge request!6Apsct ad9511
......@@ -246,7 +246,6 @@ class PllClass:
#
# Read all registers on the PLL and print on screen
#
self.dev_i2c_pll.write_bytes(0x07, 0x00)
bytes_to_read = 12
ret_value = self.read_byte_pll(0, nof_bytes=bytes_to_read)
for cnt in range(bytes_to_read):
......@@ -258,18 +257,20 @@ class PllClass:
#
# Read lock status
#
ret_value = self.read_byte_pll(0x00, nof_bytes=1)
status_pll = int(ret_value, 2)
if status_pll == 0x04:
if (self.frequency == '200MHz'):
i2_c_io_device = I2C(0x20, BUSNR=I2CBUSNR)
else:
i2_c_io_device = I2C(0x21, BUSNR=I2CBUSNR)
i2_c_io_device.write_bytes(0x06, 0x2C) # '0' is output
i2_c_io_device.write_bytes(0x07, 0x00) # '0' is output
ack, ret_value = i2_c_io_device_b.read_bytes(0x00, 1)
status_pll = ret_value & 0x02
if status_pll == 0x02:
self.lock = True
stri = f"PLL {self.frequency} is in lock"
elif (status_pll & 0x10) > 0:
self.lock = False
stri = f"PLL {self.frequency} Not Locked --> No 10 MHz ref"
else:
self.lock = False
stri = f"PLL {self.frequency} Not locked --> PLL Error"
if print_on:
stri = f"PLL {self.frequency} is not locked"
print(stri)
return self.lock
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment