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
652fe9d6
Commit
652fe9d6
authored
Apr 24, 2014
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test40: Fix hex2signed function, selects right box output channel, prints more info.
parent
ed3b3880
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
test40.py
test/fmcadc100m14b4cha/python/test40.py
+16
-10
No files found.
test/fmcadc100m14b4cha/python/test40.py
View file @
652fe9d6
...
@@ -61,7 +61,7 @@ BYTES_PER_SAMPLE = 2
...
@@ -61,7 +61,7 @@ BYTES_PER_SAMPLE = 2
TRIG_THRES_VOLT
=
0.007
TRIG_THRES_VOLT
=
0.007
TRIG_THRES_FILT
=
20
TRIG_THRES_FILT
=
20
INT_TRIG_TEST_MODE
=
Tru
e
INT_TRIG_TEST_MODE
=
Fals
e
TRIG_DEL
=
0
# in samples
TRIG_DEL
=
0
# in samples
...
@@ -89,9 +89,9 @@ def fmc_adc_init(spec, fmc):
...
@@ -89,9 +89,9 @@ def fmc_adc_init(spec, fmc):
# Converts two's complement hex to signed
# Converts two's complement hex to signed
def
hex2signed
(
value
):
def
hex2signed
(
value
):
if
(
value
&
0x8000
):
if
(
value
&
0x8000
):
return
-
((
~
value
&
0xFFF
C
)
+
1
)
return
-
((
~
value
&
0xFFF
F
)
+
1
)
else
:
else
:
return
(
value
&
0xFFF
C
)
return
(
value
&
0xFFF
F
)
# Converts digital value to volts
# Converts digital value to volts
def
digital2volt
(
value
,
full_scale
,
nb_bit
):
def
digital2volt
(
value
,
full_scale
,
nb_bit
):
...
@@ -136,7 +136,7 @@ def acq_channels(fmc, carrier, adc_fs, pause):
...
@@ -136,7 +136,7 @@ def acq_channels(fmc, carrier, adc_fs, pause):
if
(
ACQ_TIMEOUT
<
timeout
):
if
(
ACQ_TIMEOUT
<
timeout
):
print
"Acquisition timeout. Missing trigger?."
print
"Acquisition timeout. Missing trigger?."
print
"Acq FSm state:
%
s"
%
fmc
.
get_acq_fsm_state
()
print
"Acq FSm state:
%
s"
%
fmc
.
get_acq_fsm_state
()
return
1
sys
.
exit
()
# Retrieve data trough DMA
# Retrieve data trough DMA
trig_pos
=
fmc
.
get_trig_pos
()
trig_pos
=
fmc
.
get_trig_pos
()
# Enable "DMA done" interrupt
# Enable "DMA done" interrupt
...
@@ -285,6 +285,8 @@ def main (default_directory='.'):
...
@@ -285,6 +285,8 @@ def main (default_directory='.'):
# Internal trigger test mode
# Internal trigger test mode
if
INT_TRIG_TEST_MODE
==
True
:
if
INT_TRIG_TEST_MODE
==
True
:
print
(
"
\n
=================================================="
)
print
(
"Internal trigger test mode ENABLED!"
)
fmc
.
int_trig_tst_en
()
fmc
.
int_trig_tst_en
()
##################################################
##################################################
...
@@ -299,26 +301,28 @@ def main (default_directory='.'):
...
@@ -299,26 +301,28 @@ def main (default_directory='.'):
fmc
.
set_trig_config
(
trig_hw_sel
,
trig_hw_pol
,
trig_hw_en
,
trig_sw_en
,
trig_channel
,
trig_thres
,
TRIG_DEL
,
TRIG_THRES_FILT
)
fmc
.
set_trig_config
(
trig_hw_sel
,
trig_hw_pol
,
trig_hw_en
,
trig_sw_en
,
trig_channel
,
trig_thres
,
TRIG_DEL
,
TRIG_THRES_FILT
)
print
(
"=================================================="
)
print
(
"=================================================="
)
print
(
"Channel:
%
d
\n
Input range:
%
s
\n
Input term:
%
s
\n
Trigger threshold:
%
1.1
fV
\n
Trigger threshold filter:
%
d
\n
Trigger delay:
%
d"
%
(
CHANNEL
,
IN_RANGE
,
IN_TERM
,
TRIG_THRES_VOLT
,
TRIG_THRES_FILT
,
TRIG_DEL
))
print
(
"Channel:
%
d
\n
Input range:
%
s
\n
Input term:
%
s
\n
Trigger threshold:
%
2.4
fV
\n
Trigger threshold filter:
%
d
\n
Trigger delay:
%
d"
%
(
CHANNEL
,
IN_RANGE
,
IN_TERM
,
TRIG_THRES_VOLT
,
TRIG_THRES_FILT
,
TRIG_DEL
))
print
(
"=================================================="
)
print
(
"=================================================="
)
# Print configuration
# Print configuration
fmc
.
print_adc_core_config
()
#time.sleep(3)
#fmc.print_adc_core_config()
##################################################
##################################################
# Set awg sine params
# Set awg sine params
##################################################
##################################################
sine
.
frequency
=
1
0E3
sine
.
frequency
=
2
0E3
sine
.
amplitude
=
0.4
*
ADC_FS
[
IN_RANGE
]
sine
.
amplitude
=
0.4
*
ADC_FS
[
IN_RANGE
]
sine
.
dc
=
0
sine
.
dc
=
0
print
"
\n
Sine frequency:
%3.3
fMHz amplitude:
%2.3
fVp offset:
%2.3
fV"
%
(
sine
.
frequency
/
1E6
,
sine
.
amplitude
,
sine
.
dc
)
print
"
\n
Sine frequency:
%3.3
fMHz amplitude:
%2.3
fVp offset:
%2.3
fV"
%
(
sine
.
frequency
/
1E6
,
sine
.
amplitude
,
sine
.
dc
)
# Set AWG
# Set AWG
gen
.
connect
()
gen
.
connect
()
gen
.
play
(
sine
)
gen
.
play
(
sine
)
gen
.
output
=
True
gen
.
output
=
True
time
.
sleep
(
AWG_SET_SLEEP
)
time
.
sleep
(
AWG_SET_SLEEP
)
print
(
"Can use <pd-extended> to generate noisy sinewave from a soundcard (see sine_noise.pd)."
)
##################################################
##################################################
# Configure analogue input
# Configure analogue input
##################################################
##################################################
...
@@ -327,8 +331,8 @@ def main (default_directory='.'):
...
@@ -327,8 +331,8 @@ def main (default_directory='.'):
time
.
sleep
(
SSR_SET_SLEEP
)
time
.
sleep
(
SSR_SET_SLEEP
)
# connect AWG to current channel
# connect AWG to current channel
#
box.select_output_ch(CHANNEL)
box
.
select_output_ch
(
CHANNEL
)
#
time.sleep(BOX_SET_SLEEP)
time
.
sleep
(
BOX_SET_SLEEP
)
##################################################
##################################################
# Apply gain and offset correction
# Apply gain and offset correction
...
@@ -430,6 +434,8 @@ def main (default_directory='.'):
...
@@ -430,6 +434,8 @@ def main (default_directory='.'):
g
=
adc_corr_data
[
IN_RANGE
][
'gain'
][
CHANNEL
-
1
]
g
=
adc_corr_data
[
IN_RANGE
][
'gain'
][
CHANNEL
-
1
]
o
=
adc_corr_data
[
IN_RANGE
][
'offset'
][
CHANNEL
-
1
]
o
=
adc_corr_data
[
IN_RANGE
][
'offset'
][
CHANNEL
-
1
]
#g = 0x8000
#o = 0
#print "\nApply ADC offset correction: gain=0x%04X, offset=0x%04X" %(g, o)
#print "\nApply ADC offset correction: gain=0x%04X, offset=0x%04X" %(g, o)
fmc
.
set_adc_gain_offset_corr
(
CHANNEL
,
g
,
o
)
fmc
.
set_adc_gain_offset_corr
(
CHANNEL
,
g
,
o
)
...
...
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