diff --git a/pypcc/config/RECVTR_HB.yaml b/pypcc/config/RECVTR_HB.yaml index db10e0c9555b2ae5e1e136713453e87ec4abf6b2..afc65b0a34e7a3acbab00a2bd03c053945325068 100644 --- a/pypcc/config/RECVTR_HB.yaml +++ b/pypcc/config/RECVTR_HB.yaml @@ -549,18 +549,19 @@ variables: dtype: boolean dim: 96 dim2: [3,32] -# monitor: true + monitor: true read_parallel: true - name: RCU_ADC_sync driver: I2C_RCU devreg: [ADC1.SYNC_control,ADC2.SYNC_control,ADC3.SYNC_control] - width: 8 + width: 1 rw: ro - dtype: uint8 + dtype: boolean dim: 96 dim2: [3,32] - debug: true +# debug: true + read_parallel: true - name: RCU_ADC_JESD driver: I2C_RCU @@ -731,6 +732,7 @@ methods: - IO3.CONF1: Update - RCU_update: 0 - RCU_ADC_locked: Update #check if not also in RCU_update + - RCU_ADC_sync: Update #disabled for testing - RCU_DTH_on: Update #check if not also in RCU_update - RCU_IO4_GPIO1: Update #should be last, as it will fail for low-band - RCU_IO4_GPIO2: Update @@ -812,6 +814,7 @@ methods: # - IO3.GPIO2: 0x47 - RCU_DTH_on: Update #check dither while giving ADCs some time to lock - RCU_ADC_locked: Update #disabled for testing + - RCU_ADC_sync: Update #disabled for testing - name: RCU_update @@ -829,8 +832,6 @@ methods: - RCU_LED_green_on: Update - RCU_attenuator_dB: Update - RCU_band_select: Update -# - RCU_ADC_locked: Update #disabled for testing -# - RCU_ADC_sync: Update #disabled for testing # - RCU_DTH_shutdown: Update # - RCU_DTH_freq: Update # - RCU_DTH_on: Update #disabled for testing diff --git a/pypcc/config/RECVTR_LB.yaml b/pypcc/config/RECVTR_LB.yaml index 5f76893e840a8764ef8437e18663b26e903dd302..0450b4c706deec2d5cfe5a24498d2fbeaf388efa 100644 --- a/pypcc/config/RECVTR_LB.yaml +++ b/pypcc/config/RECVTR_LB.yaml @@ -522,12 +522,13 @@ variables: - name: RCU_ADC_sync driver: I2C_RCU devreg: [ADC1.SYNC_control,ADC2.SYNC_control,ADC3.SYNC_control] - width: 8 + width: 1 rw: ro - dtype: uint8 + dtype: boolean dim: 96 dim2: [3,32] - debug: true +# debug: true + read_parallel: true - name: RCU_ADC_JESD driver: I2C_RCU @@ -645,6 +646,7 @@ methods: - IO3.CONF1: Update - RCU_update: 0 - RCU_ADC_locked: Update #check if not also in RCU_update + - RCU_ADC_sync: Update #disabled for testing - RCU_DTH_on: Update #check if not also in RCU_update - name: RCU_on @@ -720,6 +722,7 @@ methods: - RCU_PWR_1V8: Update - RCU_PWR_2V5: Update - RCU_ADC_locked: Update #disabled for testing + - RCU_ADC_sync: Update #disabled for testing - name: RCU_update driver: I2C_RCU @@ -736,8 +739,6 @@ methods: - RCU_LED_green_on: Update - RCU_attenuator_dB: Update - RCU_band_select: Update -# - RCU_ADC_locked: Update #disabled for testing -# - RCU_ADC_sync: Update #disabled for testing # - RCU_DTH_shutdown: Update # - RCU_DTH_freq: Update # - RCU_DTH_on: Update #disabled for testing @@ -840,3 +841,15 @@ methods: # - DTH3.State : [0,0] # - RCU_DTH_on: Update + - name: RCU_DTH_restart #restart to update frequency + driver: I2C_RCU + mask: RCU_mask + debug: True + instructions: + - DTH1.Stop : [0,0] + - DTH2.Stop : [0,0] + - DTH3.Stop : [0,0] + - DTH1.Start : [0,1,0,0,1] + - DTH2.Start : [0,1,0,0,1] + - DTH3.Start : [0,1,0,0,1] + diff --git a/python_scripts/RCUH_I2C_test.py b/python_scripts/RCUH_I2C_test.py new file mode 100644 index 0000000000000000000000000000000000000000..9a63cd035b214bb744dbaeab3fcacf8bcdbabe90 --- /dev/null +++ b/python_scripts/RCUH_I2C_test.py @@ -0,0 +1,87 @@ +import RPi.GPIO as GPIO +from time import sleep +I2C_reset_pin=15 + +##NB translator should be off or monitor should be 0 +name='RECVTR_HB' #YAML config file with all register values etc +varID='RCU_PCB_ID' + +import logging +import argparse +from pypcc.opcuaserv import opcuaserv +from pypcc.opcuaserv import i2client +from pypcc.opcuaserv import yamlreader +#from opcuaserv import pypcc2 +from pypcc.i2cserv import i2cthread +import threading +import time +import sys +import signal +from pypcc.yamlconfig import Find; +import pypcc.yamlconfig as yc +from datetime import datetime + +testtime=datetime.now().strftime("%y-%m-%d %H:%M") + +logging.basicConfig(level="WARNING",format='%(asctime)s [%(levelname)-8s,%(filename)-20s:%(lineno)-3d] %(message)s') +#logging.basicConfig(level="DEBUG",format='%(asctime)s [%(levelname)-8s,%(filename)-20s:%(lineno)-3d] %(message)s') + + +GPIO.setmode(GPIO.BCM) + + + + +RunTimer=True; +conf=yc.yamlconfig(name) +conf.linkdevices() +conf.loaddrivers() +conf.linkdrivers() + + +GPIO.setup(I2C_reset_pin,GPIO.OUT) +#GPIO.output(I2C_reset_pin,0) +#sleep(0.5) +#GPIO.output(I2C_reset_pin,1) + +print("State=",GPIO.input(I2C_reset_pin)) + +def GetVal(name,RCUNR,N=1): + varid=conf.getvarid(name); +# print("varid",varid) + var1=conf.getvars()[varid] + dim=var1['dim'] + drv=var1.get('drivercls'); + mask=[False]*RCUNR*N+[True]*N+[False]*((dim-RCUNR-1)*N); + data=drv.OPCUAReadVariable(varid,var1,mask) + data=data[0].data + N3=len(data)//dim + return data[N3*RCUNR:N3*(RCUNR+1)],var1 + +for x in range(32): + GPIO.output(I2C_reset_pin,0) + sleep(0.01) + GPIO.output(I2C_reset_pin,1) + sleep(0.01) + data,var1=GetVal(varID,x); + if data[0] is None: + print(x,data[0]) + else: + ID=("%.2x%.2x%.2x%.2x" % (data[0],data[1],data[2],data[3])) + print(x,ID) +# print("I2C lines=",GPIO.input(2),GPIO.input(3)) + +if False: + GPIO.setup(2,GPIO.IN) + GPIO.setup(3,GPIO.IN) + print("I2C lines=",GPIO.input(2),GPIO.input(3)) + GPIO.setup(2,GPIO.OUT) + GPIO.setup(3,GPIO.OUT) + GPIO.output(2,0) + GPIO.output(3,0) + GPIO.output(2,1) + GPIO.output(3,1) + GPIO.setup(2,GPIO.IN) + GPIO.setup(3,GPIO.IN) + print("I2C lines=",GPIO.input(2),GPIO.input(3)) +GPIO.cleanup() \ No newline at end of file diff --git a/scripts/ADC_lock.py b/scripts/ADC_lock.py new file mode 100644 index 0000000000000000000000000000000000000000..2ae2a280d9d8d3913beeb1f3f62590f3d90bfb54 --- /dev/null +++ b/scripts/ADC_lock.py @@ -0,0 +1,12 @@ +from test_common import * +connect() + +locked=get_value("RCU_ADC_locked_R") +#print("locked:",att) + +synced=get_value("RCU_ADC_sync_R") +for x in range(96): + print(x,locked[x],synced[x]) +#print("sync:",att) + +disconnect() \ No newline at end of file