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
0139063e
Commit
0139063e
authored
Aug 28, 2013
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test31: Improve checking of bad eeprom data.
parent
cb18d605
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
test31.py
test/fmcadc100m14b4cha/python/test31.py
+21
-11
No files found.
test/fmcadc100m14b4cha/python/test31.py
View file @
0139063e
...
@@ -131,20 +131,22 @@ def main (default_directory='.'):
...
@@ -131,20 +131,22 @@ def main (default_directory='.'):
for
i
in
range
(
serial_length
):
for
i
in
range
(
serial_length
):
serial
+=
chr
(
eeprom_data_read
[
i
+
serial_offset
])
serial
+=
chr
(
eeprom_data_read
[
i
+
serial_offset
])
print
(
"Serial number read from bad EEPROM image:
%
s"
%
serial
)
print
(
"Serial number read from bad EEPROM image:
%
s"
%
serial
)
if
serial
==
''
:
raise
PtsCritical
(
"Invalid serial number read in EEPROM!"
)
BAK_CALIBR_BIN_FILENAME
=
"calibr_bak/calibr_"
+
serial
+
".bin"
BAK_CALIBR_BIN_FILENAME
=
os
.
path
.
join
(
default_directory
,
BAK_CALIBR_BIN_FILENAME
)
# Check that the manufacturing date is valid
# Check that the manufacturing date is valid
first_prod_date
=
datetime
.
datetime
(
2013
,
3
,
4
)
first_prod_date
=
datetime
.
datetime
(
2013
,
3
,
4
)
diff_date
=
first_prod_date
-
ref_date
diff_date
=
first_prod_date
-
ref_date
first_prod_date_min
=
int
(
diff_date
.
total_seconds
()
//
60
)
first_prod_date_min
=
int
(
diff_date
.
total_seconds
()
//
60
)
if
(
mfg_date_min
==
0
|
mfg_date_min
==
0xffffff
):
if
(
mfg_date_min
==
0
|
mfg_date_min
==
0xffffff
):
print
(
"No manufacturing date found in the EEPROM => taking current date:
%
s
\n
"
%
str
(
current_date
))
raise
PtsCritical
(
"No manufacturing date found in the EEPROM!"
)
mfg_date_min
=
current_date_min
elif
(
mfg_date_min
>
current_date_min
):
elif
(
mfg_date_min
>
current_date_min
):
print
(
"Date found in the EEPROM is in the future => taking current date:
%
s
\n
"
%
str
(
current_date
))
raise
PtsCritical
(
"Date found in the EEPROM is in the future!"
)
mfg_date_min
=
current_date_min
elif
(
mfg_date_min
<
first_prod_date_min
):
elif
(
mfg_date_min
<
first_prod_date_min
):
print
(
"Date found in the EEPROM is older than the first production => taking current date:
%
s
\n
"
%
str
(
current_date
))
raise
PtsCritical
(
"Date found in the EEPROM is older than the first production!"
)
mfg_date_min
=
current_date_min
else
:
else
:
print
(
"Valid manufacturing date found in EEPROM:
%
s (will be preserved)
\n
"
%
str
(
mfg_date
))
print
(
"Valid manufacturing date found in EEPROM:
%
s (will be preserved)
\n
"
%
str
(
mfg_date
))
...
@@ -241,6 +243,19 @@ P1 Bank A nb signal=%d, P1 Bank B nb signal=%d, P2 Bank A nb signal=%d, P2 Bank
...
@@ -241,6 +243,19 @@ P1 Bank A nb signal=%d, P1 Bank B nb signal=%d, P2 Bank A nb signal=%d, P2 Bank
cmd
=
'sdb-read -e 0x1000 '
+
BAD_EEPROM_BIN_FILENAME
+
' calibration.sdb > '
+
CALIBR_BIN_FILENAME
cmd
=
'sdb-read -e 0x1000 '
+
BAD_EEPROM_BIN_FILENAME
+
' calibration.sdb > '
+
CALIBR_BIN_FILENAME
print
(
"Exctract calibration binary file from bad EEPROM image, cmd:
%
s"
%
(
cmd
))
print
(
"Exctract calibration binary file from bad EEPROM image, cmd:
%
s"
%
(
cmd
))
os
.
system
(
cmd
)
os
.
system
(
cmd
)
cmd
=
"cp "
+
CALIBR_BIN_FILENAME
+
" "
+
BAK_CALIBR_BIN_FILENAME
print
(
"Copy calibration binary, cmd:
%
s"
%
(
cmd
))
#os.system(cmd)
#==================================================
# Check that valid calibration data were extracted
#==================================================
print
(
"
\n
=================================================="
)
print
(
"Check calibration data"
)
calib_data
=
open
(
CALIBR_BIN_FILENAME
,
"rb"
)
.
read
()
print
type
(
calib_data
)
if
calib_data
==
''
:
raise
PtsCritical
(
"Invalid calibration data read in EEPROM!"
)
#==================================================
#==================================================
# Generate eeprom image with gensdbfs
# Generate eeprom image with gensdbfs
...
@@ -270,11 +285,6 @@ P1 Bank A nb signal=%d, P1 Bank B nb signal=%d, P2 Bank A nb signal=%d, P2 Bank
...
@@ -270,11 +285,6 @@ P1 Bank A nb signal=%d, P1 Bank B nb signal=%d, P2 Bank A nb signal=%d, P2 Bank
print
(
"
%02
x"
%
(
byte
)),
print
(
"
%02
x"
%
(
byte
)),
print
(
"
\n
"
)
print
(
"
\n
"
)
##############################################################################################################################################################
sys
.
exit
()
##############################################################################################################################################################
#==================================================
#==================================================
# Erase EEPROM content
# Erase EEPROM content
#==================================================
#==================================================
...
...
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