Commit e903e2a5 authored by Dan Saunders's avatar Dan Saunders

version of builk aligning

parent 67d42e74
......@@ -68,8 +68,7 @@ for i in adcs:
spi_write(spi, 0x4, patt & 0xff) # Test pattern
for i_chan in chans:
board.getNode("csr.ctrl.chan").write(i_chan) # Talk to channel 0
board.getNode("csr.ctrl.chan").write(i_chan) # Talk to channel 0
board.getNode("daq.chan.csr.ctrl.mode").write(0x1) # Set to capture mode
board.getNode("daq.chan.csr.ctrl.src").write(0x0) # Set source to ADC
board.getNode("daq.chan.csr.ctrl.en_sync").write(0x1) # Enable sync commands
......@@ -99,9 +98,9 @@ for i_chan in chans:
for w in d:
if int(w) & 0x3ff == patt:
c += 1
# print hex(w),
# print hex(i_chan), hex(i_slip), hex(i_tap), c
res[offsets[i_slip] * taps_per_slip + (31 - i_tap)] = (c == cap_len)
print hex(w),
print hex(i_chan), hex(i_slip), hex(i_tap), c
res[offsets[i_slip] * taps_per_slip + (31 - i_tap)] = (c == cap_len)
ok = (c == cap_len) or ok
board.getNode("daq.timing.csr.ctrl.chan_inc").write(0x1) # Increment tap
board.getNode("daq.timing.csr.ctrl.chan_inc").write(0x0)
......
#!/usr/bin/python
import dataset
import uhal
import time
import sys
......@@ -37,23 +38,19 @@ offsets = [0, 13, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11]
invert = [0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25]
# Db stuff.
ips = detector_config_tools.currentIPs(False)
ips = [92]
ips = [62]
db = dataset.connect('mysql://DAQGopher:gogogadgetdatabase@localhost/solid_phase1_running')
configID = 0 #first time case
if len(db['TapSlips']) != 0: configID = max(db['TapSlips']['configID'])['configID'] + 1
print 'Bulk scanning ips:', ips
print 'New TapSlips configID', configID
uhal.setLogLevelTo(uhal.LogLevel.ERROR)
for ith_ip in ips:
ith_slips, ith_taps = [], []
print '\n\n*********** About to align ip:', ith_ip
board = uhal.getDevice("board", "ipbusudp-2.0://192.168.235." + str(ith_ip) + ":50001", "file://addrtab/top.xml")
uhal.setLogLevelTo(uhal.LogLevel.ERROR)
board = uhal.getDevice("board", "ipbusudp-2.0://192.168.235.50:50001", "file://addrtab/top.xml")
#board = uhal.getDevice("board", "ipbusudp-2.0://192.168.235.16:50001", "file://addrtab/top_sim.xml")
board.getClient().setTimeoutPeriod(10000)
v = board.getNode("csr.id").read()
board.dispatch()
......@@ -114,8 +111,8 @@ for ith_ip in ips:
for w in d:
if int(w) & 0x3ff == patt:
c += 1
# print hex(w),
# print hex(i_chan), hex(i_slip), hex(i_tap), c
print hex(w),
print hex(i_chan), hex(i_slip), hex(i_tap), c
res[offsets[i_slip] * taps_per_slip + (31 - i_tap)] = (c == cap_len)
ok = (c == cap_len) or ok
board.getNode("daq.timing.csr.ctrl.chan_inc").write(0x1) # Increment tap
......
......@@ -7,7 +7,7 @@ from I2CuHal import I2CCore
from si5344 import si5344
uhal.setLogLevelTo(uhal.LogLevel.INFO)
hw = uhal.getDevice("board", "ipbusudp-2.0://192.168.235.100:50001", "file://addrtab/top.xml")
hw = uhal.getDevice("board", "ipbusudp-2.0://192.168.235.62:50001", "file://addrtab/top.xml")
hw.getNode("csr.ctrl.soft_rst").write(1) # Reset ipbus registers
hw.dispatch()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment