Skip to content
Snippets Groups Projects
Commit 047f605a authored by Paulus Kruger's avatar Paulus Kruger
Browse files

ADC sync added

parent 987aab57
No related branches found
No related tags found
No related merge requests found
Pipeline #51778 passed
...@@ -549,18 +549,19 @@ variables: ...@@ -549,18 +549,19 @@ variables:
dtype: boolean dtype: boolean
dim: 96 dim: 96
dim2: [3,32] dim2: [3,32]
# monitor: true monitor: true
read_parallel: true read_parallel: true
- name: RCU_ADC_sync - name: RCU_ADC_sync
driver: I2C_RCU driver: I2C_RCU
devreg: [ADC1.SYNC_control,ADC2.SYNC_control,ADC3.SYNC_control] devreg: [ADC1.SYNC_control,ADC2.SYNC_control,ADC3.SYNC_control]
width: 8 width: 1
rw: ro rw: ro
dtype: uint8 dtype: boolean
dim: 96 dim: 96
dim2: [3,32] dim2: [3,32]
debug: true # debug: true
read_parallel: true
- name: RCU_ADC_JESD - name: RCU_ADC_JESD
driver: I2C_RCU driver: I2C_RCU
...@@ -731,6 +732,7 @@ methods: ...@@ -731,6 +732,7 @@ methods:
- IO3.CONF1: Update - IO3.CONF1: Update
- RCU_update: 0 - RCU_update: 0
- RCU_ADC_locked: Update #check if not also in RCU_update - 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_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_GPIO1: Update #should be last, as it will fail for low-band
- RCU_IO4_GPIO2: Update - RCU_IO4_GPIO2: Update
...@@ -812,6 +814,7 @@ methods: ...@@ -812,6 +814,7 @@ methods:
# - IO3.GPIO2: 0x47 # - IO3.GPIO2: 0x47
- RCU_DTH_on: Update #check dither while giving ADCs some time to lock - RCU_DTH_on: Update #check dither while giving ADCs some time to lock
- RCU_ADC_locked: Update #disabled for testing - RCU_ADC_locked: Update #disabled for testing
- RCU_ADC_sync: Update #disabled for testing
- name: RCU_update - name: RCU_update
...@@ -829,8 +832,6 @@ methods: ...@@ -829,8 +832,6 @@ methods:
- RCU_LED_green_on: Update - RCU_LED_green_on: Update
- RCU_attenuator_dB: Update - RCU_attenuator_dB: Update
- RCU_band_select: 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_shutdown: Update
# - RCU_DTH_freq: Update # - RCU_DTH_freq: Update
# - RCU_DTH_on: Update #disabled for testing # - RCU_DTH_on: Update #disabled for testing
......
...@@ -522,12 +522,13 @@ variables: ...@@ -522,12 +522,13 @@ variables:
- name: RCU_ADC_sync - name: RCU_ADC_sync
driver: I2C_RCU driver: I2C_RCU
devreg: [ADC1.SYNC_control,ADC2.SYNC_control,ADC3.SYNC_control] devreg: [ADC1.SYNC_control,ADC2.SYNC_control,ADC3.SYNC_control]
width: 8 width: 1
rw: ro rw: ro
dtype: uint8 dtype: boolean
dim: 96 dim: 96
dim2: [3,32] dim2: [3,32]
debug: true # debug: true
read_parallel: true
- name: RCU_ADC_JESD - name: RCU_ADC_JESD
driver: I2C_RCU driver: I2C_RCU
...@@ -645,6 +646,7 @@ methods: ...@@ -645,6 +646,7 @@ methods:
- IO3.CONF1: Update - IO3.CONF1: Update
- RCU_update: 0 - RCU_update: 0
- RCU_ADC_locked: Update #check if not also in RCU_update - 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_DTH_on: Update #check if not also in RCU_update
- name: RCU_on - name: RCU_on
...@@ -720,6 +722,7 @@ methods: ...@@ -720,6 +722,7 @@ methods:
- RCU_PWR_1V8: Update - RCU_PWR_1V8: Update
- RCU_PWR_2V5: Update - RCU_PWR_2V5: Update
- RCU_ADC_locked: Update #disabled for testing - RCU_ADC_locked: Update #disabled for testing
- RCU_ADC_sync: Update #disabled for testing
- name: RCU_update - name: RCU_update
driver: I2C_RCU driver: I2C_RCU
...@@ -736,8 +739,6 @@ methods: ...@@ -736,8 +739,6 @@ methods:
- RCU_LED_green_on: Update - RCU_LED_green_on: Update
- RCU_attenuator_dB: Update - RCU_attenuator_dB: Update
- RCU_band_select: 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_shutdown: Update
# - RCU_DTH_freq: Update # - RCU_DTH_freq: Update
# - RCU_DTH_on: Update #disabled for testing # - RCU_DTH_on: Update #disabled for testing
...@@ -840,3 +841,15 @@ methods: ...@@ -840,3 +841,15 @@ methods:
# - DTH3.State : [0,0] # - DTH3.State : [0,0]
# - RCU_DTH_on: Update # - 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]
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
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment