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
d33afd51
Commit
d33afd51
authored
Jun 05, 2012
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test20: Takes calibration data in the FMC EEPROM instead of in a file.
parent
b90d69da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
19 deletions
+17
-19
test20.py
test/fmcadc100m14b4cha/python/test20.py
+17
-19
No files found.
test/fmcadc100m14b4cha/python/test20.py
View file @
d33afd51
...
...
@@ -297,11 +297,10 @@ def main (default_directory = '.'):
for
item
in
box_calibr_data
.
iteritems
():
print
"
%5
s:
%1.5
fV"
%
(
item
[
0
],
float
(
item
[
1
]))
#---------------------------------------------------------------------------
# Get ADC
and DAC offset and gain correction parameters
# Get ADC and DAC offset and gain correction parameters
#---------------------------------------------------------------------------
print
"
\n
Read calibration data from
file
:"
print
"
\n
Read calibration data from
FMC EEPROM
:"
adc_corr_data
=
{
'10V'
:{
'offset'
:[],
'gain'
:[]},
'1V'
:{
'offset'
:[],
'gain'
:[]},
...
...
@@ -311,17 +310,16 @@ def main (default_directory = '.'):
'1V'
:{
'offset'
:[],
'gain'
:[]},
'100mV'
:{
'offset'
:[],
'gain'
:[]}}
"""
# Read calibration data from file
all_corr_data = []
in_filename = CALIBR_FILENAME
f_in = open(in_filename,"r+")
for line in f_in:
all_corr_data.append(int(line,16))
#
print "0x%04X" % all_corr_data[-1]
print "0x
%04
X"
%
all_corr_data[-1]
f_in.close()
for
item
in
all_corr_data
:
print
"0x
%04
X"
%
item
"""
# Read entire EEPROM
eeprom_data_read
=
fmc
.
sys_i2c_eeprom_read
(
0
,
EEPROM_SIZE
)
...
...
@@ -335,20 +333,21 @@ def main (default_directory = '.'):
# Get calibration data
print
"Get calibration data from EEPROM."
eeprom_data
=
open
(
EEPROM_BIN_FILENAME
,
"rb"
)
.
read
()
eeprom_corr
_data
=
ipmi_get_internal_use_data
(
eeprom_data
)
int_use
_data
=
ipmi_get_internal_use_data
(
eeprom_data
)
#print "Calibration data length (bytes): %d" % len(eeprom_corr_data)
print
"correction data from eeprom"
print
eeprom_corr_data
#for item in eeprom_corr_data:
# print "0x%s" % item
# Re-arrange correction data into 16-bit number (from bytes)
eeprom_corr_data
=
[]
for
i
in
range
(
0
,
len
(
int_use_data
),
2
):
eeprom_corr_data
.
append
((
int_use_data
[
i
+
1
]
<<
8
)
+
(
int_use_data
[
i
]))
print
"Calibration data length (16-bit):
%
d"
%
len
(
eeprom_corr_data
)
print
"Correction data from eeprom:"
print
"
\n
Get ADC correctioon parameters:"
for
IN_RANGE
in
RANGES
:
for
ch
in
range
(
NB_CHANNELS
):
adc_corr_data
[
IN_RANGE
][
'offset'
]
.
append
(
hex2signed
(
all
_corr_data
.
pop
(
0
)))
adc_corr_data
[
IN_RANGE
][
'offset'
]
.
append
(
hex2signed
(
eeprom
_corr_data
.
pop
(
0
)))
for
ch
in
range
(
NB_CHANNELS
):
adc_corr_data
[
IN_RANGE
][
'gain'
]
.
append
(
all
_corr_data
.
pop
(
0
))
adc_corr_data
[
IN_RANGE
][
'gain'
]
.
append
(
eeprom
_corr_data
.
pop
(
0
))
for
ranges
in
adc_corr_data
.
iteritems
():
print
"
%
s:"
%
ranges
[
0
]
...
...
@@ -362,9 +361,9 @@ def main (default_directory = '.'):
print
"
\n
Get DAC correctioon parameters:"
for
IN_RANGE
in
RANGES
:
for
ch
in
range
(
NB_CHANNELS
):
dac_corr_data
[
IN_RANGE
][
'offset'
]
.
append
(
hex2signed
(
all
_corr_data
.
pop
(
0
)))
dac_corr_data
[
IN_RANGE
][
'offset'
]
.
append
(
hex2signed
(
eeprom
_corr_data
.
pop
(
0
)))
for
ch
in
range
(
NB_CHANNELS
):
dac_corr_data
[
IN_RANGE
][
'gain'
]
.
append
(
all
_corr_data
.
pop
(
0
))
dac_corr_data
[
IN_RANGE
][
'gain'
]
.
append
(
eeprom
_corr_data
.
pop
(
0
))
for
ranges
in
dac_corr_data
.
iteritems
():
print
"
%
s:"
%
ranges
[
0
]
...
...
@@ -381,7 +380,6 @@ def main (default_directory = '.'):
print
"
\n
Apply DAC correction
\n
"
fmc
.
set_dac_corr
(
dac_corr_data
)
#---------------------------------------------------------------------------
# ADC Calibration verification
#---------------------------------------------------------------------------
...
...
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