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

Bug fix 160 MHz, small updates after testing

parent c612ca69
No related branches found
No related tags found
1 merge request!3Apsct production
......@@ -63,8 +63,10 @@ EEPROM = 0x50
#
# I2C switch addresses
#
i2c_switch_addr = [0x70, 0x71, 0x72, 0x73]
i2c_switch_addr_rcu = [0x70, 0x71, 0x72, 0x73]
i2c_bus_rcu = 1
i2c_switch_addr_unb = [0x70]
i2c_bus_unb = 3
#
# ID Pins
......
......@@ -43,8 +43,10 @@ class ApsctClass:
self.sensors = ApsctSensors()
self.pps = PpsClass()
self.i2cswitch = []
for addr in APSCT_I2C.i2c_switch_addr:
self.i2cswitch.append(I2cSwitch(address=addr))
for addr in APSCT_I2C.i2c_switch_addr_rcu:
self.i2cswitch.append(I2cSwitch(address=addr, bus=APSCT_I2C.i2c_bus_rcu))
for addr in APSCT_I2C.i2c_switch_addr_unb:
self.i2cswitch.append(I2cSwitch(address=addr, bus=APSCT_I2C.i2c_bus_unb))
self.apsct_id = ApsctId()
def read_IO_expanderis(self):
......@@ -206,7 +208,9 @@ class PllClass:
print(f"Setup PPL {self.frequency}")
self.dev_i2c_pll.write_bytes(0x07, 0x00)
if self.frequency == '160MHz':
self.dev_i2c_pll.write_bytes(0x03, 0x08)
i2c_address = APSCT_I2C.PLL_200M
dev_i2c_pll_sel = I2C(i2c_address, BUSNR=I2CBUSNR)
dev_i2c_pll_sel.write_bytes(0x03, 0x08)
else:
self.dev_i2c_pll.write_bytes(0x03, 0x28)
self.Write_byte_PLL(0x03, 0x0C)
......@@ -261,6 +265,7 @@ class PllClass:
stri = f"PLL {self.frequency} Not locked --> PLL Error"
if PRINT_ON:
print(stri)
return self.lock
def read_lol(self):
#
......@@ -504,16 +509,17 @@ class I2cSwitch:
#
# Class to check a I2C-switch
#
def __init__(self, address=0x70):
def __init__(self, address=0x70, bus=1):
#
# Whats needed to measure the toggle on GPIO24
#
self.address = address
self.bus = bus
self.dev_i2c_switch = I2C(address)
self.dev_i2c_switch.bus_nr = 1
self.dev_i2c_switch.bus_nr = bus
def check_switch(self, data=0xa5):
print(f"Check I2C switch at 0x{self.address:x}", end=' ')
print(f"Check I2C switch at 0x{self.address:x} bus {self.bus}", end=' ')
ret_ack, ret_value = self.dev_i2c_switch.read_bytes(0)
if ret_ack < 1:
print("I2C-Switch not found")
......
......@@ -34,9 +34,9 @@ for mode in modi:
apsct.frequency = mode
apsct.set_apsct()
if mode == "200MHz":
apsct.pll_200.read_lock()
state = state & apsct.pll_200.read_lock()
if mode == "160MHz":
apsct.pll_160.read_lock()
state = state & apsct.pll_160.read_lock()
apsct.frequency = "200MHz"
apsct.set_apsct()
......@@ -57,3 +57,5 @@ if state:
rw_ok = apsct.eeprom.wr_rd_eeprom(serial, address=0x20)
if not rw_ok:
print("EEPROM Error")
else:
print("\n >>> Errors during testing <<<\n")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment