diff --git a/apsct_lib.py b/apsct_lib.py index 5ff0196084be5c168de040942a41528d82440f4d..886a37a01ba5d9ca8cd48d1ccb77719e5b3f2799 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):