Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
pts
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
misc
pts
Commits
b1b8565f
Commit
b1b8565f
authored
Jan 26, 2012
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Measures SPEC and FMC temperature only once.
parent
4b246bc5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
23 deletions
+29
-23
test13.py
test/fmcadc100m14b4cha/python/test13.py
+29
-23
No files found.
test/fmcadc100m14b4cha/python/test13.py
View file @
b1b8565f
...
...
@@ -25,23 +25,24 @@ Note: Requires test00.py to run first to load the firmware!
"""
GN4124_CSR
=
0x0
FAMILY_CODE
=
0x28
def
main
(
default_directory
=
'.'
):
load_firmware
=
raw_input
(
'Do you want to load the firmware? [y,n]'
)
if
(
load_firmware
==
'y'
):
path_fpga_loader
=
'../../../gnurabbit/user/fpga_loader'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha_test.bin'
;
def
load_firmware
(
default_directory
):
print
(
'Load firmware to FPGA'
)
path_fpga_loader
=
'../../../gnurabbit/user/fpga_loader'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha_test.bin'
;
firmware_loader
=
os
.
path
.
join
(
default_directory
,
path_fpga_loader
)
bitstream
=
os
.
path
.
join
(
default_directory
,
path_firmware
)
print
firmware_loader
+
' '
+
bitstream
os
.
system
(
firmware_loader
+
' '
+
bitstream
)
time
.
sleep
(
2
);
firmware_loader
=
os
.
path
.
join
(
default_directory
,
path_fpga_loader
)
bitstream
=
os
.
path
.
join
(
default_directory
,
path_firmware
)
print
firmware_loader
+
' '
+
bitstream
os
.
system
(
firmware_loader
+
' '
+
bitstream
)
time
.
sleep
(
2
);
def
main
(
default_directory
=
'.'
):
# Load firmware
load_firmware
(
default_directory
)
# Objects declaration
spec
=
rr
.
Gennum
()
# bind to the SPEC board
...
...
@@ -57,6 +58,16 @@ def main (default_directory='.'):
else
:
print
(
'SPEC Unique ID:
%.12
X'
)
%
spec_unique_id
# Read SPEC temperature and print to log
spec_temp
=
spec_fmc
.
get_temp
()
print
(
'SPEC temperature:
%3.3
f°C'
)
%
spec_temp
# Check SPEC thermometer family code
if
((
spec_unique_id
&
0xFF
)
!=
FAMILY_CODE
):
family_code
=
spec_unique_id
&
0xFF
print
(
'family code: 0x
%.8
X'
)
%
family_code
raise
PtsError
(
"SPEC's 1-wire thermometer has the wrong family code:0x.2X expected:0x
%.2
X"
%
family_code
,
FAMILY_CODE
)
# Read FMC unique ID and print to log
fmc_unique_id
=
fmc
.
get_unique_id
()
if
(
fmc_unique_id
==
-
1
):
...
...
@@ -64,19 +75,14 @@ def main (default_directory='.'):
else
:
print
(
'FMC Unique ID:
%.12
X'
)
%
fmc_unique_id
# Read temperatur and print to log
temp
=
spec_fmc
.
get_temp
()
print
(
'SPEC temperature:
%3.3
f°C'
)
%
temp
if
((
spec_unique_id
&
0xFF
)
!=
FAMILY_CODE
):
family_code
=
spec_unique_id
&
0xFF
print
(
'family code: 0x
%.8
X'
)
%
family_code
raise
PtsError
(
"SPEC's 1-wire thermometer has the wrong family code:0x.2X expected:0x
%.2
X"
%
family_code
,
FAMILY_CODE
)
# Read FMC temperature and print to log
fmc_temp
=
spec_fmc
.
get_temp
()
print
(
'FMC temperature:
%3.3
f°C'
)
%
fmc_temp
for
i
in
range
(
1000
):
print
(
'
%4
d: spec:
%3.3
f°C fmc:
%3.3
f°C'
)
%
(
i
,
spec_fmc
.
get_temp
(),
fmc
.
get_temp
())
time
.
sleep
(
.5
)
#
for i in range(1000):
#
print('%4d: spec: %3.3f°C fmc: %3.3f°C') %(i, spec_fmc.get_temp(),fmc.get_temp())
#
time.sleep(.5)
if
__name__
==
'__main__'
:
...
...
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