Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
Conv TTL Blocking
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Conv TTL Blocking
Commits
eced93bc
Commit
eced93bc
authored
Dec 08, 2013
by
Theodor-Adrian Stana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated Python test scripts
Signed-off-by:
Theodor Stana
<
t.stana@cern.ch
>
parent
336ea4b3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
32 deletions
+37
-32
multiboot.py
software/multiboot/multiboot.py
+8
-5
pulsetest.py
software/pulsetest/pulsetest.py
+16
-14
regtest.py
software/regtest/regtest.py
+13
-13
No files found.
software/multiboot/multiboot.py
View file @
eced93bc
...
...
@@ -75,7 +75,7 @@ def spi_transfer(nbytes, cs, dat):
else
:
for
i
in
xrange
(
len
(
dat
)):
wval
.
append
((
ctrl
<<
24
)
|
dat
[
i
])
testelma
.
writemregs
(
MB_BASE
+
MB_FAR_OFS
,
wval
)
testelma
.
writemregs
(
slot
,
MB_BASE
+
MB_FAR_OFS
,
wval
)
# Read the data and prepare the return value
while
(
retval
&
(
1
<<
28
)
==
0
):
...
...
@@ -291,7 +291,7 @@ def _iprog(addr):
except
NAckError
:
pass
# Set timeout
to be sixty seconds from now
...
# Set timeout...
t0
=
time
.
time
()
t1
=
t0
+
20
...
...
@@ -301,7 +301,10 @@ def _iprog(addr):
if
(
time
.
time
()
>=
t1
):
print
"Timeout, IPROG unsuccessful!"
break
if
((
testelma
.
read
(
slot
,
0x4
)
&
0xFFFF
)
>
0x0200
):
if
((
testelma
.
read
(
slot
,
0x4
)
&
0xFF
)
==
0x00
):
print
"IPROG unsuccessful, fallback to Golden bitstream occured!"
break
else
:
print
"IPROG successful!"
break
except
NAckError
:
...
...
@@ -357,8 +360,8 @@ if __name__ == "__main__":
# Open VBCP connection
testelma
.
open
()
#
Set MB_BASE to value in pulsetest bitstream, if this bitstream is present
if
(
testelma
.
read
(
slot
,
0x04
)
&
0xFF
FF
==
0x99
99
):
#
The PULSETEST bitstream has the MultiBoot module starting at address 0x300
if
(
testelma
.
read
(
slot
,
0x04
)
&
0xFF
==
0x
99
):
MB_BASE
=
0x300
;
# Read config reg, if user wants to
...
...
software/pulsetest/pulsetest.py
View file @
eced93bc
...
...
@@ -39,6 +39,8 @@ C4FREQREG = 0x240
C5FREQREG
=
0x244
C6FREQREG
=
0x248
CTB_CLK_PER
=
50
*
(
10
**
(
-
9
))
#CTB_CLK_PER = 8*(10**(-9))
if
__name__
==
"__main__"
:
ip
=
"elma"
# raw_input("Crate IP? ")
...
...
@@ -65,9 +67,9 @@ if __name__ == "__main__":
testelma
.
open
()
bloid
=
testelma
.
read
(
slot
,
0x00
)
fwvers
=
testelma
.
read
(
slot
,
0x04
)
&
0xFF
FF
fwvers
=
testelma
.
read
(
slot
,
0x04
)
&
0xFF
if
(
bloid
!=
0x
424c4f32
)
or
(
fwvers
!=
0x99
99
):
if
(
bloid
!=
0x
54424c4f
)
or
(
fwvers
!=
0x
99
):
print
"Wrong version number (0x
%04
x)"
%
fwvers
sys
.
exit
(
1
)
...
...
@@ -79,12 +81,12 @@ if __name__ == "__main__":
chen
=
0x00
;
# Setup channel output pulse widths to 1.2us
testelma
.
write
(
slot
,
C1WDTHREG
,
0x96
)
testelma
.
write
(
slot
,
C2WDTHREG
,
0x96
)
testelma
.
write
(
slot
,
C3WDTHREG
,
0x96
)
testelma
.
write
(
slot
,
C4WDTHREG
,
0x96
)
testelma
.
write
(
slot
,
C5WDTHREG
,
0x96
)
testelma
.
write
(
slot
,
C6WDTHREG
,
0x96
)
testelma
.
write
(
slot
,
C1WDTHREG
,
1.2
*
(
10
**
(
-
6
))
/
CTB_CLK_PER
)
testelma
.
write
(
slot
,
C2WDTHREG
,
1.2
*
(
10
**
(
-
6
))
/
CTB_CLK_PER
)
testelma
.
write
(
slot
,
C3WDTHREG
,
1.2
*
(
10
**
(
-
6
))
/
CTB_CLK_PER
)
testelma
.
write
(
slot
,
C4WDTHREG
,
1.2
*
(
10
**
(
-
6
))
/
CTB_CLK_PER
)
testelma
.
write
(
slot
,
C5WDTHREG
,
1.2
*
(
10
**
(
-
6
))
/
CTB_CLK_PER
)
testelma
.
write
(
slot
,
C6WDTHREG
,
1.2
*
(
10
**
(
-
6
))
/
CTB_CLK_PER
)
# Setup channel delays and frequencies
farr
=
[
0
,
0
,
0
,
0
,
0
,
0
]
...
...
@@ -100,7 +102,7 @@ if __name__ == "__main__":
# freq = 166000
# print "Automatically setting channel frequency to 166 kHz."
# farr[0] = freq
# freq = 1/(freq *
8*(10**(-9))
)
# freq = 1/(freq *
CTB_CLK_PER
)
# testelma.write(slot, C1FREQREG, int(freq))
# #print freq
# #print hex(int(freq))
...
...
@@ -116,7 +118,7 @@ if __name__ == "__main__":
# freq = 166000
# print "Automatically setting channel frequency to 166 kHz."
# farr[1] = freq
# freq = 1/(freq *
8*(10**(-9))
)
# freq = 1/(freq *
CTB_CLK_PER
)
# testelma.write(slot, C2FREQREG, int(freq))
# #print freq
# #print hex(int(freq))
...
...
@@ -132,7 +134,7 @@ if __name__ == "__main__":
# freq = 166000
# print "Automatically setting channel frequency to 166 kHz."
# farr[2] = freq
# freq = 1/(freq *
8*(10**(-9))
)
# freq = 1/(freq *
CTB_CLK_PER
)
# testelma.write(slot, C3FREQREG, int(freq))
# #print freq
# #print hex(int(freq))
...
...
@@ -148,7 +150,7 @@ if __name__ == "__main__":
# freq = 166000
# print "Automatically setting channel frequency to 166 kHz."
# farr[3] = freq
# freq = 1/(freq *
8*(10**(-9))
)
# freq = 1/(freq *
CTB_CLK_PER
)
# testelma.write(slot, C4FREQREG, int(freq))
# #print freq
# #print hex(int(freq))
...
...
@@ -164,7 +166,7 @@ if __name__ == "__main__":
# freq = 166000
# print "Automatically setting channel frequency to 166 kHz."
# farr[4] = freq
# freq = 1/(freq *
8*(10**(-9))
)
# freq = 1/(freq *
CTB_CLK_PER
)
# testelma.write(slot, C5FREQREG, int(freq))
# #print freq
# #print hex(int(freq))
...
...
@@ -180,7 +182,7 @@ if __name__ == "__main__":
freq
=
166000
print
"Automatically setting channel frequency to 166 kHz."
farr
[
5
]
=
freq
freq
=
1
/
(
freq
*
8
*
(
10
**
(
-
9
))
)
freq
=
1
/
(
freq
*
CTB_CLK_PER
)
testelma
.
write
(
slot
,
C6FREQREG
,
int
(
freq
))
#print freq
#print hex(int(freq))
...
...
software/regtest/regtest.py
View file @
eced93bc
...
...
@@ -8,7 +8,7 @@
#
# version: 1.0
#
# description:
# description:
#
# dependencies:
#
...
...
@@ -29,7 +29,7 @@
# last changes:
# 2013-08-13 Theodor Stana t.stana@cern.ch File created
#===============================================================================
# TODO: -
# TODO: -
#===============================================================================
import
random
...
...
@@ -42,9 +42,9 @@ RAMSTART = 0x000
RAMEND
=
0xFFF
if
__name__
==
"__main__"
:
ip
=
"
elma
"
# raw_input("Crate IP? ")
ip
=
"
cfvm-864-celma1
"
# raw_input("Crate IP? ")
user
=
"user"
# raw_input("Username? ")
pwd
=
"
public
"
# raw_input("Password? ")
pwd
=
"
USER
"
# raw_input("Password? ")
# Wait for proper slot number
while
1
:
...
...
@@ -97,7 +97,7 @@ if __name__ == "__main__":
print
" Seconds must be a decimal number >= 0!"
# Compute test end time according to current time
#
#
# time.time() returns time since start of epoch
# in seconds, so add secs, mins and hrs to that
start_time
=
time
.
time
()
...
...
@@ -120,7 +120,7 @@ if __name__ == "__main__":
wexcep_cnt
=
0
rexcep_cnt
=
0
mismatch_cnt
=
0
br
=
0
# Run test loop for the specified time
while
time
.
time
()
<
end_time
:
...
...
@@ -140,7 +140,7 @@ if __name__ == "__main__":
except
VBCPException
as
e
:
f
.
write
(
"wex
%
i /
%
s /
%
s
\r\n
"
%
(
i
,
time
.
strftime
(
"
%
Y-
%
m-
%
d-
%
Hh
%
Mm
%
Ss"
,
time
.
localtime
()),
e
.
strerror
))
wexcep_cnt
+=
1
# Try a read from CONV-TTL-BLO, exception if unsuccessful
try
:
rval
=
testelma
.
read
(
i
,
addr
)
...
...
@@ -150,8 +150,8 @@ if __name__ == "__main__":
if
rval
!=
wval
:
mismatch_cnt
+=
1
f
.
write
(
"mis
%
i /
%
s /
%03
x :
%08
x !=
%08
x
\r\n
"
%
(
i
,
time
.
strftime
(
"
%
Y-
%
m-
%
d-
%
Hh
%
Mm
%
Ss"
,
time
.
localtime
()),
addr
,
wval
,
rval
))
br
=
1
break
#
br = 1
#
break
except
VBCPException
as
e
:
f
.
write
(
"rex
%
i /
%
s /
%
s
\r\n
"
%
(
i
,
time
.
strftime
(
"
%
Y-
%
m-
%
d-
%
Hh
%
Mm
%
Ss"
,
time
.
localtime
()),
e
.
strerror
))
...
...
@@ -168,7 +168,7 @@ if __name__ == "__main__":
#
# # Write the regaddress value to the register
# wval = addr
#
#
# #f.write("a:%x w:%x " % (addr, wval))
#
# # Try a write to CONV-TTL-BLO, exception if unsuccessful
...
...
@@ -189,15 +189,15 @@ if __name__ == "__main__":
# if rval != wval:
# mismatch_cnt += 1
# f.write("mis %i / %s / %03x : %08x != %08x\r\n" % (i, time.strftime("%Y-%m-%d-%Hh%Mm%Ss",time.localtime()), addr, wval, rval))
# br = 1
# break
#
#
br = 1
#
#
break
#
# except VBCPException as e:
# f.write("rex %i / %s / %s\r\n" % (i, time.strftime("%Y-%m-%d-%Hh%Mm%Ss",time.localtime()), e.strerror))
# rexcep_cnt += 1
## br = 1
## break
#
#
# # Increment regaddr, reset on overflow above 2^12
# addr += 4
...
...
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