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
98c5a3ef
Commit
98c5a3ef
authored
Feb 03, 2015
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test02: Save eeprom content before test and restore it after. Test area at offset 0x1000.
parent
4bf4e899
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
test02.py
tests/test02.py
+22
-6
No files found.
tests/test02.py
View file @
98c5a3ef
...
@@ -27,13 +27,17 @@ test02: Test EEPROM access
...
@@ -27,13 +27,17 @@ test02: Test EEPROM access
Note: Requires test00.py to run first to load the gateware!
Note: Requires test00.py to run first to load the gateware!
"""
"""
def
pattern_compare
(
fmc
,
pattern
):
def
pattern_compare
(
fmc
,
offset
,
pattern
):
print
"Write data pattern to EEPROM
\n
"
print
"Write data pattern to EEPROM
at offset 0x
%4
X
\n
"
%
offset
#print [hex(a) for a in pattern]
#print [hex(a) for a in pattern]
fmc
.
sys_i2c_eeprom_write
(
pattern
)
#fmc.sys_i2c_eeprom_write(pattern)
fmc
.
eeprom_24aa64
.
wr_page
(
offset
,
pattern
)
time
.
sleep
(
0.1
)
print
"Read back data from EEPROM
\n
"
print
"Read back data from EEPROM
\n
"
rd_pattern
=
fmc
.
sys_i2c_eeprom_read
(
0x0
,
len
(
pattern
))
#
rd_pattern = fmc.sys_i2c_eeprom_read(0x0, len(pattern))
#print [hex(a) for a in rd_pattern]
#print [hex(a) for a in rd_pattern]
rd_pattern
=
fmc
.
eeprom_24aa64
.
rd_seq
(
offset
,
len
(
pattern
))
time
.
sleep
(
0.1
)
print
"Data comparison:"
print
"Data comparison:"
print
"written read => result"
print
"written read => result"
mismatch
=
0
mismatch
=
0
...
@@ -55,6 +59,7 @@ def main (default_directory='.'):
...
@@ -55,6 +59,7 @@ def main (default_directory='.'):
EEPROM_ADDR
=
0x50
EEPROM_ADDR
=
0x50
PATTERN_A
=
[
0x55
,
0xAA
,
0x00
,
0xFF
]
PATTERN_A
=
[
0x55
,
0xAA
,
0x00
,
0xFF
]
PATTERN_B
=
[
0xAA
,
0x55
,
0xFF
,
0x00
]
PATTERN_B
=
[
0xAA
,
0x55
,
0xFF
,
0x00
]
WRITE_OFFSET
=
0x1000
start_test_time
=
time
.
time
()
start_test_time
=
time
.
time
()
...
@@ -91,11 +96,18 @@ def main (default_directory='.'):
...
@@ -91,11 +96,18 @@ def main (default_directory='.'):
if
(
EEPROM_ADDR
!=
periph_addr
[
0
]):
if
(
EEPROM_ADDR
!=
periph_addr
[
0
]):
error
=
"Wrong device mounted on system management I2C bus or soldering issues, address is:0x
%.2
X expected:0x
%.2
X"
%
(
periph_addr
[
0
],
EEPROM_ADDR
)
error
=
"Wrong device mounted on system management I2C bus or soldering issues, address is:0x
%.2
X expected:0x
%.2
X"
%
(
periph_addr
[
0
],
EEPROM_ADDR
)
# Save content of the area used for the test
print
(
'Saving test area eeprom content.'
)
area_content
=
fmc
.
eeprom_24aa64
.
rd_seq
(
WRITE_OFFSET
,
len
(
PATTERN_A
))
time
.
sleep
(
0.1
)
print
[(
"0x
%02
X"
%
a
)
for
a
in
area_content
]
print
(
''
)
# Write, read back and compare two different patterns
# Write, read back and compare two different patterns
try
:
try
:
mismatch
=
0
mismatch
=
0
mismatch
+=
pattern_compare
(
fmc
,
PATTERN_A
)
mismatch
+=
pattern_compare
(
fmc
,
WRITE_OFFSET
,
PATTERN_A
)
mismatch
+=
pattern_compare
(
fmc
,
PATTERN_B
)
mismatch
+=
pattern_compare
(
fmc
,
WRITE_OFFSET
,
PATTERN_B
)
except
FmcAdc100mOperationError
as
e
:
except
FmcAdc100mOperationError
as
e
:
raise
PtsError
(
"EEPROM write/read/compare test failed:
%
s"
%
e
)
raise
PtsError
(
"EEPROM write/read/compare test failed:
%
s"
%
e
)
...
@@ -104,6 +116,10 @@ def main (default_directory='.'):
...
@@ -104,6 +116,10 @@ def main (default_directory='.'):
else
:
else
:
print
(
'Data comparison OK.'
)
print
(
'Data comparison OK.'
)
# Restores the saved content to the area used for test
print
(
'
\n
Restoring test area eeprom content.'
)
fmc
.
eeprom_24aa64
.
wr_page
(
WRITE_OFFSET
,
area_content
)
time
.
sleep
(
0.1
)
print
""
print
""
print
"==> End of test
%02
d"
%
TEST_NB
print
"==> End of test
%02
d"
%
TEST_NB
...
...
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