Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Production Test Suite
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
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
Production Test Suite
Commits
0769baa3
Commit
0769baa3
authored
Jul 13, 2011
by
Samuel Iglesias Gonsalvez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tps/spec: added test04. Checks access to EEPROM of SFP connector.
parent
947ce508
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
154 additions
and
1 deletion
+154
-1
README
test/spec/README
+1
-1
test04.bin
test/spec/firmwares/test04.bin
+0
-0
test04.py
test/spec/python/test04.py
+153
-0
No files found.
test/spec/README
View file @
0769baa3
...
...
@@ -16,7 +16,7 @@ This batch of test makes a connectivity test of the SPEC's components.
- test01: checks the low speed pins of FMC connector (low count connector).
- test02: checks the EEPROM of the GENNUM chip.
- test03: loads a firmware file to Flash memory and boots from it. The FW just blinks the front-panel leds using the buttons.
- test04:
not present yet. It should be SFP connectivity test
.
- test04:
checks the EEPROM present in the SFP connector. Reads the type
.
- test05: checks SATA ports and high speed pins on FMC connector (low count connector).
- test06: checks Silabs SI570 oscillator.
- test07: checks data and address lines of DDR memory.
...
...
test/spec/firmwares/test04.bin
0 → 100644
View file @
0769baa3
File added
test/spec/python/test04.py
0 → 100755
View file @
0769baa3
#! /usr/bin/env python
# coding: utf8
# Copyright CERN, 2011
# Author: Samuel Iglesias Gonsalvez <siglesia@cern.ch>
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
import
sys
import
rr
import
time
import
os
from
tpsexcept
import
*
"""
test00: checks voltage of the power pins in FMC connector.
"""
BASE_GPIO
=
0x40000
BASE_MINIC
=
0xc0000
GPIO_CODR
=
0x0
GPIO_SODR
=
0x4
GPIO_PSR
=
0xc
class
COpenCoresI2C
:
R_PREL
=
0x0
R_PREH
=
0x4
R_CTR
=
0x8
R_TXR
=
0xC
R_RXR
=
0xC
R_CR
=
0x10
R_SR
=
0x10
CTR_EN
=
(
1
<<
7
)
CR_STA
=
(
1
<<
7
)
CR_STO
=
(
1
<<
6
)
CR_WR
=
(
1
<<
4
)
CR_RD
=
(
1
<<
5
)
CR_NACK
=
(
1
<<
3
)
SR_RXACK
=
(
1
<<
7
)
SR_TIP
=
(
1
<<
1
)
def
wr_reg
(
self
,
addr
,
val
):
self
.
bus
.
iwrite
(
0
,
self
.
base
+
addr
,
4
,
val
)
def
rd_reg
(
self
,
addr
):
return
self
.
bus
.
iread
(
0
,
self
.
base
+
addr
,
4
)
def
__init__
(
self
,
bus
,
base
,
prescaler
):
self
.
bus
=
bus
;
self
.
base
=
base
;
self
.
wr_reg
(
self
.
R_CTR
,
0
);
self
.
wr_reg
(
self
.
R_PREL
,
(
prescaler
&
0xff
))
self
.
wr_reg
(
self
.
R_PREH
,
(
prescaler
>>
8
))
self
.
wr_reg
(
self
.
R_CTR
,
self
.
CTR_EN
);
def
wait_busy
(
self
):
while
(
self
.
rd_reg
(
self
.
R_SR
)
&
self
.
SR_TIP
):
pass
def
start
(
self
,
addr
,
write_mode
):
addr
=
addr
<<
1
if
(
write_mode
==
False
):
addr
=
addr
|
1
;
self
.
wr_reg
(
self
.
R_TXR
,
addr
);
self
.
wr_reg
(
self
.
R_CR
,
self
.
CR_STA
|
self
.
CR_WR
);
self
.
wait_busy
()
if
(
self
.
rd_reg
(
self
.
R_SR
)
&
self
.
SR_RXACK
):
raise
Exception
(
'No ACK upon address (device 0x
%
x not connected?)'
%
addr
)
def
write
(
self
,
data
,
last
):
self
.
wr_reg
(
self
.
R_TXR
,
data
);
cmd
=
self
.
CR_WR
;
if
(
last
):
cmd
=
cmd
|
self
.
CR_STO
;
self
.
wr_reg
(
self
.
R_CR
,
cmd
);
self
.
wait_busy
();
if
(
self
.
rd_reg
(
self
.
R_SR
)
&
self
.
SR_RXACK
):
raise
Exception
(
'No ACK upon write'
)
def
read
(
self
,
last
):
cmd
=
self
.
CR_RD
;
if
(
last
):
cmd
=
cmd
|
self
.
CR_STO
|
self
.
CR_NACK
;
self
.
wr_reg
(
self
.
R_CR
,
cmd
);
self
.
wait_busy
();
return
self
.
rd_reg
(
self
.
R_RXR
);
class
EEPROM_SFP
:
def
__init__
(
self
,
i2c
,
addr
):
self
.
i2c
=
i2c
;
self
.
addr
=
addr
;
def
wr_reg16
(
self
,
addr
,
value
):
self
.
i2c
.
start
(
self
.
addr
,
True
);
self
.
i2c
.
write
(
addr
,
False
);
tmp
=
(
value
>>
8
)
&
0xFF
;
self
.
i2c
.
write
(
value
,
False
);
tmp
=
value
&
0xFF
;
self
.
i2c
.
write
(
value
,
True
)
def
wr_reg8
(
self
,
addr
,
value
):
self
.
i2c
.
start
(
self
.
addr
,
True
);
# write cycle
self
.
i2c
.
write
(
addr
,
False
);
self
.
i2c
.
write
(
value
,
True
);
def
rd_reg16
(
self
,
addr
):
self
.
i2c
.
start
(
self
.
addr
,
True
);
self
.
i2c
.
write
(
addr
,
False
);
self
.
i2c
.
start
(
self
.
addr
,
False
);
tmp_MSB
=
self
.
i2c
.
read
(
False
);
tmp_LSB
=
self
.
i2c
.
read
(
True
);
value
=
(
tmp_MSB
<<
8
)
|
tmp_LSB
;
return
value
;
def
rd_reg8
(
self
,
addr
):
self
.
i2c
.
start
(
self
.
addr
,
True
);
self
.
i2c
.
write
(
addr
,
False
);
self
.
i2c
.
start
(
self
.
addr
,
False
);
return
self
.
i2c
.
read
(
True
);
def
main
(
default_directory
=
'.'
):
path_fpga_loader
=
'../firmwares/fpga_loader'
;
path_firmware
=
'../firmwares/test04.bin'
;
firmware_loader
=
os
.
path
.
join
(
default_directory
,
path_fpga_loader
)
bitstream
=
os
.
path
.
join
(
default_directory
,
path_firmware
)
os
.
system
(
firmware_loader
+
' '
+
bitstream
)
time
.
sleep
(
2
);
gennum
=
rr
.
Gennum
();
i2c
=
COpenCoresI2C
(
gennum
,
0x40000
,
99
);
# Prescaler value calculated using 50 MHz clock
eeprom
=
EEPROM_SFP
(
i2c
,
0x50
);
type
=
eeprom
.
rd_reg8
(
0x0
);
print
"Type of serial transceiver: "
+
hex
(
type
)
if
(
type
==
3
)
:
print
"Type is correct"
else
:
raise
TpsError
(
"Wrong type of connector. It should be 0x3"
)
if
__name__
==
'__main__'
:
main
();
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