Skip to content
Snippets Groups Projects

Modified the scripts to run on Raspberry Pi.

1 file
+ 38
19
Compare changes
  • Side-by-side
  • Inline
+ 38
19
@@ -59,24 +59,44 @@ def front_led(value=0xFF):
@@ -59,24 +59,44 @@ def front_led(value=0xFF):
sleep(0.2)
sleep(0.2)
front.write_bytes(0x01, 0xf)
front.write_bytes(0x01, 0xf)
def read_pol(i2c_addr):
def read_pol(node_nr, i2c_addr):
LOC_PWR = I2C(i2c_addr)
main_switch = I2C(0x71)
LOC_PWR.bus = I2CBUSNR
main_switch.bus = I2CBUSNR
ret_ack, ret_value = LOC_PWR.read_bytes(0)
ret_ack = main_switch.write_bytes(0x0, 0x01<<node_nr) #select Node
if ret_ack < 1:
if ret_ack < 1:
print("no device found")
print("Main I2C switch not found")
else:
else:
pr_stri = "Found device at address 0x{:02x}".format(LOC_PWR.I2C_Address)
node_switch = I2C(0x72)
print(pr_stri)
node_switch.bus = I2CBUSNR
ret_ack,ret_value = LOC_PWR.read_bytes(LP_VOUT, 2)
ret_ack = node_switch.write_bytes(0x0, 0x20) #select DDR4
vout = calc_lin_3bytes(ret_value, vout_mod)
if ret_ack < 1:
print("read = ", vout_mod)
print("Node I2C switch not found")
ret_ack,ret_value = LOC_PWR.read_bytes(LP_IOUT, 2)
else:
iout = calc_lin_2bytes(ret_value)
LOC_PWR = I2C(i2c_addr)
print("Output Current :",iout)
LOC_PWR.bus = I2CBUSNR
ret_ack,ret_value = LOC_PWR.read_bytes(LP_temp, 2)
ret_ack, ret_value = LOC_PWR.read_bytes(0)
temp = calc_lin_2bytes(ret_value)
if ret_ack < 1:
print("temperature :",temp)
print("no device found")
 
else:
 
# pr_stri = "Found device at address 0x{:02x}".format(LOC_PWR.I2C_Address)
 
# print(pr_stri)
 
ret_ack, vout_mod = LOC_PWR.read_bytes(LP_VOUT, 2)
 
# vout_mod = int(vout_mod,16)
 
# vout = calc_lin_3bytes(ret_value, vout_mod)
 
ret_ack,raw_value = LOC_PWR.read_bytes(LP_IOUT, 2)
 
ret_value=[]
 
ret_value.append(int(raw_value[:2],16))
 
ret_value.append(int(raw_value[2:],16))
 
iout = calc_lin_2bytes(ret_value)
 
stri="Output Current :{0:2.2f} A".format(iout)
 
print(stri)
 
ret_ack,raw_value = LOC_PWR.read_bytes(LP_temp, 2)
 
ret_value=[]
 
ret_value.append(int(raw_value[:2],16))
 
ret_value.append(int(raw_value[2:],16))
 
temp = calc_lin_2bytes(ret_value)
 
stri="temperature :{0:2.2f} Deg C".format(temp)
 
print(stri)
def read_ddr(node_nr = 0, module=0):
def read_ddr(node_nr = 0, module=0):
main_switch = I2C(0x71)
main_switch = I2C(0x71)
@@ -140,10 +160,9 @@ def read_qsfp(node_nr = 0, module=0):
@@ -140,10 +160,9 @@ def read_qsfp(node_nr = 0, module=0):
stri = "Voltage QSFP in slot {0} node {1} is {2:3.2f} V".format(module, node_nr, Power_in_mod)
stri = "Voltage QSFP in slot {0} node {1} is {2:3.2f} V".format(module, node_nr, Power_in_mod)
print(stri)
print(stri)
if 0:
if 1:
rw_eeprom(0xCD)
rw_eeprom(0xCD)
front_led()
front_led()
else:
for node_cnt in range(4):
for node_cnt in range(4):
for module_cnt in range(2):
for module_cnt in range(2):
read_ddr(node_nr=node_cnt,module=module_cnt)
read_ddr(node_nr=node_cnt,module=module_cnt)
@@ -151,4 +170,4 @@ else:
@@ -151,4 +170,4 @@ else:
for qsfp_cnt in range(6):
for qsfp_cnt in range(6):
read_qsfp(node_nr = node_cnt, module=qsfp_cnt)
read_qsfp(node_nr = node_cnt, module=qsfp_cnt)
for node_cnt in range(4):
for node_cnt in range(4):
read_pol(LOC_POWER_CORE)
read_pol(node_cnt, LOC_POWER_CORE)
Loading