diff --git a/scripts/CLK_reset.py b/scripts/CLK_reset.py new file mode 100644 index 0000000000000000000000000000000000000000..36c1cdb5107000e50f42361625dc1674c71f9cf2 --- /dev/null +++ b/scripts/CLK_reset.py @@ -0,0 +1,16 @@ +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(); diff --git a/scripts/RCUupdate.py b/scripts/RCUupdate.py index 3d9d5857a37a76a1f32c3853d5732dcc1456518a..6182e25724fdc5bbfdc5356fc6d1452b795cc162 100644 --- a/scripts/RCUupdate.py +++ b/scripts/RCUupdate.py @@ -1,10 +1,11 @@ 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 diff --git a/scripts/Startup.py b/scripts/Startup.py new file mode 100644 index 0000000000000000000000000000000000000000..94abb5141b6007c42e25ce8b158819b61139c962 --- /dev/null +++ b/scripts/Startup.py @@ -0,0 +1,47 @@ +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(); diff --git a/scripts/test_common.py b/scripts/test_common.py index 6df8d703b8cf7868d60474dffd610dad8406eb1e..fc1aa73bdce275fddac9b87be8d3b8189aa551d0 100644 --- a/scripts/test_common.py +++ b/scripts/test_common.py @@ -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