Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC ADC 100M 14b 4cha - Testing
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
FMC ADC 100M 14b 4cha - Testing
Commits
5a6dab83
Commit
5a6dab83
authored
Feb 07, 2012
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change loaded firmware to spec_fmcadc100m14b4cha.bin
parent
2b6fa9e6
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
136 additions
and
35 deletions
+136
-35
fmc_adc_demo.py
test/fmcadc100m14b4cha/python/fmc_adc_demo.py
+1
-1
test00.py
test/fmcadc100m14b4cha/python/test00.py
+1
-1
test08.py
test/fmcadc100m14b4cha/python/test08.py
+1
-1
test09.py
test/fmcadc100m14b4cha/python/test09.py
+1
-1
test12.py
test/fmcadc100m14b4cha/python/test12.py
+1
-1
test13.py
test/fmcadc100m14b4cha/python/test13.py
+1
-1
test16.py
test/fmcadc100m14b4cha/python/test16.py
+1
-1
test17.py
test/fmcadc100m14b4cha/python/test17.py
+1
-1
test19.py
test/fmcadc100m14b4cha/python/test19.py
+1
-1
test20.py
test/fmcadc100m14b4cha/python/test20.py
+1
-1
test22.py
test/fmcadc100m14b4cha/python/test22.py
+126
-25
No files found.
test/fmcadc100m14b4cha/python/fmc_adc_demo.py
View file @
5a6dab83
...
...
@@ -197,7 +197,7 @@ if __name__ == "__main__":
# Load firmware to FPGA
default_directory
=
'.'
path_fpga_loader
=
'../../../gnurabbit/user/fpga_loader'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha
_test
.bin'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha.bin'
;
firmware_loader
=
os
.
path
.
join
(
default_directory
,
path_fpga_loader
)
bitstream
=
os
.
path
.
join
(
default_directory
,
path_firmware
)
print
firmware_loader
+
' '
+
bitstream
...
...
test/fmcadc100m14b4cha/python/test00.py
View file @
5a6dab83
...
...
@@ -43,7 +43,7 @@ CTRL_DAC_CLR_N = (1<<2)
def
main
(
default_directory
=
'.'
):
path_fpga_loader
=
'../../../gnurabbit/user/fpga_loader'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha
_test
.bin'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha.bin'
;
firmware_loader
=
os
.
path
.
join
(
default_directory
,
path_fpga_loader
)
bitstream
=
os
.
path
.
join
(
default_directory
,
path_firmware
)
...
...
test/fmcadc100m14b4cha/python/test08.py
View file @
5a6dab83
...
...
@@ -66,7 +66,7 @@ SW7_TOL = 20000
def
load_firmware
(
default_directory
):
print
(
'Load firmware to FPGA'
)
path_fpga_loader
=
'../../../gnurabbit/user/fpga_loader'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha
_test
.bin'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha.bin'
;
firmware_loader
=
os
.
path
.
join
(
default_directory
,
path_fpga_loader
)
bitstream
=
os
.
path
.
join
(
default_directory
,
path_firmware
)
print
firmware_loader
+
' '
+
bitstream
...
...
test/fmcadc100m14b4cha/python/test09.py
View file @
5a6dab83
...
...
@@ -88,7 +88,7 @@ points = [[10E3 , 0 , 1],
def
load_firmware
(
default_directory
):
print
(
'Load firmware to FPGA'
)
path_fpga_loader
=
'../../../gnurabbit/user/fpga_loader'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha
_test
.bin'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha.bin'
;
firmware_loader
=
os
.
path
.
join
(
default_directory
,
path_fpga_loader
)
bitstream
=
os
.
path
.
join
(
default_directory
,
path_firmware
)
print
firmware_loader
+
' '
+
bitstream
...
...
test/fmcadc100m14b4cha/python/test12.py
View file @
5a6dab83
...
...
@@ -57,7 +57,7 @@ ACQ_LENGTH = 10000 # in samples
def
load_firmware
(
default_directory
):
print
(
'Load firmware to FPGA'
)
path_fpga_loader
=
'../../../gnurabbit/user/fpga_loader'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha
_test
.bin'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha.bin'
;
firmware_loader
=
os
.
path
.
join
(
default_directory
,
path_fpga_loader
)
bitstream
=
os
.
path
.
join
(
default_directory
,
path_firmware
)
print
firmware_loader
+
' '
+
bitstream
...
...
test/fmcadc100m14b4cha/python/test13.py
View file @
5a6dab83
...
...
@@ -31,7 +31,7 @@ FAMILY_CODE = 0x28
def
load_firmware
(
default_directory
):
print
(
'Load firmware to FPGA'
)
path_fpga_loader
=
'../../../gnurabbit/user/fpga_loader'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha
_test
.bin'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha.bin'
;
firmware_loader
=
os
.
path
.
join
(
default_directory
,
path_fpga_loader
)
bitstream
=
os
.
path
.
join
(
default_directory
,
path_firmware
)
print
firmware_loader
+
' '
+
bitstream
...
...
test/fmcadc100m14b4cha/python/test16.py
View file @
5a6dab83
...
...
@@ -60,7 +60,7 @@ STEP_FREQ = 500E3
def
load_firmware
(
default_directory
):
print
(
'Load firmware to FPGA'
)
path_fpga_loader
=
'../../../gnurabbit/user/fpga_loader'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha
_test
.bin'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha.bin'
;
firmware_loader
=
os
.
path
.
join
(
default_directory
,
path_fpga_loader
)
bitstream
=
os
.
path
.
join
(
default_directory
,
path_firmware
)
...
...
test/fmcadc100m14b4cha/python/test17.py
View file @
5a6dab83
...
...
@@ -64,7 +64,7 @@ DAC_FS = 10 # DAC full scale range is 10V
def
load_firmware
(
default_directory
):
print
(
'Load firmware to FPGA'
)
path_fpga_loader
=
'../../../gnurabbit/user/fpga_loader'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha
_test
.bin'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha.bin'
;
firmware_loader
=
os
.
path
.
join
(
default_directory
,
path_fpga_loader
)
bitstream
=
os
.
path
.
join
(
default_directory
,
path_firmware
)
...
...
test/fmcadc100m14b4cha/python/test19.py
View file @
5a6dab83
...
...
@@ -75,7 +75,7 @@ ADC_LSB = {'10V':10.0/2**14, '1V':1.0/2**14, '100mV':0.1/2**14}
def
load_firmware
(
default_directory
):
print
(
'Load firmware to FPGA'
)
path_fpga_loader
=
'../../../gnurabbit/user/fpga_loader'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha
_test
.bin'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha.bin'
;
firmware_loader
=
os
.
path
.
join
(
default_directory
,
path_fpga_loader
)
bitstream
=
os
.
path
.
join
(
default_directory
,
path_firmware
)
print
firmware_loader
+
' '
+
bitstream
+
'
\n
'
...
...
test/fmcadc100m14b4cha/python/test20.py
View file @
5a6dab83
...
...
@@ -76,7 +76,7 @@ DAC_LSB = 10.0/2**16
def
load_firmware
(
default_directory
):
print
"Load firmware to FPGA"
path_fpga_loader
=
'../../../gnurabbit/user/fpga_loader'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha
_test
.bin'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha.bin'
;
firmware_loader
=
os
.
path
.
join
(
default_directory
,
path_fpga_loader
)
bitstream
=
os
.
path
.
join
(
default_directory
,
path_firmware
)
print
firmware_loader
+
' '
+
bitstream
...
...
test/fmcadc100m14b4cha/python/test22.py
View file @
5a6dab83
...
...
@@ -16,7 +16,10 @@ from ptsexcept import *
import
csr
import
fmc_adc
import
spec_fmc_adc
import
calibr_box
import
find_usb_tty
from
PAGE.Agilent33250A
import
*
from
PAGE.SineWaveform
import
*
"""
test13: Test FMC temperature stability
...
...
@@ -24,16 +27,86 @@ test13: Test FMC temperature stability
"""
TEMP_THRES
=
50.0
TEMP_RIPPLE
=
0.5
FIFO_SIZE
=
20
MEAS_SLEEP
=
1
PRE_TRIG_SAMPLES
=
100
POST_TRIG_SAMPLES
=
100000
NB_SHOTS
=
1
ACQ_LENGTH
=
50000
# in samples
NB_CHANNELS
=
4
# Calibration box vendor and product IDs
BOX_USB_VENDOR_ID
=
0x10c4
# Cygnal Integrated Products, Inc.
BOX_USB_PRODUCT_ID
=
0xea60
# CP210x Composite Device
# Agilent AWG serial access vendor and product IDs
AWG_USB_VENDOR_ID
=
0x0403
# Future Technology Devices International, Ltd
AWG_USB_PRODUCT_ID
=
0x6001
# FT232 USB-Serial (UART) IC
AWG_BAUD
=
57600
def
load_firmware
(
default_directory
):
print
(
'Load firmware to FPGA'
)
path_fpga_loader
=
'../../../gnurabbit/user/fpga_loader'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha
_test
.bin'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha.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
);
def
disconnect_channels
(
fmc
):
for
i
in
range
(
1
,
NB_CHANNELS
+
1
):
fmc
.
set_ssr
(
i
,
0x00
)
def
fmc_adc_init
(
spec
,
fmc
,
box
):
print
"
\n
Initialise FMC board
\n
"
# Reset offset DACs
fmc
.
dc_offset_reset
()
# Make sure all switches are OFF
disconnect_channels
(
fmc
)
# Set trigger
fmc
.
set_soft_trig
()
# Set acquisition
fmc
.
set_pre_trig_samples
(
PRE_TRIG_SAMPLES
)
fmc
.
set_post_trig_samples
(
POST_TRIG_SAMPLES
)
fmc
.
set_shots
(
NB_SHOTS
)
# Connect channel 2 to AWG
fmc
.
set_input_range
(
2
,
'10V'
)
fmc
.
set_input_term
(
2
,
'ON'
)
box
.
select_output_ch
(
2
)
def
acq_channels
(
fmc
,
spec_fmc
):
# Make sure no acquisition is running
fmc
.
stop_acq
()
# Start acquisition
fmc
.
start_acq
()
# Trigger
fmc
.
sw_trig
()
# Wait end of acquisition
timeout
=
0
time
.
sleep
(
0.001
)
while
(
'IDLE'
!=
fmc
.
get_acq_fsm_state
()):
time
.
sleep
(
.01
)
timeout
+=
1
if
(
ACQ_TIMEOUT
<
timeout
):
print
"Acquisition timeout. Missing trigger?."
print
"Acq FSm state:
%
s"
%
fmc
.
get_acq_fsm_state
()
return
1
# Retrieve data trough DMA
trig_pos
=
fmc
.
get_trig_pos
()
# Enable "DMA done" iinterrupt
spec_fmc
.
set_irq_en_mask
(
0x1
)
# Read ACQ_LENGTH samples after the trigger for all channels
channels_data
=
spec_fmc
.
get_data
((
trig_pos
<<
3
),
ACQ_LENGTH
*
8
)
# Disable "DMA done" iinterrupt
spec_fmc
.
set_irq_en_mask
(
0x0
)
return
0
def
main
(
default_directory
=
'.'
):
...
...
@@ -44,54 +117,82 @@ def main (default_directory='.'):
spec
=
rr
.
Gennum
()
# bind to the SPEC board
fmc
=
fmc_adc
.
CFmcAdc100Ms
(
spec
)
spec_fmc
=
spec_fmc_adc
.
CSpecFmcAdc100Ms
(
spec
)
usb_tty
=
find_usb_tty
.
CttyUSB
()
awg_tty
=
usb_tty
.
find_usb_tty
(
AWG_USB_VENDOR_ID
,
AWG_USB_PRODUCT_ID
)
box_tty
=
usb_tty
.
find_usb_tty
(
BOX_USB_VENDOR_ID
,
BOX_USB_PRODUCT_ID
)
gen
=
Agilent33250A
(
device
=
awg_tty
[
0
],
bauds
=
AWG_BAUD
)
sine
=
SineWaveform
()
box
=
calibr_box
.
CCalibr_box
(
box_tty
[
0
])
# Initialise fmc adc
fmc_adc_init
(
spec
,
fmc
,
box
)
# Set AWG
sine
.
frequency
=
1E6
sine
.
amplitude
=
8.0
sine
.
dc
=
0
gen
.
connect
()
gen
.
play
(
sine
)
gen
.
output
=
True
print
"
\n
"
# Read SPEC unique ID and print to log
spec_unique_id
=
spec_fmc
.
get_unique_id
()
if
(
spec_unique_id
==
-
1
):
raise
PtsError
(
"Can't read DS18D20 1-wire thermometer on SPEC board."
)
else
:
print
(
'SPEC Unique ID:
%.12
X'
)
%
spec_unique_id
#print "SPEC Unique ID: %.12X" % spec_unique_id
pass
# Read FMC unique ID and print to log
fmc_unique_id
=
fmc
.
get_unique_id
()
if
(
fmc_unique_id
==
-
1
):
raise
PtsError
(
"Can't read DS18D20 1-wire thermometer on SPEC board."
)
else
:
print
(
'FMC Unique ID:
%.12
X'
)
%
fmc_unique_id
#print "FMC Unique ID: %.12X" % fmc_unique_id
pass
# Read SPEC temperature and print to log
spec_temp
=
[]
spec_temp
.
append
(
spec_fmc
.
get_temp
())
print
(
'SPEC temperature:
%3.3
f°C'
)
%
spec_temp
[
-
1
]
print
"SPEC temperature:
%3.3
f°C"
%
spec_temp
[
-
1
]
# Read FMC temperature and print to log
fmc_temp
=
[]
fmc_temp
.
append
(
fmc
.
get_temp
())
print
(
'FMC temperature:
%3.3
f°C'
)
%
fmc_temp
[
-
1
]
print
"FMC temperature:
%3.3
f°C"
%
fmc_temp
[
-
1
]
fmc_temp_sum
=
0
# Wait for the FMC temperature to reach threshold
print
"
\n
Wait for FMC temperature to reach
%2.1
f°C"
%
TEMP_THRES
t0
=
time
.
time
()
while
fmc_temp
[
-
1
]
<
TEMP_THRES
:
fmc_temp
.
append
(
fmc
.
get_temp
())
#print "FMC temperature: %3.3f°C" % fmc_temp[-1]
fmc_temp
.
pop
(
0
)
acq_channels
(
fmc
,
spec_fmc
)
time
.
sleep
(
MEAS_SLEEP
)
t1
=
time
.
time
()
print
"FMC temperature reached
%2.1
f°C after
%10.3
fs
\n
"
%
(
TEMP_THRES
,
t1
-
t0
)
# Wait for the FMC temperature to be stable
fmc_temp_cnt
=
0
MAX_DIFF
=
0.2
start_time
=
int
(
time
.
time
())
while
True
:
#spec_temp.append(spec_fmc.get_temp())
fmc_temp
.
append
(
fmc
.
get_temp
())
fmc_temp_cnt
+=
1
if
fmc_temp_cnt
<
50
:
fmc_temp_sum
+=
fmc_temp
[
-
1
]
fmc_temp_avg
=
(
fmc_temp_sum
/
fmc_temp_cnt
)
if
fmc_temp_cnt
>
FIFO_SIZE
:
temp_diff
=
(
max
(
fmc_temp
)
-
min
(
fmc_temp
))
fmc_temp
.
pop
(
0
)
print
"
%4
d fmc temp:
%3.3
f°C temp diff:
%3.3
f°C"
%
(
fmc_temp_cnt
,
fmc_temp
[
-
1
],
temp_diff
)
if
temp_diff
<
TEMP_RIPPLE
:
print
"
\n
Temperature difference in the last
%
d measurements is less than
%2.1
f°C"
%
(
FIFO_SIZE
,
TEMP_RIPPLE
)
break
else
:
fmc_temp_sum
=
sum
(
fmc_temp
[
-
50
:])
fmc_temp_avg
=
(
fmc_temp_sum
/
50
)
temp_diff
=
abs
(
fmc_temp_avg
-
fmc_temp
[
-
1
])
print
"
%4
d fmc temp:
%3.3
f°C average:
%3.3
f°C temp diff:
%3.3
f°C"
%
(
fmc_temp_cnt
,
fmc_temp
[
-
1
],
fmc_temp_avg
,
temp_diff
)
if
fmc_temp_cnt
>
20
:
if
temp_diff
<
MAX_DIFF
:
pass
#break
time
.
sleep
(
2
)
end_time
=
int
(
time
.
time
())
time_diff
=
end_time
-
start_time
print
"FMC temperature is stable after
%
ds"
%
time_diff
print
"
%4
d fmc temp:
%3.3
f°C"
%
(
fmc_temp_cnt
,
fmc_temp
[
-
1
])
fmc_temp_cnt
+=
1
acq_channels
(
fmc
,
spec_fmc
)
time
.
sleep
(
MEAS_SLEEP
)
t2
=
time
.
time
()
print
"FMC temperature is stable after
%10.3
fs"
%
(
t2
-
t0
)
...
...
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