Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
euro-adc-65m-14b-40cha-gw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
eurocard
euro-adc-65m-14b-40cha
euro-adc-65m-14b-40cha-gw
Commits
5c75289b
Commit
5c75289b
authored
Nov 22, 2017
by
Dan Saunders
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merging
parent
59e283f5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
67 deletions
+58
-67
align_adc_bulk.py
projects/64ch/software/align_adc_bulk.py
+43
-61
connections.xml
projects/64ch/software/connections.xml
+4
-0
inspect_tapSlip_config.py
projects/64ch/software/inspect_tapSlip_config.py
+5
-1
setup.py
projects/64ch/software/setup.py
+6
-5
No files found.
projects/64ch/software/align_adc_bulk.py
View file @
5c75289b
...
...
@@ -5,41 +5,42 @@ import uhal
import
time
import
sys
import
collections
sys
.
path
.
append
(
'/home/dsaunder/workspace/go_projects/src/bitbucket.org/solidexperiment/readout-software/scripts/'
)
import
detector_config_tools
def
spi_config
(
spi
,
div
,
ctrl
,
ss
):
spi
.
getNode
(
"divider"
)
.
write
(
0xf
)
# Divide 31.25MHz ipbus clock by 32
spi
.
getNode
(
"ctrl"
)
.
write
(
0x2410
)
# 16b transfer length, auto CSN
spi
.
getNode
(
"ss"
)
.
write
(
0x1
)
# Enable SPI slave 0
spi
.
getClient
()
.
dispatch
()
spi
.
getNode
(
"divider"
)
.
write
(
0xf
)
# Divide 31.25MHz ipbus clock by 32
spi
.
getNode
(
"ctrl"
)
.
write
(
0x2410
)
# 16b transfer length, auto CSN
spi
.
getNode
(
"ss"
)
.
write
(
0x1
)
# Enable SPI slave 0
spi
.
getClient
()
.
dispatch
()
def
spi_write
(
spi
,
addr
,
data
):
spi
.
getNode
(
"d0"
)
.
write
((
addr
<<
8
)
+
data
)
# Write data into addr
spi
.
getNode
(
"ctrl"
)
.
write
(
0x2510
)
# Do it
spi
.
getClient
()
.
dispatch
()
r
=
spi
.
getNode
(
"ctrl"
)
.
read
()
spi
.
getClient
()
.
dispatch
()
if
r
&
0x100
!=
0
:
print
"SPI write error"
,
hex
(
addr
),
hex
(
data
)
spi
.
getNode
(
"d0"
)
.
write
((
addr
<<
8
)
+
data
)
# Write data into addr
spi
.
getNode
(
"ctrl"
)
.
write
(
0x2510
)
# Do it
spi
.
getClient
()
.
dispatch
()
r
=
spi
.
getNode
(
"ctrl"
)
.
read
()
spi
.
getClient
()
.
dispatch
()
if
r
&
0x100
!=
0
:
print
"SPI write error"
,
hex
(
addr
),
hex
(
data
)
def
spi_read
(
spi
,
addr
):
spi
.
getNode
(
"d0"
)
.
write
(
0x8000
+
(
addr
<<
8
))
# Read from addr
spi
.
getNode
(
"ctrl"
)
.
write
(
0x2510
)
# Do it
spi
.
getClient
()
.
dispatch
()
d
=
spi
.
getNode
(
"d0"
)
.
read
()
r
=
spi
.
getNode
(
"ctrl"
)
.
read
()
spi
.
getClient
()
.
dispatch
()
if
r
&
0x100
!=
0
:
print
"SPI read error"
,
hex
(
addr
)
return
d
&
0xffff
spi
.
getNode
(
"d0"
)
.
write
(
0x8000
+
(
addr
<<
8
))
# Read from addr
spi
.
getNode
(
"ctrl"
)
.
write
(
0x2510
)
# Do it
spi
.
getClient
()
.
dispatch
()
d
=
spi
.
getNode
(
"d0"
)
.
read
()
r
=
spi
.
getNode
(
"ctrl"
)
.
read
()
spi
.
getClient
()
.
dispatch
()
if
r
&
0x100
!=
0
:
print
"SPI read error"
,
hex
(
addr
)
return
d
&
0xffff
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
]
uhal
.
setLogLevelTo
(
uhal
.
LogLevel
.
ERROR
)
# Db stuff.
ips
=
detector_config_tools
.
currentIPs
(
False
)
db
=
dataset
.
connect
(
'mysql://DAQGopher:gogogadgetdatabase@localhost/solid_phase1_running'
)
configID
=
0
#first time case
...
...
@@ -54,6 +55,9 @@ for ith_ip in ips:
ith_slips
,
ith_taps
=
[],
[]
print
'
\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"
)
#board = uhal.getDevice("board", "ipbusudp-2.0://192.168.235.16:50001", "file://addrtab/top_sim.xml")
#manager = uhal.ConnectionManager("file://connections.xml")
#board = manager.getDevice(sys.argv[1])
board
.
getClient
()
.
setTimeoutPeriod
(
10000
)
v
=
board
.
getNode
(
"csr.id"
)
.
read
()
...
...
@@ -67,7 +71,7 @@ for ith_ip in ips:
time
.
sleep
(
1
)
chans
=
range
(
0x
1
)
chans
=
range
(
0x
40
)
adcs
=
range
(
0x10
)
patt
=
0x0ff
cap_len
=
0x80
...
...
@@ -85,7 +89,6 @@ for ith_ip in ips:
spi_write
(
spi
,
0x4
,
patt
&
0xff
)
# Test pattern
for
i_chan
in
chans
:
workers
=
[]
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
...
...
@@ -95,35 +98,37 @@ for ith_ip in ips:
board
.
getNode
(
"daq.chan.csr.ctrl.en_buf"
)
.
write
(
0x1
)
# Enable this channel
board
.
dispatch
()
res
=
[
False
]
*
(
1
7
*
taps_per_slip
)
res
=
[
False
]
*
(
1
5
*
taps_per_slip
)
tr
=
[]
for
i_slip
in
range
(
1
):
for
i_slip
in
range
(
1
4
):
ok
=
False
for
i_tap
in
range
(
32
):
atap
=
board
.
getNode
(
"daq.chan.csr.stat.tap"
)
.
read
()
aslip
=
board
.
getNode
(
"daq.chan.csr.stat.slip"
)
.
read
()
board
.
dispatch
()
# print "Set slip, tap ; actual slip, tap", hex(i_slip), hex(i_tap), hex(aslip), hex(atap)
if
i_slip
!=
aslip
or
i_tap
!=
atap
:
print
"Colossal bullshit has occured"
sys
.
exit
()
board
.
getNode
(
"daq.timing.csr.ctrl.chan_cap"
)
.
write
(
0x1
)
# Capture
board
.
getNode
(
"daq.timing.csr.ctrl.chan_cap"
)
.
write
(
0x0
)
board
.
dispatch
()
time
.
sleep
(
0.01
)
while
True
:
r
=
board
.
getNode
(
"daq.chan.csr.stat"
)
.
read
()
board
.
getNode
(
"daq.chan.buf.addr"
)
.
write
(
0x0
)
d
=
board
.
getNode
(
"daq.chan.buf.data"
)
.
readBlock
(
cap_len
)
board
.
dispatch
()
if
r
&
0x1
==
1
:
break
print
"Crap no capture"
,
hex
(
i_chan
),
hex
(
i_slip
),
hex
(
i_tap
),
hex
(
r
),
time
.
clock
()
c
=
0
<<<<<<<
HEAD
for
w
in
d
:
if
int
(
w
)
&
0x3ff
==
patt
:
c
+=
1
#print hex(w),
#print i_chan, i_slip, i_tap, c, '\t-\t', iBoard
l
=
(
offsets
[
i_slip
]
+
2
)
*
taps_per_slip
-
i_tap
res
[
l
]
=
(
c
==
cap_len
)
#res[i_slip * taps_per_slip + i_tap] = (c == cap_len)
if
c
==
cap_len
:
workers
.
append
([
i_slip
,
i_tap
])
=======
# 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
)
>>>>>>>
a1628f5b1f63ca4804f5919005d9e7f3db8ac00c
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
)
...
...
@@ -138,7 +143,6 @@ for ith_ip in ips:
min
=
0
max
=
0
non_cont
=
False
print
workers
,
len
(
workers
),
workers
[
len
(
workers
)
/
2
]
for
i
in
range
(
len
(
res
)
-
1
):
if
res
[
i
+
1
]
and
not
res
[
i
]:
if
min
==
0
:
...
...
@@ -156,37 +160,15 @@ for ith_ip in ips:
trp
+=
"+"
else
:
trp
+=
"."
<<<<<<<
HEAD
a
=
int
((
min
+
max
)
/
2
)
l_tap
=
taps_per_slip
d_slip
=
0
d_tap
=
0
for
i_slip
in
range
(
14
):
for
i_tap
in
range
(
taps_per_slip
):
if
a
==
(
offsets
[
i_slip
]
+
2
)
*
taps_per_slip
-
i_tap
:
d_slip
=
i_slip
d_tap
=
i_tap
db
[
'TapSlips'
]
.
insert
({
'configID'
:
int
(
configID
),
'ip'
:
ith_ip
,
'tap'
:
d_tap
,
'slip'
:
d_slip
,
'channel'
:
i_chan
})
ith_slips
.
append
(
d_slip
)
ith_taps
.
append
(
d_tap
)
#ith_slips.append(workers[len(workers)/2][0])
#ith_taps.append(workers[len(workers)/2][1])
print
trp
=======
a
=
int
((
min
+
max
)
/
2
)
d_slip
=
offsets
.
index
(
a
//
taps_per_slip
)
d_tap
=
a
%
taps_per_slip
print
trp
db
[
'TapSlips'
]
.
insert
({
'configID'
:
int
(
configID
),
'ip'
:
ith_ip
,
'tap'
:
d_tap
,
'slip'
:
d_slip
,
'channel'
:
i_chan
})
ith_slips
.
append
(
d_slip
)
ith_taps
.
append
(
d_tap
)
>>>>>>>
a1628f5b1f63ca4804f5919005d9e7f3db8ac00c
print
trp
db
[
'TapSlips'
]
.
insert
({
'configID'
:
int
(
configID
),
'ip'
:
ith_ip
,
'tap'
:
d_tap
,
'slip'
:
d_slip
,
'channel'
:
i_chan
})
if
not
non_cont
:
print
"Chan, rec_slip, rec_tap:"
,
i_chan
,
d_slip
,
d_tap
,
'
\t
'
,
iBoard
print
"Chan, rec_slip, rec_tap:"
,
i_chan
,
d_slip
,
d_tap
else
:
print
"Chan, NON CONTINUOUS RANGE"
,
hex
(
i_chan
),
trp
...
...
projects/64ch/software/connections.xml
View file @
5c75289b
...
...
@@ -13,4 +13,8 @@
address_table=
"file://addrtab/top.xml"
/>
<connection
id=
"BR2_53"
uri=
"ipbusudp-2.0://192.168.235.53:50001"
address_table=
"file://addrtab/top.xml"
/>
<connection
id=
"BR2_74"
uri=
"ipbusudp-2.0://192.168.235.74:50001"
address_table=
"file://addrtab/top.xml"
/>
<connection
id=
"BR2_54"
uri=
"ipbusudp-2.0://192.168.235.54:50001"
address_table=
"file://addrtab/top.xml"
/>
</connections>
projects/64ch/software/inspect_tapSlip_config.py
View file @
5c75289b
...
...
@@ -5,9 +5,12 @@ nChanJumps = 0
iEntry
=
-
1
prevChan
=
64
min_tap
,
max_tap
,
min_slip
,
max_slip
=
99
,
99
,
99
,
99
print
'Channel, slip, tap'
for
entry
in
db
[
'TapSlips'
]:
if
entry
[
'ip'
]
==
'102'
:
print
'IP 102:'
,
entry
if
entry
[
'ip'
]
==
'51'
:
print
entry
[
'channel'
],
entry
[
'slip'
],
entry
[
'tap'
]
'''
if entry['configID'] == 26:
if prevChan != entry['channel'] - 1:
#print entry
...
...
@@ -24,3 +27,4 @@ print 'Current (max) config ID:', max(db['Config']['configID'])
print 'nJumps:', nChanJumps
print 'max/min tap:', max_tap, min_tap
print 'max/min slip:', max_slip, min_slip
'''
projects/64ch/software/setup.py
View file @
5c75289b
...
...
@@ -6,14 +6,15 @@ import sys
from
I2CuHal
import
I2CCore
from
si5344
import
si5344
sys
.
path
.
append
(
'/home/
solid
/workspace/go_projects/src/bitbucket.org/solidexperiment/readout-software/scripts'
)
sys
.
path
.
append
(
'/home/
dsaunder
/workspace/go_projects/src/bitbucket.org/solidexperiment/readout-software/scripts'
)
import
detector_config_tools
uhal
.
setLogLevelTo
(
uhal
.
LogLevel
.
ERROR
)
#ips = detector_config_tools.currentIPs(False)
ips
=
[
62
,
72
,
70
,
71
,
87
,
94
,
89
,
85
,
83
,
68
,
51
,
61
,
52
,
63
,
91
,
81
,
67
,
73
,
57
,
102
,
74
,
59
,
96
,
90
,
64
,
98
,
76
,
104
,
54
,
58
]
ips
=
detector_config_tools
.
currentIPs
(
False
)
#ips = [62, 72, 70, 71, 87, 94, 89, 85, 83, 68, 51, 61, 52, 63, 91, 81, 67, 73, 57, 102, 74, 59, 96, 90, 64, 98, 76, 104, 54, 58]
ips
=
[
72
]
slaveReadoutBoards
=
True
>>>>>>>
770260
c728da726f742260c3dfe27c8be7156add
hw_list
=
[]
for
ip
in
ips
:
print
'Setting up readout board ip:'
,
ip
hw_list
.
append
(
uhal
.
getDevice
(
"board"
,
"ipbusudp-2.0://192.168.235."
+
str
(
ip
)
+
":50001"
,
"file://addrtab/top.xml"
))
...
...
@@ -50,7 +51,7 @@ for hw in hw_list:
f
=
hw
.
getNode
(
"csr.stat"
)
.
read
()
hw
.
dispatch
()
print
"csr.stat:"
,
hex
(
f
)
print
"csr.stat:"
,
hex
(
f
)
,
int
(
f
)
&
0x1
,
int
(
f
)
&
0x2
while
int
(
f
)
&
0x1
==
0
:
print
"Wait for MMCM lock"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment