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
c6e7ec5e
Commit
c6e7ec5e
authored
Jul 11, 2012
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fmc_adc_demo: Modify fmc_adc_demo GUI to use the common classes.
parent
4f7c74c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
23 deletions
+42
-23
fmc_adc_demo.py
test/fmcadc100m14b4cha/python/fmc_adc_demo.py
+42
-23
No files found.
test/fmcadc100m14b4cha/python/fmc_adc_demo.py
View file @
c6e7ec5e
#!
/usr/bin/
python
#!
/usr/bin/env
python
# coding: utf8
# Copyright CERN, 2011
# Author: Matthieu Cattin <matthieu.cattin@cern.ch>
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Last modifications: 10/5/2012
# Import system modules
import
sys
import
rr
import
time
import
os
import
math
# Add common modules and libraries location to path
sys
.
path
.
append
(
'../../../'
)
sys
.
path
.
append
(
'../../../gnurabbit/python/'
)
sys
.
path
.
append
(
'../../../common/'
)
# Import common modules
from
ptsexcept
import
*
import
rr
# Import specific modules
from
fmc_adc_spec
import
*
from
fmc_adc
import
*
from
numpy
import
*
from
pylab
import
*
...
...
@@ -17,8 +36,8 @@ import PyQt4.uic
from
PyQt4.QtGui
import
*
from
PyQt4.QtCore
import
*
import
fmc_adc
import
spec_fmc_adc
#
import fmc_adc
#
import spec_fmc_adc
from
PAGE.Agilent33250A
import
*
from
PAGE.SineWaveform
import
*
...
...
@@ -64,15 +83,15 @@ def acq_plot():
carrier_addr
=
((
trig_pos
-
pre_trig
+
1
)
<<
3
)
print
(
'trig_pos:
%.8
X (
%
d) pre_trig:
%.8
X (
%
d)'
)
%
(
trig_pos
,
trig_pos
,
pre_trig
,
pre_trig
)
print
(
'carrier addr:
%.8
X (
%
d)'
)
%
(
carrier_addr
,
carrier_addr
)
channels_data
=
spec_fmc
.
get_data
(
carrier_addr
,
(
NB_POINTS
*
8
))
channels_data
=
carrier
.
get_data
(
carrier_addr
,
(
NB_POINTS
*
8
))
else
:
print
(
'Multi-shot acq'
)
channels_data
=
spec_fmc
.
get_data
(
0
,
(
NB_POINTS
*
8
))
channels_data
=
carrier
.
get_data
(
0
,
(
NB_POINTS
*
8
))
channels_data
=
[
hex2signed
(
item
)
for
item
in
channels_data
]
channels_data
=
[
digital2volt
(
item
,
ADC_FS
,
ADC_NBITS
)
for
item
in
channels_data
]
#channels_data =
spec_fmc
.get_data(0, (NB_POINTS*8))
#channels_data =
carrier
.get_data(0, (NB_POINTS*8))
print
(
'Nb points:
%
d'
)
%
NB_POINTS
print
(
'channels data length:
%
d'
)
%
len
(
channels_data
)
sample
=
arange
(
len
(
channels_data
)
/
4
)
...
...
@@ -106,7 +125,7 @@ def update_chan_cfg(channel):
def
update_trig_cfg
():
print
(
'Update trigger configuration'
)
int_thres
=
m
.
int_trig_thres
.
value
()
int_sel
=
m
.
int_trig_sel
.
currentIndex
()
int_sel
=
m
.
int_trig_sel
.
currentIndex
()
+
1
hw_sel
=
m
.
hw_trig_sel
.
currentIndex
()
hw_pol
=
m
.
hw_trig_pol
.
currentIndex
()
hw_en
=
bool
(
m
.
hw_trig_en
.
checkState
())
...
...
@@ -115,7 +134,7 @@ def update_trig_cfg():
print
(
'int_thres:
%
d int_sel:
%
d hw_sel:
%
d hw_pol:
%
d hw_en:
%
d sw_en:
%
d delay:
%
d'
)
%
(
int_thres
,
int_sel
,
hw_sel
,
hw_pol
,
hw_en
,
sw_en
,
delay
)
fmc
.
set_trig_config
(
hw_sel
,
hw_pol
,
hw_en
,
sw_en
,
int_sel
,
int_thres
,
delay
)
#fmc.print_adc_core_config()
#
spec_fmc
.print_csr()
#
carrier
.print_csr()
def
update_acq_cfg
():
print
(
'Update acquisition configuration'
)
...
...
@@ -147,7 +166,7 @@ def on_stop_acq():
def
on_acq_data
():
print
(
'ACQ DATA'
)
#
spec_fmc
.wait_end_acq()
#
carrier
.wait_end_acq()
acq_plot
()
def
on_reset_offset
():
...
...
@@ -167,16 +186,16 @@ def poll_timer_cb():
m
.
ch2_value
.
setText
(
str
(
fmc
.
get_current_adc_value
(
2
)))
m
.
ch3_value
.
setText
(
str
(
fmc
.
get_current_adc_value
(
3
)))
m
.
ch4_value
.
setText
(
str
(
fmc
.
get_current_adc_value
(
4
)))
temp
=
"
%3.3
f"
%
spec_fmc
.
get_temp
()
temp
=
"
%3.3
f"
%
carrier
.
get_temp
()
temp
+=
u'
\u00B0
'
+
'C'
m
.
carrier_temp
.
setText
(
temp
)
temp
=
"
%3.3
f"
%
fmc
.
get_temp
()
temp
+=
u'
\u00B0
'
+
'C'
m
.
mezz_temp
.
setText
(
temp
)
trig_tag
=
spec_fmc
.
get_utc_trig_tag
()
start_tag
=
spec_fmc
.
get_utc_start_tag
()
stop_tag
=
spec_fmc
.
get_utc_stop_tag
()
end_tag
=
spec_fmc
.
get_utc_end_tag
()
trig_tag
=
carrier
.
get_utc_trig_tag
()
start_tag
=
carrier
.
get_utc_start_tag
()
stop_tag
=
carrier
.
get_utc_stop_tag
()
end_tag
=
carrier
.
get_utc_end_tag
()
trig_tag_s
=
"
%09
d.
%010
d s"
%
(
trig_tag
[
2
],(
trig_tag
[
3
]
*
8
))
start_tag_s
=
"
%09
d.
%010
d s"
%
(
start_tag
[
2
],(
start_tag
[
3
]
*
8
))
stop_tag_s
=
"
%09
d.
%010
d s"
%
(
stop_tag
[
2
],(
stop_tag
[
3
]
*
8
))
...
...
@@ -197,7 +216,7 @@ if __name__ == "__main__":
# Load firmware to FPGA
default_directory
=
'.'
path_fpga_loader
=
'../../../gnurabbit/user/fpga_loader'
;
path_firmware
=
'../firmwares/spec_fmcadc100m14b4cha.bin'
;
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
...
...
@@ -206,22 +225,22 @@ if __name__ == "__main__":
# Objects declaration
spec
=
rr
.
Gennum
()
# bind to the SPEC board
fmc
=
fmc_adc
.
CFmcAdc100Ms
(
spec
)
fmc
=
CFmcAdc100m
(
spec
)
gen
=
Agilent33250A
(
device
=
USB_DEVICE
,
bauds
=
RS232_BAUD
)
sine
=
SineWaveform
()
spec_fmc
=
spec_fmc_adc
.
CSpecFmcAdc100Ms
(
spec
)
carrier
=
CFmcAdc100mSpec
(
spec
,
0x1
)
# Enable DMA interrupts (finished, error)
spec_fmc
.
set_irq_en_mask
(
0x3
)
carrier
.
set_irq_en_mask
(
0x3
)
# Set UTC
current_time
=
time
.
time
()
utc_seconds
=
int
(
current_time
)
spec_fmc
.
set_utc_second_cnt
(
utc_seconds
)
#print('UTC core seconds counter: %d')%
spec_fmc
.get_utc_second_cnt()
carrier
.
set_utc_second_cnt
(
utc_seconds
)
#print('UTC core seconds counter: %d')%
carrier
.get_utc_second_cnt()
utc_coarse
=
int
((
current_time
-
utc_seconds
)
/
8E-9
)
spec_fmc
.
set_utc_coarse_cnt
(
utc_coarse
)
#print('UTC core coarse counter: %d')%
spec_fmc
.get_utc_coarse_cnt()
carrier
.
set_utc_coarse_cnt
(
utc_coarse
)
#print('UTC core coarse counter: %d')%
carrier
.get_utc_coarse_cnt()
# Variables from GUI
ch_range
=
[
m
.
ch1_range
,
m
.
ch2_range
,
m
.
ch3_range
,
m
.
ch4_range
]
...
...
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