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
81fcdf9f
Commit
81fcdf9f
authored
Jan 11, 2012
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add eeprom data formating, write and verify. Still to be tested.
parent
a727b2ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
13 deletions
+28
-13
test19.py
test/fmcadc100m14b4cha/python/test19.py
+28
-13
No files found.
test/fmcadc100m14b4cha/python/test19.py
View file @
81fcdf9f
...
...
@@ -261,9 +261,9 @@ def dump_file_to_eeprom(fmc, filename):
f
=
open
(
filename
,
"r+"
)
for
line
in
f
:
addr
,
data
=
line
.
split
()
eeprom_content
=
(
int
(
data
,
2
)
&
0xFF
)
eeprom_addr
=
(
int
(
addr
,
2
))
fmc
.
sys_i2c_eeprom_write
(
eeprom_addr
,[
eeprom_content
]
)
eeprom_content
.
append
(
int
(
data
,
2
)
)
eeprom_addr
.
append
(
int
(
addr
,
2
))
fmc
.
sys_i2c_eeprom_write
(
eeprom_addr
[
0
],
eeprom_content
)
return
0
...
...
@@ -676,43 +676,58 @@ def main (default_directory = '.'):
############################################################################
# Write correction data tp file
############################################################################
filename
=
"test19_corr_data.txt"
f
ile
=
open
(
filename
,
'w'
)
out_
filename
=
"test19_corr_data.txt"
f
_out
=
open
(
out_
filename
,
'w'
)
# 10V range
print
"10V range"
for
item
in
adc_corr_data
[
'10V'
][
'offset'
]:
print
'0x
%.4
X,yes'
%
(
signed2hex
(
item
))
f
ile
.
write
(
'0x
%.4
X,yes
\n
'
%
(
signed2hex
(
item
)))
f
_out
.
write
(
'0x
%.4
X,yes
\n
'
%
(
signed2hex
(
item
)))
for
item
in
adc_corr_data
[
'10V'
][
'gain'
]:
print
'0x
%.4
X,yes'
%
(
signed2hex
(
item
))
f
ile
.
write
(
'0x
%.4
X,yes
\n
'
%
(
signed2hex
(
item
)))
f
_out
.
write
(
'0x
%.4
X,yes
\n
'
%
(
signed2hex
(
item
)))
# 1V range
print
"1V range"
for
item
in
adc_corr_data
[
'1V'
][
'offset'
]:
print
'0x
%.4
X,yes'
%
(
signed2hex
(
item
))
f
ile
.
write
(
'0x
%.4
X,yes
\n
'
%
(
signed2hex
(
item
)))
f
_out
.
write
(
'0x
%.4
X,yes
\n
'
%
(
signed2hex
(
item
)))
for
item
in
adc_corr_data
[
'1V'
][
'gain'
]:
print
'0x
%.4
X,yes'
%
(
signed2hex
(
item
))
f
ile
.
write
(
'0x
%.4
X,yes
\n
'
%
(
signed2hex
(
item
)))
f
_out
.
write
(
'0x
%.4
X,yes
\n
'
%
(
signed2hex
(
item
)))
# 100mV range
print
"100mV range"
for
item
in
adc_corr_data
[
'100mV'
][
'offset'
]:
print
'0x
%.4
X,yes'
%
(
signed2hex
(
item
))
f
ile
.
write
(
'0x
%.4
X,yes
\n
'
%
(
signed2hex
(
item
)))
f
_out
.
write
(
'0x
%.4
X,yes
\n
'
%
(
signed2hex
(
item
)))
for
item
in
adc_corr_data
[
'100mV'
][
'gain'
]:
print
'0x
%.4
X,yes'
%
(
signed2hex
(
item
))
f
ile
.
write
(
'0x
%.4
X,yes
\n
'
%
(
signed2hex
(
item
)))
f
_out
.
write
(
'0x
%.4
X,yes
\n
'
%
(
signed2hex
(
item
)))
############################################################################
# Format FMC EEPROM data
############################################################################
os
.
system
(
"python ../../fmceeprom/python/fmc_eeprom_gen.py -i ../../fmceeprom/python/eeprom_input.xml -o test19_formatted_data.txt -r test19_corr_data.txt"
)
############################################################################
# Write data to FMC EEPROM
############################################################################
in_filename
=
"test19_formatted_data.txt"
eeprom_content
=
[]
eeprom_addr
=
[]
f_in
=
open
(
in_filename
,
"r+"
)
for
line
in
f_in
:
addr
,
data
=
line
.
split
()
eeprom_content
.
append
(
int
(
data
,
2
))
eeprom_addr
.
append
(
int
(
addr
,
2
))
fmc
.
sys_i2c_eeprom_write
(
eeprom_addr
[
0
],
eeprom_content
)
############################################################################
# Verify EEPROM data
############################################################################
eeprom_content_read
=
fmc
.
sys_i2c_eeprom_read
(
eeprom_addr
[
0
],
len
(
eeprom_content
))
for
i
in
len
(
eeprom_content
):
if
eeprom_content
[
i
]
!=
eeprom_content_read
[
i
]:
print
"[ERROR] eeprom data corruption @ addr:
%
d expect:0x
%.2
X read:0x
%.2
X"
%
(
i
,
eeprom_content
[
i
],
eeprom_content_read
[
i
])
# Open all switches, reset offset DAC to mid-scale (0V)
...
...
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