From 2b6a92f78a585c0658a16e23978f06a34cf93f6d Mon Sep 17 00:00:00 2001 From: GijsSchoonderbeek <gijs2272@gmail.com> Date: Mon, 13 Feb 2023 13:12:29 +0100 Subject: [PATCH] Update lock read-out. --- apsct_lib.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/apsct_lib.py b/apsct_lib.py index 5ff0196..886a37a 100644 --- a/apsct_lib.py +++ b/apsct_lib.py @@ -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,19 +257,21 @@ 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: - print(stri) + stri = f"PLL {self.frequency} is not locked" + print(stri) return self.lock def read_lol(self): -- GitLab