From 10c56cd5cd7301805e55505e4ab031dc25cef573 Mon Sep 17 00:00:00 2001 From: kruger <kruger@astron.nl> Date: Wed, 9 Jun 2021 12:43:40 +0100 Subject: [PATCH] HBAT PPS bug fixes --- i2cserv/hba1.py | 6 +++--- scripts/SetHBAT_BFs.py | 2 +- scripts/SetHBAT_PPS.py | 6 +++--- scripts/SetHBAT_timeout.py | 22 ++++++++++++++++++++++ scripts/test_common.py | 12 ++++++++++-- 5 files changed, 39 insertions(+), 9 deletions(-) create mode 100644 scripts/SetHBAT_timeout.py diff --git a/i2cserv/hba1.py b/i2cserv/hba1.py index bca60ab..a0d1e2b 100644 --- a/i2cserv/hba1.py +++ b/i2cserv/hba1.py @@ -31,14 +31,14 @@ class hba1(hwdev): #Wait for PPS if required else wait a bit if var1.get('wait')=="PPS": channel=GPIO.wait_for_edge(self.pin,GPIO.RISING,timeout=1500) - self.conf['parentcls'].i2csetget(self.addr,[],self.reg,0) + self.conf['parentcls'].i2csetget(self.addr,[self.reg]) if channel is None: logging.info("PPS not received!"); - sleep(0.5) + sleep(0.6) # return False; elif var1.get('wait'): logging.debug("Wait %i ms",var1.get('wait')) - sleep(var1['wait']/100.) + sleep(var1['wait']/1000.) data,mask2=self.conf['parentcls'].GetVarValueMask(var1,mask) Data=OPCUAset(varid,InstType.varSet,data.copy(),mask2.copy()) return [Data] diff --git a/scripts/SetHBAT_BFs.py b/scripts/SetHBAT_BFs.py index 425cd6b..1d1a9e1 100644 --- a/scripts/SetHBAT_BFs.py +++ b/scripts/SetHBAT_BFs.py @@ -27,7 +27,7 @@ for cnt,NewVal in enumerate(NewValues): if DEBUG: print("set:") for x in range(3): print(val[i+x*32:i+(x+1)*32]) - time.sleep(0.4) + time.sleep(0.5) wait_not_busy("RCU_translator_busy_R",timeout_sec=2) # time.sleep(0.1) val=get_value(name+"_R") diff --git a/scripts/SetHBAT_PPS.py b/scripts/SetHBAT_PPS.py index 2660fc2..5eddbda 100644 --- a/scripts/SetHBAT_PPS.py +++ b/scripts/SetHBAT_PPS.py @@ -8,15 +8,15 @@ import numpy as np setRCUmask(RCU) -val=get_value(name+"_R") +val=get_debug_value(name+"_R") print("old:",val) for r in RCU: val[r]=NewVal -set_value(name+"_RW",val) +set_debug_value(name+"_RW",val) print("set:",val) time.sleep(0.1) -val=get_value(name+"_R") +val=get_debug_value(name+"_R") print("new:",val) disconnect() diff --git a/scripts/SetHBAT_timeout.py b/scripts/SetHBAT_timeout.py new file mode 100644 index 0000000..d214762 --- /dev/null +++ b/scripts/SetHBAT_timeout.py @@ -0,0 +1,22 @@ +RCU=[0] +name="HBA_uC_Timeout_RXTX" +NewVal=1536 + +from test_common import * +import numpy as np + +setRCUmask(RCU) + + +val=get_debug_value(name+"_R") +print("old:",val) +for r in RCU: + val[r]=NewVal + +set_debug_value(name+"_RW",val) +print("set:",val) +time.sleep(0.1) +val=get_debug_value(name+"_R") +print("new:",val) + +disconnect() diff --git a/scripts/test_common.py b/scripts/test_common.py index 97c3816..4ea708f 100644 --- a/scripts/test_common.py +++ b/scripts/test_common.py @@ -1,5 +1,5 @@ -#Address="opc.tcp://odroidRCU2:4842/" -Address="opc.tcp://LTSpi.astron.nl:4842/" +Address="opc.tcp://localhost:4842/" +#Address="opc.tcp://LTSpi.astron.nl:4842/" import sys sys.path.insert(0, "..") import logging @@ -33,6 +33,14 @@ def set_value(name,value): var1 = root.get_child(["0:Objects", "2:PCC", "2:"+name]) var1.set_value(value) +def get_debug_value(name): + var1 = root.get_child(["0:Objects", "2:PCC", "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.set_value(value) + def setRCUmask(rcu=[]): name="RCU_mask_RW" M=get_value(name) -- GitLab