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
f9991f65
Commit
f9991f65
authored
Nov 25, 2017
by
Dave Newbold
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://bitbucket.org/solidexperiment/solid_firmware
parents
044ae9e4
119c1500
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
74 additions
and
199 deletions
+74
-199
align_adc.py
projects/64ch/software/align_adc.py
+3
-3
align_adc_bulk.py
projects/64ch/software/align_adc_bulk.py
+0
-187
call_align_adc.py
projects/64ch/software/call_align_adc.py
+30
-0
connections.xml
projects/64ch/software/connections.xml
+22
-0
inspect_tapSlip_config.py
projects/64ch/software/inspect_tapSlip_config.py
+3
-1
ro_test.py
projects/64ch/software/ro_test.py
+10
-1
setup.py
projects/64ch/software/setup.py
+6
-7
No files found.
projects/64ch/software/align_adc.py
View file @
f9991f65
...
...
@@ -36,8 +36,8 @@ 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
)
manager
=
uhal
.
ConnectionManager
(
"file://connections.xml"
)
board
=
manager
.
getDevice
(
sys
.
argv
[
1
]
)
#board = manager.getDevice(sys.argv[1]
)
board
=
uhal
.
getDevice
(
"board"
,
"ipbusudp-2.0://192.168.235."
+
str
(
sys
.
argv
[
1
])
+
":50001"
,
"file://addrtab/top.xml"
)
board
.
getClient
()
.
setTimeoutPeriod
(
10000
)
v
=
board
.
getNode
(
"csr.id"
)
.
read
()
...
...
@@ -90,7 +90,7 @@ for i_chan in chans:
aslip
=
board
.
getNode
(
"daq.chan.csr.stat.slip"
)
.
read
()
board
.
dispatch
()
if
i_slip
!=
aslip
or
i_tap
!=
atap
:
print
"Colossal bullshit has occured
"
print
"Colossal bullshit has occured
, i_slip, i_tap, atap, aslip:"
,
i_slip
,
i_tap
,
atap
,
aslip
sys
.
exit
()
board
.
getNode
(
"daq.timing.csr.ctrl.chan_cap"
)
.
write
(
0x1
)
# Capture
board
.
getNode
(
"daq.timing.csr.ctrl.chan_cap"
)
.
write
(
0x0
)
...
...
projects/64ch/software/align_adc_bulk.py
deleted
100755 → 0
View file @
044ae9e4
#!/usr/bin/python
import
dataset
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
()
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
)
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
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
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
)
iBoard
=
-
1
for
ith_ip
in
ips
:
iBoard
+=
1
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
.
getClient
()
.
setTimeoutPeriod
(
10000
)
v
=
board
.
getNode
(
"csr.id"
)
.
read
()
board
.
dispatch
()
board
.
getNode
(
"daq.timing.csr.ctrl.rst"
)
.
write
(
1
)
# Hold clk40 domain in reset
board
.
dispatch
()
board
.
getNode
(
"csr.ctrl.soft_rst"
)
.
write
(
1
)
# Reset ipbus registers
board
.
dispatch
()
time
.
sleep
(
1
)
chans
=
range
(
0x1
)
adcs
=
range
(
0x10
)
patt
=
0x0ff
cap_len
=
0x80
taps_per_slip
=
22
spi
=
board
.
getNode
(
"io.spi"
)
spi_config
(
spi
,
0xf
,
0x2410
,
0x1
)
# Divide 31.25MHz ipbus clock by 32; 16b transfer length, auto CSN; Enable SPI slave 0
for
i
in
adcs
:
board
.
getNode
(
"csr.ctrl.io_sel"
)
.
write
(
i
)
# Select ADC bank to talk to
board
.
dispatch
()
spi_write
(
spi
,
0x0
,
0x80
)
# Reset ADC
spi_write
(
spi
,
0x2
,
0x05
)
# 14b 1 lane mode
spi_write
(
spi
,
0x3
,
0x80
+
(
patt
>>
8
))
# Test pattern
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
board
.
getNode
(
"daq.chan.csr.ctrl.en_sync"
)
.
write
(
0x1
)
# Enable sync commands
if
i_chan
in
invert
:
board
.
getNode
(
"daq.chan.csr.ctrl.invert"
)
.
write
(
0x1
)
# Invert the data
board
.
getNode
(
"daq.chan.csr.ctrl.en_buf"
)
.
write
(
0x1
)
# Enable this channel
board
.
dispatch
()
res
=
[
False
]
*
(
17
*
taps_per_slip
)
tr
=
[]
for
i_slip
in
range
(
1
):
ok
=
False
for
i_tap
in
range
(
32
):
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
.
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
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
)
if
c
==
cap_len
:
workers
.
append
([
i_slip
,
i_tap
])
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
)
board
.
dispatch
()
if
ok
:
tr
.
append
(
i_slip
)
board
.
getNode
(
"daq.timing.csr.ctrl.chan_slip"
)
.
write
(
0x1
)
# Increment slip
board
.
getNode
(
"daq.timing.csr.ctrl.chan_slip"
)
.
write
(
0x0
)
board
.
dispatch
()
trp
=
""
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
:
min
=
i
+
1
else
:
non_cont
=
True
elif
res
[
i
]
and
not
res
[
i
+
1
]:
if
max
==
0
:
max
=
i
else
:
non_cont
=
True
if
res
[
i
]
==
None
:
trp
+=
"_"
elif
res
[
i
]:
trp
+=
"+"
else
:
trp
+=
"."
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
)
if
not
non_cont
:
print
"Chan, rec_slip, rec_tap:"
,
i_chan
,
d_slip
,
d_tap
,
'
\t
'
,
iBoard
else
:
print
"Chan, NON CONTINUOUS RANGE"
,
hex
(
i_chan
),
trp
print
'ith_slips'
,
ith_slips
print
'ith_taps'
,
ith_taps
projects/64ch/software/call_align_adc.py
0 → 100644
View file @
f9991f65
import
os
import
dataset
import
sys
import
pickle
sys
.
path
.
append
(
'/home/dsaunder/workspace/go_projects/src/bitbucket.org/solidexperiment/readout-software/scripts/'
)
import
detector_config_tools
ips
=
detector_config_tools
.
currentIPs
(
False
)
print
ips
'''
for ip in ips:
cmd = "python align_adc.py " + str(ip) + " output_" + str(ip) + ".tapslips"
print cmd
try:
os.system(cmd)
except:
sys.exit(0)
'''
# Dump into a db
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
'New config ID:'
,
configID
for
ip
in
ips
:
results
=
pickle
.
load
(
open
(
"output_"
+
str
(
ip
)
+
".tapslips"
,
"rb"
)
)
for
res
in
results
:
db
[
'TapSlips'
]
.
insert
({
'configID'
:
int
(
configID
),
'ip'
:
str
(
ip
),
'tap'
:
res
[
2
],
'slip'
:
res
[
1
],
'channel'
:
res
[
0
]})
projects/64ch/software/connections.xml
View file @
f9991f65
...
...
@@ -13,4 +13,26 @@
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_72"
uri=
"ipbusudp-2.0://192.168.235.72:50001"
address_table=
"file://addrtab/top.xml"
/>
<connection
id=
"BR2_62"
uri=
"ipbusudp-2.0://192.168.235.62:50001"
address_table=
"file://addrtab/top.xml"
/>
<connection
id=
"BR2_70"
uri=
"ipbusudp-2.0://192.168.235.70:50001"
address_table=
"file://addrtab/top.xml"
/>
<connection
id=
"BR2_71"
uri=
"ipbusudp-2.0://192.168.235.71:50001"
address_table=
"file://addrtab/top.xml"
/>
<connection
id=
"BR2_87"
uri=
"ipbusudp-2.0://192.168.235.87:50001"
address_table=
"file://addrtab/top.xml"
/>
<connection
id=
"BR2_94"
uri=
"ipbusudp-2.0://192.168.235.94:50001"
address_table=
"file://addrtab/top.xml"
/>
<connection
id=
"BR2_85"
uri=
"ipbusudp-2.0://192.168.235.83:50001"
address_table=
"file://addrtab/top.xml"
/>
<connection
id=
"BR2_83"
uri=
"ipbusudp-2.0://192.168.235.83:50001"
address_table=
"file://addrtab/top.xml"
/>
<connection
id=
"BR2_89"
uri=
"ipbusudp-2.0://192.168.235.89:50001"
address_table=
"file://addrtab/top.xml"
/>
<connection
id=
"BR2_68"
uri=
"ipbusudp-2.0://192.168.235.68:50001"
address_table=
"file://addrtab/top.xml"
/>
</connections>
projects/64ch/software/inspect_tapSlip_config.py
View file @
f9991f65
...
...
@@ -6,8 +6,9 @@ iEntry = -1
prevChan
=
64
min_tap
,
max_tap
,
min_slip
,
max_slip
=
99
,
99
,
99
,
99
for
entry
in
db
[
'TapSlips'
]:
if
entry
[
'ip'
]
==
'102'
:
print
'IP 102:'
,
entry
if
entry
[
'ip'
]
==
'72'
and
entry
[
'channel'
]
==
0
:
print
entry
'''
if entry['configID'] == 26:
if prevChan != entry['channel'] - 1:
#print entry
...
...
@@ -24,3 +25,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/ro_test.py
View file @
f9991f65
...
...
@@ -41,13 +41,22 @@ board.dispatch()
sleep
(
1
)
tap
=
11
slip
=
7
for
i
in
range
(
1
):
board
.
getNode
(
"csr.ctrl.chan"
)
.
write
(
i
)
# Talk to channel 0
board
.
getNode
(
"csr.ctrl.chan"
)
.
write
(
38
)
# Talk to channel 0
board
.
getNode
(
"daq.chan.csr.ctrl.mode"
)
.
write
(
0x0
)
# Set to normal DAQ mode
board
.
getNode
(
"daq.chan.csr.ctrl.src"
)
.
write
(
0x3
)
# Set source to fake data
board
.
getNode
(
"daq.chan.zs_thresh"
)
.
writeBlock
([
0x0
,
0x1
])
# Set ZS thresholds #0 = 0, #1 =1
board
.
getNode
(
"daq.chan.trig_thresh.threshold.thresh"
)
.
write
(
0x1000
)
# Set ctrig 0 threshold
board
.
getNode
(
"daq.chan.csr.ctrl.en_buf"
)
.
write
(
0x1
)
# Enable this channel
for
islip
in
range
(
slip
):
board
.
getNode
(
"daq.timing.csr.ctrl.chan_slip"
)
.
write
(
0x1
)
board
.
getNode
(
"daq.timing.csr.ctrl.chan_slip"
)
.
write
(
0x0
)
for
itap
in
range
(
tap
):
board
.
getNode
(
"daq.timing.csr.ctrl.chan_inc"
)
.
write
(
0x1
)
board
.
getNode
(
"daq.timing.csr.ctrl.chan_inc"
)
.
write
(
0x0
)
board
.
getNode
(
"daq.fake.ctrl.mode"
)
.
write
(
0x1
)
# Set fake data to pulse
board
.
getNode
(
"daq.fake.ctrl.samp_lock"
)
.
write
(
0x1
)
# Lock to sample
...
...
projects/64ch/software/setup.py
View file @
f9991f65
...
...
@@ -6,14 +6,13 @@ 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
]
slaveReadoutBoards
=
True
>>>>>>>
770260
c728da726f742260c3dfe27c8be7156add
ips
=
detector_config_tools
.
currentIPs
(
False
)
slaveReadoutBoards
=
False
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"
))
...
...
@@ -46,11 +45,11 @@ for hw in hw_list:
fv
=
hw
.
getNode
(
"io.freq_ctr.freq.valid"
)
.
read
();
hw
.
dispatch
()
print
"Freq:"
,
int
(
fv
),
int
(
fq
)
*
119.20928
/
1000000
;
#
if slaveReadoutBoards: hw.getNode("daq.timing.csr.ctrl.en_ext_sync").write(1)
if
slaveReadoutBoards
:
hw
.
getNode
(
"daq.timing.csr.ctrl.en_ext_sync"
)
.
write
(
1
)
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