diff --git a/SCTable.py b/SCTable.py new file mode 100644 index 0000000000000000000000000000000000000000..8ff3ee31445314ba59674cfaf1cfff3f1dbcc727 --- /dev/null +++ b/SCTable.py @@ -0,0 +1,68 @@ +import yamlconfig as yc +import sys +RW={'ro':'_R','rw':'_R/_RW','variable':'_RW'} +DT={'uint8':'numpy.int64 ', + 'uint32':'numpy.int64 ', + 'boolean':'numpy.bool_ ', + 'double':'numpy.float64', + 'string':'numpy.str '} +Y=yc.yamlconfig(sys.argv[1]) +sep='\t' +#Sort alphabetically +names=[(v['name']).upper() for v in Y.getvars()] +SI=sorted(range(len(names)), key=lambda k: names[k]) +print("Name"+sep+"Dimension"+sep+"Type"+sep+"R/W"+sep+"Mask"+sep+"Monitored"+sep+"Description") +for i0 in SI: + v=Y.getvar1(i0) +#for v in Y.getvars(): + if v.get("debug",False): continue; + rw=v.get("rw",'ro') +# print(rw) + if rw=='hidden': continue; + + dim=v.get('dim',1) + if dim>1: + dim2=v.get('dim2',None) + if not(dim2 is None): + dimS=', dims=(%i,%i)' % (dim2[0],dim2[1]) + else: + dimS=', dims=(%i,)' % dim + else: dimS='' + + if rw in ['rw','ro']: + name=v['name']+'_R' + S='%-20s' % name + name='"2:'+v['name']+'_R"' + S+=' = attribute_wrapper(comms_annotation=[%-25s],datatype=' % name + dt=str(v['dtype']) + S+=DT[dt]; + S+=dimS+")" + print(S) + + if rw in ['rw','variable']: + name=v['name']+'_RW' + S='%-20s' % name + name='"2:'+v['name']+'_RW"' + S+=' = attribute_wrapper(comms_annotation=[%-25s],datatype=' % name + dt=str(v['dtype']) + S+=DT[dt]; + S+=dimS+", access=AttrWriteType.READ_WRITE)" +# print(dt) +# S+=str(v['dtype'])+sep +# S+=RW[v['rw']]+sep +# S+=v.get('mask','')+sep +# S+=str(v.get('monitor',''))+sep +# S+=str(v.get('description',''))+sep + print(S) +print() +#print("Name"+sep+"Mask"+sep+"Description") +#for v in Y.conf['methods']:# +# if v.get("debug",False): continue; +# S=v['name']+sep +# S+=str(v['dim'])+sep +# S+=str(v['dtype'])+sep +# S+=RW[v['rw']]+sep +# S+=v.get('mask','')+sep +# S+=str(v.get('monitor',''))+sep +# S+=str(v.get('description',''))+sep +# print(S) diff --git a/VarTable.py b/VarTable.py index 6a16332451bdfad22128ad17189d4080c8522385..5d47950582dfd775e15392bb028cd6ed72832103 100644 --- a/VarTable.py +++ b/VarTable.py @@ -3,23 +3,23 @@ import sys RW={'ro':'_R','rw':'_R/_RW','variable':'_RW'} Y=yc.yamlconfig(sys.argv[1]) -sep='\t' +sep=',' #Sort alphabetically names=[(v['name']).upper() for v in Y.getvars()] SI=sorted(range(len(names)), key=lambda k: names[k]) -print("Name"+sep+"Dimension"+sep+"Type"+sep+"R/W"+sep+"Mask"+sep+"Monitored"+sep+"Description") +print("Name "+sep+" Dim"+sep+"Type "+sep+"R/W "+sep+"Mask "+sep+"Mon "+sep+"Description") for i0 in SI: v=Y.getvar1(i0) #for v in Y.getvars(): if v.get("debug",False): continue; if v.get("rw",False)=='hidden': continue; - S=v['name']+sep - S+=str(v.get('dim',1))+sep - S+=str(v['dtype'])+sep - S+=RW[v['rw']]+sep - S+=v.get('mask','')+sep - S+=str(v.get('monitor',''))+sep - S+=str(v.get('description',''))+sep + S=('%-22s' % v['name'])+sep + S+=('%4i' % (v.get('dim',1)))+sep + S+=('%-7s' % str(v['dtype']))+sep + S+=('%-6s' % RW[v['rw']])+sep + S+=('%-13s' % v.get('mask',''))+sep + S+=('%-4s' % str(v.get('monitor','')))+sep + S+=str(v.get('description','')) print(S) print() print("Name"+sep+"Mask"+sep+"Description") diff --git a/config/APSCTTR.yaml b/config/APSCTTR.yaml index ba512516020635d5658becf62fff2f7262ffb8ec..3c0d6cd91581f84968c3c547cab0a629fa883426 100644 --- a/config/APSCTTR.yaml +++ b/config/APSCTTR.yaml @@ -124,7 +124,7 @@ variables: dtype: string - - name: [APSCT_PLL_200MHz_PWR_on,APSCT_PLL_160MHz_PWR_on] + - name: [APSCT_PWR_PLL_200MHz_on,APSCT_PWR_PLL_160MHz_on] description: CLK power status. True=ON. Controlled by APSCT_ON and APSCT_OFF rw: ro dtype: boolean @@ -142,7 +142,7 @@ variables: bitoffset: 3 width: 1 - - name: APSCT_ignore_PPS + - name: APSCT_PPS_ignore rw: rw dtype: boolean driver: I2C_CLK @@ -150,7 +150,7 @@ variables: bitoffset: 2 width: 1 - - name: [APSCT_MON_10MHz_good,APSCT_MON_PPS_good] + - name: [APSCT_INPUT_10MHz_good,APSCT_INPUT_PPS_good] rw: ro dtype: boolean driver: I2C_CLK @@ -223,7 +223,7 @@ variables: dtype: double monitor: true - - name: [APSCT_3V3_INPUT,APSCT_3V3_PLL_160MHz,APSCT_3V3_PLL_200MHz,APSCT_3V3_CLKDIST_A,APSCT_3V3_CLKDIST_B,APSCT_3V3_PPSDIST,APSCT_3V3_CTRL] + - name: [APSCT_PWR_INPUT_3V3,APSCT_PWR_PLL_160MHz_3V3,APSCT_PWR_PLL_200MHz_3V3,APSCT_PWR_CLKDIST1_3V3,APSCT_PWR_CLKDIST2_3V3,APSCT_PWR_PPSDIST_3V3,APSCT_PWR_CTRL_3V3] driver: I2C_CLK devreg: [VSENSE.V_0,VSENSE.V_1,VSENSE.V_2,VSENSE.V_3,VSENSE.V_4,VSENSE.V_5,VSENSE.V_6] width: 23 @@ -250,13 +250,13 @@ methods: - IO2.CONF1: Update - IO2.CONF2: Update - APSCT_PWR_on: Update - - APSCT_PLL_200MHz_PWR_on: Update + - APSCT_PWR_PLL_200MHz_on: Update - APSCT_PLL_200MHz_locked: Update - APSCT_PLL_200MHz_error: Update - - APSCT_PLL_160MHz_PWR_on: Update + - APSCT_PWR_PLL_160MHz_on: Update - APSCT_PLL_160MHz_locked: Update - APSCT_PLL_160MHz_error: Update - - APSCT_ignore_PPS : Update + - APSCT_PPS_ignore : Update - name: APSCT_on diff --git a/config/APSPUTR.yaml b/config/APSPUTR.yaml index d65913ff17dd07a2aa55fe93423e67cef2fb08a8..25d5f3b181bd79a27c67fbb83ed29b16e1e0e42b 100644 --- a/config/APSPUTR.yaml +++ b/config/APSPUTR.yaml @@ -95,7 +95,7 @@ variables: scale: smbus_2bytes_to_float monitor: true - - name: [APSPU_FAN_period1,APSPU_FAN_period2,APSPU_FAN_period3] + - name: [APSPU_FAN1_RMS,APSPU_FAN2_RMS,APSPU_FAN3_RMS] driver: I2C_PU devreg: [MAX.TACH1,MAX.TACH2,MAX.TACH3] bitoffset: 5 diff --git a/config/RECVTR.yaml b/config/RECVTR.yaml index 97a698461ad42c861c1623b981ee67923069003d..ed805dd95098fa59c95ca8d974866e04d7fbbfd1 100644 --- a/config/RECVTR.yaml +++ b/config/RECVTR.yaml @@ -9,7 +9,7 @@ drivers: - name: I2C_RCU type: i2c_array #An array of similar devices connected to an I2C switch parent: I2C1 - parameters: [0,31,14] #start,number of RCUs, error count to disable I2C + parameters: [0,31,5] #start,number of RCUs, error count to disable I2C (14 for LTS?) status: RCU_I2C_error - name: I2C_HBAT type: hba1 #Special driver to manage HBAT1s. @@ -212,6 +212,7 @@ variables: rw: variable #server RW variable, not linked to IO dtype: boolean dim: 96 + dim2: [3,32] - name: RCU_mask description: Only masked RCUs are updated @@ -241,7 +242,7 @@ variables: dtype: boolean dim: 1 - - name: RCU_attenuator + - name: RCU_attenuator_dB description: RCU Attenuation (dB) driver: I2C_RCU devreg: [IO1.GPIO1,IO1.GPIO2,IO2.GPIO1] @@ -250,9 +251,10 @@ variables: rw: rw dtype: uint8 dim: 96 + dim2: [3,32] mask: RCU_ANT_mask - - name: RCU_band + - name: RCU_band_select description: Band select 1=10MHz,2=30MHz driver: I2C_RCU devreg: [IO2.GPIO2,IO2.GPIO2,IO2.GPIO2] @@ -261,6 +263,7 @@ variables: rw: rw dtype: uint8 dim: 96 + dim2: [3,32] mask: RCU_ANT_mask - name: [RCU_IO1_GPIO1,RCU_IO1_GPIO2,RCU_IO2_GPIO1,RCU_IO2_GPIO2,RCU_IO3_GPIO1,RCU_IO3_GPIO2] @@ -273,7 +276,7 @@ variables: mask: RCU_mask debug: True - - name: RCU_LED0 + - name: RCU_LED0_off driver: I2C_RCU description: LED 1 devreg: IO2.GPIO2 @@ -284,7 +287,7 @@ variables: dim: 32 mask: RCU_mask - - name: RCU_LED1 + - name: RCU_LED1_off driver: I2C_RCU description: LED 2 devreg: IO2.GPIO2 @@ -307,7 +310,7 @@ variables: monitor: true mask: RCU_I2C_error - - name: RCU_3V3 + - name: RCU_PWR_3V3 description: RCU 3.3V voltage (V) driver: I2C_RCU devreg: AN.V_3v3 @@ -319,7 +322,7 @@ variables: monitor: true mask: RCU_I2C_error - - name: RCU_1V8 + - name: RCU_PWR_1V8 description: RCU 1.8V voltage (V) driver: I2C_RCU devreg: AN.V_1v8 @@ -331,7 +334,7 @@ variables: monitor: true mask: RCU_I2C_error - - name: RCU_2V5 + - name: RCU_PWR_2V5 description: RCU 2.5V voltage (V) driver: I2C_RCU devreg: AN.V_2v5 @@ -352,6 +355,7 @@ variables: rw: ro dtype: double dim: 96 + dim2: [3,32] monitor: true mask: RCU_I2C_error @@ -364,6 +368,7 @@ variables: rw: ro dtype: double dim: 96 + dim2: [3,32] monitor: true mask: RCU_I2C_error @@ -376,10 +381,11 @@ variables: rw: ro dtype: double dim: 96 + dim2: [3,32] monitor: true mask: RCU_I2C_error - - name: RCU_PWR_DIGITAL_ON + - name: RCU_PWR_DIGITAL_on description: RCU digital power enable. Controlled by calling RCU_on/RCU_off driver: I2C_RCU devreg: IO2.GPIO1 @@ -390,7 +396,7 @@ variables: dim: 32 mask: RCU_mask - - name: RCU_PWR_GOOD + - name: RCU_PWR_good description: Status of RCU power given by LDOs. driver: I2C_RCU devreg: IO2.GPIO1 @@ -402,7 +408,7 @@ variables: monitor: true mask: RCU_I2C_error - - name: RCU_PWR_ANALOG_ON + - name: RCU_PWR_ANALOG_on description: RCU analog power enable. Controlled by RCU_on/off driver: I2C_RCU devreg: IO1.GPIO2 @@ -413,7 +419,7 @@ variables: dim: 32 mask: RCU_mask - - name: RCU_DTH_SHUTDOWN + - name: RCU_DTH_shutdown description: False means dither source powered on. Controlled by TBD driver: I2C_RCU devreg: [IO3.GPIO1,IO3.GPIO1,IO3.GPIO2] @@ -422,9 +428,10 @@ variables: rw: ro dtype: boolean dim: 96 + dim2: [3,32] mask: RCU_ANT_mask - - name: RCU_ANT_PWR_ON + - name: RCU_ANT_PWR_on description: Antenna power output ON/OFF control. Monitored by Ant_V. driver: I2C_RCU devreg: [IO1.GPIO1,IO1.GPIO1,IO1.GPIO2] @@ -433,6 +440,7 @@ variables: rw: rw dtype: boolean dim: 96 + dim2: [3,32] mask: RCU_ANT_mask - name: HBAT_beamformer_delays @@ -444,6 +452,7 @@ variables: rw: rw dtype: uint8 dim: 3072 + dim2: [32,96] mask: RCU_ANT_mask wait: 100 #ms @@ -456,6 +465,7 @@ variables: rw: rw dtype: boolean dim: 3072 + dim2: [32,96] mask: RCU_ANT_mask wait: 100 #ms @@ -483,10 +493,11 @@ variables: description: RCU ADC lock status, 0x81=locked driver: I2C_RCU devreg: [ADC1.PLL_stat,ADC2.PLL_stat,ADC3.PLL_stat] - width: 8 + width: 1 rw: ro - dtype: uint8 + dtype: boolean dim: 96 + dim2: [3,32] monitor: true - name: RCU_ADC_sync @@ -496,6 +507,7 @@ variables: rw: ro dtype: uint8 dim: 96 + dim2: [3,32] debug: true - name: RCU_ADC_JESD @@ -505,6 +517,7 @@ variables: rw: ro dtype: uint8 dim: 96 + dim2: [3,32] debug: true - name: RCU_ADC_CML_level @@ -514,6 +527,7 @@ variables: rw: ro dtype: uint8 dim: 96 + dim2: [3,32] debug: true - name: RCU_DTH_freq @@ -524,6 +538,7 @@ variables: rw: rw dtype: uint32 dim: 96 + dim2: [3,32] mask: RCU_ANT_mask - name: RCU_DTH_tune @@ -533,6 +548,7 @@ variables: rw: rw dtype: uint32 dim: 96 + dim2: [3,32] mask: RCU_ANT_mask debug: true @@ -543,10 +559,11 @@ variables: rw: rw dtype: uint32 dim: 96 + dim2: [3,32] mask: RCU_ANT_mask debug: true - - name: RCU_DTH_ON + - name: RCU_DTH_on description: RCU Dither on. Controlled by RCU_DTH_on/off driver: I2C_RCU devreg: [DTH1.State,DTH2.State,DTH3.State] @@ -555,6 +572,7 @@ variables: rw: ro dtype: boolean dim: 96 + dim2: [3,32] mask: RCU_ANT_mask - name: RCU_DTH_Rev @@ -564,6 +582,7 @@ variables: rw: rw dtype: uint32 dim: 96 + dim2: [3,32] mask: RCU_ANT_mask debug: true @@ -619,20 +638,20 @@ methods: mask: RCU_mask debug: True instructions: - - RCU_PWR_DIGITAL_ON: Update #Read value and update the OPC-UA variable - - RCU_PWR_ANALOG_ON: Update - - ANT_PWR_ON: Update + - RCU_PWR_DIGITAL_on: Update #Read value and update the OPC-UA variable + - RCU_PWR_ANALOG_on: Update + - ANT_PWR_on: Update - RCU_ID: Update - RCU_version: Update - - RCU_LED0: Update - - RCU_LED1: Update - - RCU_attenuator: Update - - RCU_band: Update - - RCU_ADC_lock: Update + - RCU_LED0_off: Update + - RCU_LED1_off: Update + - RCU_attenuator_dB: Update + - RCU_band_select: Update + - RCU_ADC_locked: Update - RCU_ADC_sync: Update - - RCU_DTH_SHUTDOWN: Update + - RCU_DTH_shutdown: Update - RCU_DTH_freq: Update - - RCU_DTH_ON: Update + - RCU_DTH_on: Update - name: ADC1_on driver: I2C_RCU @@ -670,8 +689,8 @@ methods: mask: RCU_mask instructions: - RCU_I2C_error: 0 - - RCU_PWR_ANALOG_ON: 0 #Switch power off - - RCU_PWR_DIGITAL_ON: 0 #Switch power off + - RCU_PWR_ANALOG_on: 0 #Switch power off + - RCU_PWR_DIGITAL_on: 0 #Switch power off - IO2.GPIO1: 0 - IO2.GPIO2: 0 - IO3.GPIO1: 0 @@ -697,28 +716,16 @@ methods: mask: RCU_mask # rw: hidden instructions: -# - RCU_DTH_SHUTDOWN : 0 - RCU_DTH_config : [0,0,0] -# - RCU_DTH_tune : [0,0,0,0,0,0] -# - DTH1.CONF : 0 -# - DTH1.Tune : [0,0] #no tuning -# - WAIT: 10 -# - DTH1.Start : [1,0,0,0,1,0x55] + - RCU_DTH_config: Update #debug + - DTH1.Tune : [0,0] #no tuning + - DTH2.Tune : [0,0] #no tuning + - DTH3.Tune : [0,0] #no tuning + - RCU_DTH_tune: Update #debug - DTH1.Start : [0,1,0,0,1] -# - DTH1.0x60: #PA_config... -# - DTH2.CONF : 0 -# - WAIT: 10 -# - DTH2.Tune : [0,0] #no tuning -# - WAIT: 10 - DTH2.Start : [0,1,0,0,1] -# - DTH3.CONF : 0 -# - WAIT: 10 -# - DTH3.Tune : [0,0] #no tuning -# - WAIT: 10 - DTH3.Start : [0,1,0,0,1] - - RCU_DTH_ON : Update - - RCU_DTH_config: Update #debug - - RCU_DTH_tune: Update #debug + - RCU_DTH_on : Update - name: RCU_DTH_off description: Switch dither source off @@ -736,4 +743,4 @@ methods: # - DTH1.State : [0,0] # - DTH2.State : [0,0] # - DTH3.State : [0,0] - - RCU_DTH_ON: Update + - RCU_DTH_on: Update diff --git a/log/RCU2L007ff943.log b/log/RCU2L007ff943.log index bfa1fec65dd3402265477a95d55d9c68c80d7751..9204a11624dfc0aeeba3c85125693b0a9451b9dc 100644 --- a/log/RCU2L007ff943.log +++ b/log/RCU2L007ff943.log @@ -1,35 +1,12 @@ ID=007ff943 -Time=2021-05-19 03:51 -RCU Temperature=333.028 K +Time=2021-05-19 06:39 +RCU Temperature=333.297 K 3V3 =3.343 V +Switch RCU Power off Switch RCU Power on Check IO expander 1&2 Check voltages - 1V8 =1.790 V - 2V5 =2.546 V - Vant_in=8.01 7.96 8.05 -Switch Antenna power on - Vant_out=7.96 7.98 7.98 - Iant_out=0.02 0.01 0.02 -Test ADC read - Check IO expander 3 - ADC JESD (0x14)=14 14 14 -Test ADC write - ADC sync (0x1)=1 1 1 -Test DITHER communication - Set frequency 150MHz - Readback frequency 150000000.000000 - Readback frequency 150000000.000000 - Readback frequency 150000000.000000 -** PASSED Power and Control test ** -ID=007ff943 -Time=2021-05-19 03:52 -RCU Temperature=333.028 K -3V3 =3.343 V -Switch RCU Power on - Check IO expander 1&2 -Check voltages - 1V8 =1.790 V + 1V8 =1.789 V 2V5 =2.545 V Vant_in=8.01 7.96 8.05 Switch Antenna power on @@ -38,11 +15,14 @@ Switch Antenna power on Test ADC read Check IO expander 3 ADC JESD (0x14)=14 14 14 -Test ADC write +Test ADC write & ADC lock ADC sync (0x1)=1 1 1 + ADC locked (0x1)=1 1 1 Test DITHER communication - Set frequency 150MHz - Readback frequency 150000000.000000 - Readback frequency 150000000.000000 - Readback frequency 150000000.000000 + Set frequency 102200000.000000 + Readback frequency 102200000.000000 + Readback frequency 102200000.000000 + Readback frequency 102200000.000000 +Test DITHER on + DTH on (0x1)=1 1 1 ** PASSED Power and Control test ** diff --git a/log/RCU2L00807fc6.log b/log/RCU2L00807fc6.log index 7443674ae3abf42e6c3e3ce64a382680e1125ee4..34959883a9ee85a64f76a6aa543a19e4dcd96350 100644 --- a/log/RCU2L00807fc6.log +++ b/log/RCU2L00807fc6.log @@ -1,12 +1,13 @@ ID=00807fc6 -Time=2021-05-19 03:53 -RCU Temperature=335.992 K +Time=2021-05-19 06:39 +RCU Temperature=336.261 K 3V3 =3.345 V +Switch RCU Power off Switch RCU Power on Check IO expander 1&2 Check voltages - 1V8 =1.786 V - 2V5 =2.546 V + 1V8 =1.785 V + 2V5 =2.544 V Vant_in=7.98 7.96 8.00 Switch Antenna power on Vant_out=7.98 7.94 7.95 @@ -14,11 +15,14 @@ Switch Antenna power on Test ADC read Check IO expander 3 ADC JESD (0x14)=14 14 14 -Test ADC write +Test ADC write & ADC lock ADC sync (0x1)=1 1 1 + ADC locked (0x1)=1 1 1 Test DITHER communication - Set frequency 150MHz - Readback frequency 150000000.000000 - Readback frequency 150000000.000000 - Readback frequency 150000000.000000 + Set frequency 102200000.000000 + Readback frequency 102200000.000000 + Readback frequency 102200000.000000 + Readback frequency 102200000.000000 +Test DITHER on + DTH on (0x1)=1 1 1 ** PASSED Power and Control test ** diff --git a/scripts/ADCreset.py b/scripts/ADCreset.py index c41cd638ae2783fca6663914e9f6d1ac5018c45d..81d4d2fd4b347d36efe64f6f5db8bab8199ece45 100644 --- a/scripts/ADCreset.py +++ b/scripts/ADCreset.py @@ -1,9 +1,9 @@ from test_common import * -RCUs=[3]; +RCUs=[1,3]; setRCUmask(RCUs) -def wait(var1="RCU_translator_busy_R"): +def wait(var1="RECVTR_translator_busy_R"): for x in range(20): busy=get_value(var1) # print(busy) @@ -15,7 +15,7 @@ callmethod("RCU_off") wait() #exit() time.sleep(2) -callmethod("RCU_on") +#callmethod("RCU_on") wait() #callmethod("RCU_on") #time.sleep(1) diff --git a/scripts/DTH_test.py b/scripts/DTH_test.py index 0655d8c9d8ee0453dd07408829988ebcb95e30be..0b6283a353dc9fe205c0adf0108a212ba043b00a 100644 --- a/scripts/DTH_test.py +++ b/scripts/DTH_test.py @@ -1,12 +1,12 @@ from test_common import * -RCU=4; +RCU=1; setAntmask([RCU]) setRCUmask([RCU]) #call_debug_method("DTH_off") -if True: +if False: name="RCU_DTH_freq" Freq=[102e6,102.101e6,102.2e6] # Freq=[102.2e6,102.1e6,102.0e6] @@ -19,7 +19,7 @@ if True: time.sleep(0.5) att=get_value(name+"_R") print("freq new :",att[3*RCU:3*RCU+3]) -call_debug_method("DTH_on") -#call_debug_method("DTH_off") +callmethod("RCU_DTH_on") +#callmethod("DTH_off") disconnect() \ No newline at end of file diff --git a/scripts/test_common.py b/scripts/test_common.py index 9ac38c327576be7018ce756c40afa0a2fd1c9c1a..9ac6379de5aac43c4b9d79ccc91e67735bd59660 100644 --- a/scripts/test_common.py +++ b/scripts/test_common.py @@ -1,4 +1,4 @@ -Address="opc.tcp://localhost:4842/" +Address="opc.tcp://localhost:4840/" #Address="opc.tcp://LTSpi.astron.nl:4842/" import sys sys.path.insert(0, "..") @@ -26,19 +26,19 @@ def disconnect(): client.disconnect() def get_value(name): - var1 = root.get_child(["0:Objects", "2:PCC", "2:"+name]) + var1 = root.get_child(["0:Objects", "2:"+name]) return var1.get_value() def set_value(name,value): - var1 = root.get_child(["0:Objects", "2:PCC", "2:"+name]) + var1 = root.get_child(["0:Objects", "2:"+name]) var1.set_value(value) def get_debug_value(name): - var1 = root.get_child(["0:Objects", "2:PCC", "2:DEBUG", "2:"+name]) + var1 = root.get_child(["0:Objects", "2:DEBUG", "2:"+name]) return var1.get_value() def set_debug_value(name,value): - var1 = root.get_child(["0:Objects", "2:PCC", "2:DEBUG", "2:"+name]) + var1 = root.get_child(["0:Objects", "2:DEBUG", "2:"+name]) var1.set_value(value) def setRCUmask(rcu=[]): @@ -52,7 +52,7 @@ def setRCUmask(rcu=[]): # print(name," new:",get_value(name)) def setAntmask(rcu=[],ant=[True,True,True]): - name="Ant_mask_RW" + name="RCU_ANT_mask_RW" M=get_value(name) # print(name," old:",M) for i,j in enumerate(M): @@ -65,14 +65,14 @@ def setAntmask(rcu=[],ant=[True,True,True]): def callmethod(name): try: - obj = root.get_child(["0:Objects", "2:PCC"])# + obj = root.get_child(["0:Objects"])# return obj.call_method("2:"+name) except: # print("error") return None def call_debug_method(name): try: - obj = root.get_child(["0:Objects", "2:PCC","2:DEBUG"])# + obj = root.get_child(["0:Objects","2:DEBUG"])# return obj.call_method("2:"+name) except: print("error") diff --git a/testRCUL.py b/testRCUL.py index 56f5eec2f38f2811d71c8ae3b4f446b03f4e0ce1..2f321e9a48eec6be37fb799a47b1a262724d6a54 100644 --- a/testRCUL.py +++ b/testRCUL.py @@ -27,7 +27,6 @@ conf.linkdevices() conf.loaddrivers() conf.linkdrivers() - def GetVal(name,N=1): varid=conf.getvarid(name); var1=conf.getvars()[varid] @@ -69,7 +68,7 @@ if True: logging.warning("RCU Temperature=%.3f K" % D) if not Check([D],290,350): exit(); - data,var1=GetVal('RCU_3V3'); + data,var1=GetVal('RCU_PWR_3V3'); D=((data[0]*256+data[1])*256+data[2])*var1.get('scale',1.) logging.warning("3V3 =%.3f V" % D) # print("3V3=",D,"V") @@ -89,17 +88,26 @@ def SetRegister(regname,value): elif drv2: drv2.Setdevreg(v1,value,mask) else: logging.warn("Driver not specified for instruction"+key) -logging.warning("Switch RCU Power on"); + + if True: + logging.warning("Switch RCU Power off"); SetRegister("IO1.GPIO1",[0]) - SetRegister("IO1.GPIO2",[0x80]) #Analog power on - SetRegister("IO2.GPIO1",[0x40]) #Digital power on + SetRegister("IO1.GPIO2",[0x0]) #Analog power off + SetRegister("IO2.GPIO1",[0x0]) #Digital power off SetRegister("IO2.GPIO2",[0]) SetRegister("IO1.CONF1",[0]) SetRegister("IO1.CONF2",[0]) SetRegister("IO2.CONF1",[0x80]) #Pgood on P07 SetRegister("IO2.CONF2",[0]) + time.sleep(0.5) + logging.warning("Switch RCU Power on"); + SetRegister("IO1.GPIO1",[0]) + SetRegister("IO1.GPIO2",[0x80]) #Analog power on + SetRegister("IO2.GPIO1",[0x40]) #Digital power on + SetRegister("IO2.GPIO2",[0]) + logging.warning(" Check IO expander 1&2"); # print("IO expander status:"); @@ -111,15 +119,16 @@ if True: if not Check(data,0xC0,0xC0): exit(); data,var=GetVal('RCU_IO2_GPIO2'); if not Check(data,0x0,0x0): exit(); + time.sleep(0.5) logging.warning("Check voltages") if True: - data,var1=GetVal('RCU_1V8'); + data,var1=GetVal('RCU_PWR_1V8'); D=((data[0]*256+data[1])*256+data[2])*var1.get('scale',1.) logging.warning(" 1V8 =%.3f V" % D) if not Check([D],1.7,1.9): exit(); - data,var1=GetVal('RCU_2V5'); + data,var1=GetVal('RCU_PWR_2V5'); D=((data[0]*256+data[1])*256+data[2])*var1.get('scale',1.) logging.warning(" 2V5 =%.3f V" % D) if not Check([D],2.4,2.6): exit(); @@ -168,17 +177,26 @@ if True: logging.warning(" ADC JESD (0x14)=%x %x %x" % (data[0],data[1],data[2])) if not Check(data,0x14,0x14): exit(); - logging.warning("Test ADC write") + logging.warning("Test ADC write & ADC lock") #Test writing ADC register SetRegister("ADC1.SYNC_control",[1]) + SetRegister("ADC1.CML_level",[7]); SetRegister("ADC1.Update",[1]) SetRegister("ADC2.SYNC_control",[1]) + SetRegister("ADC2.CML_level",[7]); SetRegister("ADC2.Update",[1]) SetRegister("ADC3.SYNC_control",[1]) + SetRegister("ADC3.CML_level",[7]); SetRegister("ADC3.Update",[1]) data,var=GetVal('RCU_ADC_sync'); logging.warning(" ADC sync (0x1)=%x %x %x" % (data[0],data[1],data[2])) if not Check(data,0x1,0x1): exit(); + + data,var=GetVal('RCU_ADC_locked'); + logging.warning(" ADC locked (0x1)=%x %x %x" % (data[0],data[1],data[2])) + if not Check(data,0x1,0x1): logging.error("*** FAILED ADC lock!") +# - RCU_ADC_locked: Update + #exit() #Need to update I2c bitbang.... if True: @@ -191,8 +209,9 @@ if True: # data,var=GetVal('RCU_IO3_GPIO1');print("IO3_1",hex(data[0])) # data,var=GetVal('RCU_IO3_GPIO2');print("IO3_2",hex(data[0])) - f=int(150e6) - logging.warning(" Set frequency 150MHz"); + f0=102.2e6; + f=int(f0) + logging.warning(" Set frequency %f"%f0); # print("Frequency set=",f) d=[0]*4; for i in range(4): @@ -202,7 +221,7 @@ if True: SetRegister("DTH2.Freq",d) #DTH_SDA=input SetRegister("DTH3.Freq",d) #DTH_SDA=input - f=int(150e6) + f=int(f0) data,var1=GetVal("RCU_DTH_freq") # data,var1=GetVal("RCU_DTH_Rev") for j in range(3): @@ -214,8 +233,25 @@ if True: if not Check([f2],f-1,f+1): exit(); # print([hex(h) for h in data[:30]]) + logging.warning("Test DITHER on") + SetRegister("DTH1.CONF",[0]) + SetRegister("DTH1.Tune",[0,0]) + SetRegister("DTH1.Start",[0,1,0,0,1]) + SetRegister("DTH2.CONF",[0]) + SetRegister("DTH2.Tune",[0,0]) + SetRegister("DTH2.Start",[0,1,0,0,1]) + SetRegister("DTH3.CONF",[0]) + SetRegister("DTH3.Tune",[0,0]) + SetRegister("DTH3.Start",[0,1,0,0,1]) + time.sleep(0.1) + data,var=GetVal('RCU_DTH_on'); + logging.warning(" DTH on (0x1)=%x %x %x" % (data[0],data[1],data[2])) + if not Check(data,0x1,0x1): logging.error("*** FAILED: Dither on! ***") + + logging.warning("** PASSED Power and Control test **"); + #print(data) #scale=float(scale) #data2=[(d*scale) for d in data2]