Skip to content
Snippets Groups Projects
Commit 729bff3f authored by Paulus Kruger's avatar Paulus Kruger
Browse files

Startup script added

parent 446fbcf9
Branches
Tags
No related merge requests found
from test_common import *
#callmethod("CLK_off")
#time.sleep(3)
#callmethod("CLK_on")
#time.sleep(3)
callmethod("CLK_PLL_reset")
#exit()
#time.sleep(1)
#callmethod("CLK_update")
#callmethod("RCU_on")
#time.sleep(1)
#callmethod("ADC_on")
disconnect();
from test_common import *
RCUs=[3];
RCUs=[0,1,2,3];
setRCUmask(RCUs)
#for RCU in RCUs:
setAntmask(RCUs,[True,True,True])
callmethod("RCU_update")
#callmethod("CLK_update")
disconnect();
\ No newline at end of file
from test_common import *
RCUs=[0,1,2,3,4,5,6,7];
restart=False; #False do not restart, but only check status
if restart: print("Startup CLK");
if restart: callmethod("CLK_off")
wait_not_busy("CLK_translator_busy_R")
if restart: callmethod("CLK_on")
wait_not_busy("CLK_translator_busy_R")
print("CLK status:")
locked=get_value("CLK_PLL_locked_R")
if locked:
print(" CLK working (locked)")
else: #not locked:
i2c_status=get_value("CLK_I2C_STATUS_R");
if (i2c_status>0): print(" CLK I2C not working. Maybe power cycle subrack to restart CLK board and translator.")
else: print (" CLK not locked! Subrack probably do not receive clock input (or CLK PCB broken)")
setRCUmask(RCUs)
if restart: print("Startup RCUs:",RCUs);
if restart: callmethod("RCU_off")
wait_not_busy("RCU_translator_busy_R")
if restart: callmethod("RCU_on")
wait_not_busy("RCU_translator_busy_R")
print("RCU status:")
i2c_status=get_value("RCU_I2C_STATUS_R")
i2c_working=[];i2c_not_working=[]
for x in RCUs: (i2c_working.append(x) if i2c_status[x]==0 else i2c_not_working.append(x))
if len(i2c_not_working)>0:
print(" RCUs not availabel",i2c_not_working)
locked=get_value("RCU_ADC_lock_R")
locklist=[];notlocklist=[]
for x in i2c_working:
if (locked[x*3+0]>0) and (locked[x*3+1]>0) and (locked[x*3+2]>0):
locklist.append(x)
else: notlocklist.append(x)
# (locklist.append(x) if locked[x]>0 else notlocklist.append(x))
print(" RCUs working",locklist)
if len(notlocklist)>0:
print(" RCUs with unlocked ADCs:",notlocklist)
disconnect();
......@@ -36,24 +36,24 @@ def set_value(name,value):
def setRCUmask(rcu=[]):
name="RCU_mask_RW"
M=get_value(name)
print(name," old:",M)
# print(name," old:",M)
M=[False for m in M]
for r in rcu:
M[r]=True
set_value(name,M)
print(name," new:",get_value(name))
# print(name," new:",get_value(name))
def setAntmask(rcu=[],ant=[True,True,True]):
name="Ant_mask_RW"
M=get_value(name)
print(name," old:",M)
# print(name," old:",M)
for i,j in enumerate(M):
M[i]=False
for r in rcu:
for i in range(3):
M[r*3+i]=ant[i]
set_value(name,M)
print(name," new:",get_value(name))
# print(name," new:",get_value(name))
def callmethod(name):
try:
......@@ -62,3 +62,13 @@ def callmethod(name):
except:
# print("error")
return None
def wait_not_busy(var1,timeout_sec=2):
for x in range(int(timeout_sec*10)):
busy=get_value(var1)
if not(busy):
# print("Wait time=%f s" %(x/10))
return True
time.sleep(0.1)
print("Timeout waiting for translator:",var1)
return False
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment