Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Startup.py 1.60 KiB
from test_common import *

restart_clk=False;  #False do not restart, but only check status
restart_rcu=False;  #False do not restart, but only check status
RCUs=[0,1,2,3];
#RCUs=[0,1,2,3,4,5,6,7];

if restart_clk: 
  print("Startup CLK");  
  callmethod("CLK_off")
  wait_not_busy("CLK_translator_busy_R")
  callmethod("CLK_on")
  wait_not_busy("CLK_translator_busy_R",timeout_sec=2)

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_rcu: 
  print("Startup RCUs:",RCUs);  
  callmethod("RCU_off")
  wait_not_busy("RCU_translator_busy_R")
  callmethod("RCU_on")
  wait_not_busy("RCU_translator_busy_R",timeout_sec=5)

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();