Skip to content
Snippets Groups Projects
Commit 7ca7abef authored by Gijs Schoonderbeek's avatar Gijs Schoonderbeek
Browse files

Loss of lock circuit is working

parent 4e6ac599
No related branches found
No related tags found
1 merge request!6Apsct ad9511
......@@ -299,8 +299,8 @@ class PllClass:
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.read_bytes(0x00, 1)
status_pll = int(ret_value) & 0x02
if status_pll == 0x02:
status_pll = int(ret_value, 16) & 0x04
if status_pll :
self.lock = True
stri = f"PLL {self.frequency} is in lock"
else:
......@@ -319,13 +319,14 @@ class PllClass:
i2_c_io_device_b = I2C(0x21, BUSNR=I2CBUSNR)
i2_c_io_device_b.write_bytes(0x06, 0x2C) # '0' is output
i2_c_io_device_b.write_bytes(0x07, 0xFF) # '0' is output
ack, ret_value = i2_c_io_device_b.read_bytes(0x01, 1)
status_reg = int(ret_value, 16)
if (self.frequency == '200MHz') & ((status_reg & 0x10) > 0):
print("200MHz has lost lock")
if ((status_reg & 0x20) > 0) & (self.frequency == '160MHz'):
print("160MHz has last lock")
if (self.frequency == '200MHz'):
lol = (status_reg & 0x10)
else:
lol = (status_reg & 0x20)
if lol :
print(f"{self.frequency} has lost lock")
ack, ret_value = i2_c_io_device_a.read_bytes(0x01, 1)
old_reg = int(ret_value, 16)
i2_c_io_device_a.write_bytes(0x03, (old_reg | 0x10)) # '0' is output
......@@ -651,12 +652,14 @@ def main():
if False:
apsct.power(False)
sleep(1)
apsct.power(True)
sleep(1)
# apsct.power(True)
# sleep(1)
if False:
apsct.pll_200.write_byte_pll(0x06, 0xA5)
apsct.pll_200.write_byte_pll(0x5A, 0x01)
apsct.pll_200.setup_pll()
apsct.pll_200.read_lol()
apsct.pll_200.read_lock()
# apsct.pll_200.read_all_regs_pll()
# apsct.sensors.read_all_voltages()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment