Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
AIDA-2020 TLU - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
AIDA-2020 TLU - Software
Commits
2a62fe92
Commit
2a62fe92
authored
Jun 13, 2018
by
Paolo Baesso
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'PythonScripts'
parents
500a9478
53f48b50
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
121 additions
and
18 deletions
+121
-18
AIDA_testScript.py
TLU_v1e/scripts/AIDA_testScript.py
+14
-12
TLU_v1e.py
TLU_v1e/scripts/TLU_v1e.py
+8
-2
localConf.conf
TLU_v1e/scripts/localConf.conf
+1
-1
PCA9548ADW.py
packages/PCA9548ADW.py
+1
-0
SFPI2C.py
packages/SFPI2C.py
+91
-0
TLU_powermodule.py
packages/TLU_powermodule.py
+6
-3
No files found.
TLU_v1e/scripts/AIDA_testScript.py
View file @
2a62fe92
...
...
@@ -95,11 +95,13 @@ res= zeClock.getDeviceVersion()
zeClock
.
checkDesignID
()
#zeClock.setPage(0, True)
#zeClock.getPage(True)
clkRegList
=
zeClock
.
parse_clk
(
"./../../bitFiles/TLU_CLK_Config_v1e.txt"
)
zeClock
.
writeConfiguration
(
clkRegList
)
######
zeClock
.
writeRegister
(
0x0536
,
[
0x0A
])
#Configures manual switch of inputs
zeClock
.
writeRegister
(
0x0949
,
[
0x0F
])
#Enable all inputs
zeClock
.
writeRegister
(
0x052A
,
[
0x05
])
#Configures source of input
doClock
=
False
if
(
doClock
):
clkRegList
=
zeClock
.
parse_clk
(
"./../../bitFiles/TLU_CLK_Config_v1e.txt"
)
zeClock
.
writeConfiguration
(
clkRegList
)
######
zeClock
.
writeRegister
(
0x0536
,
[
0x0A
])
#Configures manual switch of inputs
zeClock
.
writeRegister
(
0x0949
,
[
0x0F
])
#Enable all inputs
zeClock
.
writeRegister
(
0x052A
,
[
0x05
])
#Configures source of input
iopower
=
zeClock
.
readRegister
(
0x0949
,
1
)
print
" Clock IO power: 0x
%
X"
%
iopower
[
0
]
lol
=
zeClock
.
readRegister
(
0x000E
,
1
)
...
...
@@ -132,32 +134,32 @@ IC6=PCA9539PW(master_I2C, 0x74)
#BANK 0
IC6
.
setInvertReg
(
0
,
0x00
)
# 0= normal
IC6
.
setIOReg
(
0
,
0x00
)
# 0= output <<<<<<<<<<<<<<<<<<<
IC6
.
setOutputs
(
0
,
0x77
)
IC6
.
setOutputs
(
0
,
0x77
)
#77
res
=
IC6
.
getInputs
(
0
)
print
"IC6 read back bank 0: 0x
%
X"
%
res
[
0
]
print
"
\t
IC6 read back bank 0: 0x
%
X"
%
res
[
0
]
#
#BANK 1
IC6
.
setInvertReg
(
1
,
0x00
)
# 0= normal
IC6
.
setIOReg
(
1
,
0x00
)
# 0= output <<<<<<<<<<<<<<<<<<<
IC6
.
setOutputs
(
1
,
0x77
)
IC6
.
setOutputs
(
1
,
0x77
)
#77
res
=
IC6
.
getInputs
(
1
)
print
"IC6 read back bank 1: 0x
%
X"
%
res
[
0
]
print
"
\t
IC6 read back bank 1: 0x
%
X"
%
res
[
0
]
# # #
IC7
=
PCA9539PW
(
master_I2C
,
0x75
)
#BANK 0
IC7
.
setInvertReg
(
0
,
0x00
)
# 0= normal
IC7
.
setIOReg
(
0
,
0x00
)
# 0= output <<<<<<<<<<<<<<<<<<<
IC7
.
setOutputs
(
0
,
0x
0
0
)
IC7
.
setOutputs
(
0
,
0x
F
0
)
res
=
IC7
.
getInputs
(
0
)
print
"IC7 read back bank 0: 0x
%
X"
%
res
[
0
]
print
"
\t
IC7 read back bank 0: 0x
%
X"
%
res
[
0
]
#
#BANK 1
IC7
.
setInvertReg
(
1
,
0x00
)
# 0= normal
IC7
.
setIOReg
(
1
,
0x00
)
# 0= output <<<<<<<<<<<<<<<<<<<
IC7
.
setOutputs
(
1
,
0xB0
)
res
=
IC7
.
getInputs
(
1
)
print
"IC7 read back bank 1: 0x
%
X"
%
res
[
0
]
print
"
\t
IC7 read back bank 1: 0x
%
X"
%
res
[
0
]
# #I2C EXPANDER CONFIGURATION END
...
...
TLU_v1e/scripts/TLU_v1e.py
View file @
2a62fe92
...
...
@@ -20,6 +20,7 @@ class TLU:
"""docstring for TLU"""
def
__init__
(
self
,
dev_name
,
man_file
,
parsed_cfg
):
uhal
.
setLogLevelTo
(
uhal
.
LogLevel
.
NOTICE
)
## Get rid of initial flood of IPBUS messages
self
.
isRunning
=
False
section_name
=
"Producer.fmctlu"
...
...
@@ -137,11 +138,16 @@ class TLU:
#self.pwdled.setIndicatorRGB(11, [0, 0, 1])
self
.
pwdled
.
allGreen
()
time
.
sleep
(
0.1
)
self
.
pwdled
.
allBlue
()
time
.
sleep
(
0.1
)
self
.
pwdled
.
allBlack
()
time
.
sleep
(
0.1
)
#self.pwdled.kitt()
self
.
pwdled
.
allBlack
()
self
.
pwdled
.
allRed
()
time
.
sleep
(
0.1
)
#self.pwdled.allBlack()
#self.pwdled.allRed()
#time.sleep(0.1)
self
.
pwdled
.
allWhite
()
...
...
TLU_v1e/scripts/localConf.conf
View file @
2a62fe92
...
...
@@ -51,7 +51,7 @@ DACThreshold4 = -0.12
DACThreshold5
= -
0
.
12
# Define which DUTs are ON
DUTMask
=
1
DUTMask
=
0
x
1
# Define mode of DUT (00 EUDET, 11 AIDA)
DUTMaskMode
=
0
xFC
...
...
packages/PCA9548ADW.py
View file @
2a62fe92
...
...
@@ -3,6 +3,7 @@ import uhal
from
I2CuHal
import
I2CCore
import
StringIO
class
PCA9548ADW
:
#Class to configure the I2C multiplexer
...
...
packages/SFPI2C.py
0 → 100644
View file @
2a62fe92
# -*- coding: utf-8 -*-
import
uhal
from
I2CuHal
import
I2CCore
import
StringIO
class
SFPI2C
:
#Class to configure the EEPROM
def
__init__
(
self
,
i2c
,
slaveaddr
=
0x50
):
self
.
i2c
=
i2c
self
.
slaveaddr
=
slaveaddr
"""def readEEPROM(self, startadd, nBytes):
#Read EEPROM memory locations
mystop= False
myaddr= [startadd]#0xfa
self.i2c.write( self.slaveaddr, [startadd], mystop)
res= self.i2c.read( self.slaveaddr, nBytes)
return res"""
def
_listToString
(
self
,
mylist
):
mystring
=
""
for
iChar
in
mylist
:
mystring
=
mystring
+
str
(
unichr
(
iChar
))
return
mystring
def
writeReg
(
self
,
regN
,
regContent
,
verbose
=
False
):
#Basic functionality to write to register.
if
(
regN
<
0
)
|
(
regN
>
7
):
print
"PCA9539PW - ERROR: register number should be in range [0:7]"
return
regContent
=
regContent
&
0xFF
mystop
=
True
cmd
=
[
regN
,
regContent
]
self
.
i2c
.
write
(
self
.
slaveaddr
,
cmd
,
mystop
)
def
readReg
(
self
,
regN
,
nwords
,
verbose
=
False
):
#Basic functionality to read from register.
mystop
=
False
self
.
i2c
.
write
(
self
.
slaveaddr
,
[
regN
],
mystop
)
res
=
self
.
i2c
.
read
(
self
.
slaveaddr
,
nwords
)
return
res
def
getConnector
(
self
):
"""Code for connector type (table 3.4)"""
conntype
=
self
.
readReg
(
2
,
1
,
False
)[
0
]
print
"Connector type:"
,
hex
(
conntype
)
return
conntype
def
getDiagnosticsType
(
self
):
"""Types of diagnostics available (table 3.9)"""
diaType
=
self
.
readReg
(
92
,
1
,
False
)[
0
]
print
"Available Diagnostics:"
,
hex
(
diaType
)
return
diaType
def
getEncoding
(
self
):
encoding
=
self
.
readReg
(
11
,
1
,
False
)[
0
]
print
"Encoding"
,
encoding
return
encoding
def
getEnhancedOpt
(
self
):
enOpt
=
self
.
readReg
(
93
,
1
,
False
)[
0
]
print
"Enhanced Options:"
,
enOpt
return
enOpt
def
getTransceiver
(
self
):
res
=
self
.
readReg
(
3
,
8
,
False
)
return
res
def
getVendorId
(
self
):
""" Returns the OUI vendor id"""
vendID
=
self
.
readReg
(
37
,
3
,
False
)
return
vendID
def
getVendorName
(
self
):
res
=
self
.
readReg
(
20
,
16
,
False
)
mystring
=
self
.
_listToString
(
res
)
return
mystring
def
getVendorPN
(
self
):
""" Returns the part number defined by the vendor"""
pn
=
[]
mystring
=
""
res
=
self
.
readReg
(
40
,
16
,
False
)
mystring
=
self
.
_listToString
(
res
)
return
mystring
def
scanI2C
(
self
):
mystop
=
True
for
iAddr
in
range
(
0
,
128
):
self
.
i2c
.
write
(
iAddr
,
[],
mystop
)
packages/TLU_powermodule.py
View file @
2a62fe92
...
...
@@ -89,7 +89,7 @@ class PWRLED:
for
iComp
in
range
(
0
,
3
):
indexComp
=
self
.
indicatorXYZ
[
indicator
-
1
][
iComp
]
valueComp
=
not
bool
(
RGB
[
iComp
])
nextWrd
=
self
.
_set_bit
(
nextWrd
,
indexComp
,
int
(
valueComp
))
nextWrd
=
self
.
_set_bit
(
nextWrd
,
indexComp
,
int
(
valueComp
)
,
False
)
if
verbose
:
print
"n="
,
iComp
,
"INDEX="
,
indexComp
,
"VALUE="
,
int
(
valueComp
),
"NEXTWORD="
,
bin
(
nextWrd
)
if
verbose
:
...
...
@@ -110,10 +110,11 @@ class PWRLED:
return
def
_set_bit
(
self
,
v
,
index
,
x
):
def
_set_bit
(
self
,
v
,
index
,
x
,
verbose
=
False
):
"""Set the index:th bit of v to 1 if x is truthy, else to 0, and return the new value."""
if
(
index
==
-
1
):
print
" SETBIT: Index= -1 will be ignored"
if
(
verbose
):
print
" SETBIT: Index= -1 will be ignored"
else
:
mask
=
1
<<
index
# Compute mask, an integer with just bit 'index' set.
v
&=
~
mask
# Clear the bit indicated by the mask (if x is False)
...
...
@@ -164,6 +165,7 @@ class PWRLED:
def
kitt
(
self
):
#self.allBlack()
print
"
\t
Wait while LEDs are tested..."
self
.
setIndicatorRGB
(
1
,
[
1
,
0
,
0
])
self
.
setIndicatorRGB
(
2
,
[
0
,
0
,
0
])
self
.
setIndicatorRGB
(
3
,
[
0
,
0
,
0
])
...
...
@@ -476,3 +478,4 @@ class PWRLED:
self
.
setIndicatorRGB
(
9
,
[
0
,
0
,
0
])
self
.
setIndicatorRGB
(
10
,
[
0
,
0
,
0
])
self
.
setIndicatorRGB
(
11
,
[
0
,
0
,
0
])
print
"
\t
LED test completed"
\ No newline at end of file
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