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

rb_unb2c.py tested on the hardware

parent 66168781
No related branches found
No related tags found
1 merge request!2Modified the scripts to run on Raspberry Pi.
...@@ -75,7 +75,9 @@ def read_pol(node_nr, i2c_addr): ...@@ -75,7 +75,9 @@ def read_pol(node_nr, i2c_addr):
if ret_ack < 1: if ret_ack < 1:
print("no device found") print("no device found")
else: else:
sleep(0.1)
ret_ack, vout_mod = LOC_PWR.read_bytes(LP_VOUT_MODE, 1) ret_ack, vout_mod = LOC_PWR.read_bytes(LP_VOUT_MODE, 1)
sleep(0.1)
ret_ack, raw_value = LOC_PWR.read_bytes(LP_VOUT, 2) ret_ack, raw_value = LOC_PWR.read_bytes(LP_VOUT, 2)
vout_mod = int(vout_mod,16) vout_mod = int(vout_mod,16)
ret_value = [] ret_value = []
...@@ -83,12 +85,14 @@ def read_pol(node_nr, i2c_addr): ...@@ -83,12 +85,14 @@ def read_pol(node_nr, i2c_addr):
ret_value.append(int(raw_value[2:], 16)) ret_value.append(int(raw_value[2:], 16))
vout = calc_lin_3bytes(ret_value, [vout_mod]) vout = calc_lin_3bytes(ret_value, [vout_mod])
stri = "Output voltage :{0: <5.2f} V ".format(vout) stri = "Output voltage :{0: <5.2f} V ".format(vout)
sleep(0.1)
ret_ack, raw_value = LOC_PWR.read_bytes(LP_IOUT, 2) ret_ack, raw_value = LOC_PWR.read_bytes(LP_IOUT, 2)
ret_value=[] ret_value=[]
ret_value.append(int(raw_value[:2],16)) ret_value.append(int(raw_value[:2],16))
ret_value.append(int(raw_value[2:],16)) ret_value.append(int(raw_value[2:],16))
iout = calc_lin_2bytes(ret_value) iout = calc_lin_2bytes(ret_value)
stri += "Output Current :{0: <5.2f} A ".format(iout) stri += "Output Current :{0: <5.2f} A ".format(iout)
sleep(0.1)
ret_ack,raw_value = LOC_PWR.read_bytes(LP_temp, 2) ret_ack,raw_value = LOC_PWR.read_bytes(LP_temp, 2)
ret_value=[] ret_value=[]
ret_value.append(int(raw_value[:2],16)) ret_value.append(int(raw_value[:2],16))
...@@ -160,7 +164,7 @@ def read_qsfp(node_nr = 0, module=0): ...@@ -160,7 +164,7 @@ 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 1: if 0:
rw_eeprom(0xCD) rw_eeprom(0xCD)
for color in list(LED_COLORS.keys()): for color in list(LED_COLORS.keys()):
print(color) print(color)
...@@ -171,7 +175,7 @@ if 1: ...@@ -171,7 +175,7 @@ if 1:
for node_cnt in range(4): for node_cnt in range(4):
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)
#else: else:
for node_cnt in range(4): for node_cnt in range(4):
read_pol(node_cnt, LOC_POWER_CORE) read_pol(node_cnt, LOC_POWER_CORE)
read_pol(-1,0x01) read_pol(-1,0x01)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment