Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Production Test Suite
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
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
Production Test Suite
Commits
1c58faa2
Commit
1c58faa2
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
0377f85e
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 @
1c58faa2
...
...
@@ -61,7 +61,7 @@ BYTES_PER_SAMPLE = 2
TRIG_THRES_VOLT
=
0.007
TRIG_THRES_FILT
=
20
INT_TRIG_TEST_MODE
=
Tru
e
INT_TRIG_TEST_MODE
=
Fals
e
TRIG_DEL
=
0
# in samples
...
...
@@ -89,9 +89,9 @@ def fmc_adc_init(spec, fmc):
# Converts two's complement hex to signed
def
hex2signed
(
value
):
if
(
value
&
0x8000
):
return
-
((
~
value
&
0xFFF
C
)
+
1
)
return
-
((
~
value
&
0xFFF
F
)
+
1
)
else
:
return
(
value
&
0xFFF
C
)
return
(
value
&
0xFFF
F
)
# Converts digital value to volts
def
digital2volt
(
value
,
full_scale
,
nb_bit
):
...
...
@@ -136,7 +136,7 @@ def acq_channels(fmc, carrier, adc_fs, pause):
if
(
ACQ_TIMEOUT
<
timeout
):
print
"Acquisition timeout. Missing trigger?."
print
"Acq FSm state:
%
s"
%
fmc
.
get_acq_fsm_state
()
return
1
sys
.
exit
()
# Retrieve data trough DMA
trig_pos
=
fmc
.
get_trig_pos
()
# Enable "DMA done" interrupt
...
...
@@ -285,6 +285,8 @@ def main (default_directory='.'):
# Internal trigger test mode
if
INT_TRIG_TEST_MODE
==
True
:
print
(
"
\n
=================================================="
)
print
(
"Internal trigger test mode ENABLED!"
)
fmc
.
int_trig_tst_en
()
##################################################
...
...
@@ -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
)
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 configuration
fmc
.
print_adc_core_config
()
#time.sleep(3)
#fmc.print_adc_core_config()
##################################################
# Set awg sine params
##################################################
sine
.
frequency
=
1
0E3
sine
.
frequency
=
2
0E3
sine
.
amplitude
=
0.4
*
ADC_FS
[
IN_RANGE
]
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
)
# Set AWG
gen
.
connect
()
gen
.
play
(
sine
)
gen
.
output
=
True
time
.
sleep
(
AWG_SET_SLEEP
)
print
(
"Can use <pd-extended> to generate noisy sinewave from a soundcard (see sine_noise.pd)."
)
##################################################
# Configure analogue input
##################################################
...
...
@@ -327,8 +331,8 @@ def main (default_directory='.'):
time
.
sleep
(
SSR_SET_SLEEP
)
# connect AWG to current channel
#
box.select_output_ch(CHANNEL)
#
time.sleep(BOX_SET_SLEEP)
box
.
select_output_ch
(
CHANNEL
)
time
.
sleep
(
BOX_SET_SLEEP
)
##################################################
# Apply gain and offset correction
...
...
@@ -430,6 +434,8 @@ def main (default_directory='.'):
g
=
adc_corr_data
[
IN_RANGE
][
'gain'
][
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)
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