From 783d777a53ef7674de0d0e4ec4e7637102bf80ac Mon Sep 17 00:00:00 2001 From: Gijs Schoonderbeek <schoonderbeek@astron.nl> Date: Fri, 8 Jan 2021 09:38:06 +0100 Subject: [PATCH] Tested Clock setting / reading on HW --- check_clk_status.py | 5 ++--- set_clk.py | 11 ++++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/check_clk_status.py b/check_clk_status.py index 8ecf8e3..82e15f9 100644 --- a/check_clk_status.py +++ b/check_clk_status.py @@ -23,7 +23,7 @@ if os.name =="posix": else: from I2C_serial import * -I2CBUSNR=1 +I2CBUSNR=3 sleep_time=0.05 READ_LOCK = True @@ -37,8 +37,7 @@ def Read_byte_PLL(reg_address, nof_bytes=1, ADDRESS=0x20 ): # # Read Byte from the ADC # - I2C_device = I2C(ADDRESS) - I2C_device.bus = I2CBUSNR + I2C_device = I2C(ADDRESS, BUSNR=I2CBUSNR) PLL_rw = 0x01 # 0 for write, 1 for read I2C_device.write_bytes(0x06, 0x2C) diff --git a/set_clk.py b/set_clk.py index dff5597..46aa02d 100644 --- a/set_clk.py +++ b/set_clk.py @@ -23,7 +23,7 @@ if os.name =="posix": else: from I2C_serial import * -I2CBUSNR=1 +I2CBUSNR=3 sleep_time=0.05 PWR_RST = False SET_PLL = True @@ -42,8 +42,7 @@ def Write_byte_PLL(reg_address, wr_data, ADDRESS=0x20): # # Write Byte to the ADC # - I2C_device = I2C(ADDRESS) - I2C_device.bus = I2CBUSNR + I2C_device = I2C(ADDRESS, BUSNR=I2CBUSNR) PLL_rw = 0x00 # 0 for write, 1 for read stri = "Write : 0x{0:{fill}2x} to Address : 0x{1:{fill}2x}".format(wr_data, reg_address, fill='0') print(stri) @@ -70,8 +69,7 @@ def Read_byte_PLL(reg_address, nof_bytes=1, ADDRESS=0x20 ): # # Read Byte from the ADC # - I2C_device = I2C(ADDRESS) - I2C_device.bus = I2CBUSNR + I2C_device = I2C(ADDRESS, BUSNR=I2CBUSNR) PLL_rw = 0x01 # 0 for write, 1 for read I2C_device.write_bytes(0x06, 0x2C) @@ -107,8 +105,7 @@ def Read_byte_PLL(reg_address, nof_bytes=1, ADDRESS=0x20 ): def power(state): ADDRESS_IO = 0x20 - I2C_IO_device = I2C(ADDRESS_IO) - I2C_device.bus = I2CBUSNR + I2C_IO_device = I2C(ADDRESS_IO, BUSNR=I2CBUSNR) I2C_IO_device.write_bytes(0x06, 0x2C) I2C_IO_device.write_bytes(0x07, 00) if state: -- GitLab