Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
python_test_scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
python_test_scripts
Commits
c612ca69
Commit
c612ca69
authored
2 years ago
by
Gijs Schoonderbeek
Browse files
Options
Downloads
Patches
Plain Diff
Added check backplane-ID
parent
d9fd587d
No related branches found
No related tags found
1 merge request
!3
Apsct production
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
APSCT_I2C.py
+6
-0
6 additions, 0 deletions
APSCT_I2C.py
apsct_lib.py
+42
-7
42 additions, 7 deletions
apsct_lib.py
production_apsct.py
+11
-7
11 additions, 7 deletions
production_apsct.py
with
59 additions
and
14 deletions
APSCT_I2C.py
+
6
−
0
View file @
c612ca69
...
...
@@ -64,3 +64,9 @@ EEPROM = 0x50
# I2C switch addresses
#
i2c_switch_addr
=
[
0x70
,
0x71
,
0x72
,
0x73
]
#
# ID Pins
#
ID_PINS
=
[
8
,
7
,
12
,
16
,
20
,
21
]
This diff is collapsed.
Click to expand it.
apsct_lib.py
+
42
−
7
View file @
c612ca69
...
...
@@ -45,6 +45,7 @@ class ApsctClass:
self
.
i2cswitch
=
[]
for
addr
in
APSCT_I2C
.
i2c_switch_addr
:
self
.
i2cswitch
.
append
(
I2cSwitch
(
address
=
addr
))
self
.
apsct_id
=
ApsctId
()
def
read_IO_expanderis
(
self
):
#
...
...
@@ -107,6 +108,7 @@ class ApsctClass:
#
result
=
self
.
sensors
.
check_values
()
result
=
result
&
self
.
pps
.
check_timing
()
result
=
result
&
self
.
apsct_id
.
check_id
()
for
i2c_switch
in
self
.
i2cswitch
:
result
=
result
&
i2c_switch
.
check_switch
(
data
=
random
.
randint
(
0
,
2
**
8
))
if
self
.
frequency
==
"
200MHz
"
:
...
...
@@ -241,24 +243,24 @@ class PllClass:
stri
=
"
Reg nr 0x{:0>2x} value: 0x{:0>2x}
"
.
format
(
cnt
,
int
(
ret_value
[
start
:
start
+
8
],
2
))
print
(
stri
)
def
read_lock
(
self
):
def
read_lock
(
self
,
PRINT_ON
=
True
):
#
# Read lock status
#
ret_value
=
self
.
Read_byte_PLL
(
0x00
,
nof_bytes
=
1
)
status_pll
=
int
(
ret_value
,
2
)
stri
=
""
if
status_pll
==
0x04
:
self
.
lock
=
True
if
DEBUG
:
print
(
"
PLL in lock
"
)
stri
=
f
"
PLL
{
self
.
frequency
}
is in lock
"
elif
(
status_pll
&
0x10
)
>
0
:
self
.
lock
=
False
if
DEBUG
:
print
(
"
Not Locked --> No 10 MHz ref
"
)
stri
=
f
"
PLL
{
self
.
frequency
}
Not Locked --> No 10 MHz ref
"
else
:
self
.
lock
=
False
if
DEBUG
:
print
(
"
Not locked --> PLL Error
"
)
stri
=
f
"
PLL
{
self
.
frequency
}
Not locked --> PLL Error
"
if
PRINT_ON
:
print
(
stri
)
def
read_lol
(
self
):
#
...
...
@@ -526,3 +528,36 @@ class I2cSwitch:
else
:
print
(
f
"
ERROR wrote 0x
{
data
:
02
X
}
read back 0x
{
read_value_int
:
02
X
}
"
)
return
False
class
ApsctId
:
#
# Class to check a I2C-switch
#
def
__init__
(
self
):
#
# APSCT Backplane ID
#
self
.
id
=
9999
gpio
.
setmode
(
gpio
.
BCM
)
for
pin
in
APSCT_I2C
.
ID_PINS
:
gpio
.
setup
(
pin
,
gpio
.
IN
)
def
read_id
(
self
):
id
=
0
for
pin
in
APSCT_I2C
.
ID_PINS
:
id
=
id
*
2
bit
=
gpio
.
input
(
8
)
id
=
id
+
bit
self
.
id
=
id
return
self
.
id
def
check_id
(
self
):
self
.
read_id
()
if
self
.
id
==
63
:
print
(
f
"
OK : Back ID is 0x
{
self
.
id
:
02
X
}
"
)
return
True
else
:
print
(
f
"
ERROR : Back ID is 0x
{
self
.
id
:
02
X
}
expected 0x
{
63
:
2
X
}
"
)
return
False
return
True
This diff is collapsed.
Click to expand it.
production_apsct.py
+
11
−
7
View file @
c612ca69
...
...
@@ -28,21 +28,25 @@ if len(sys.argv) < 2:
apsct
=
apsct_lib
.
ApsctClass
(
CLK_FREQ
)
state
=
True
modi
=
[
"
200MHz
"
]
#
, "160MHz", "OFF"]
if
False
:
#
for mode in modi:
modi
=
[
"
200MHz
"
,
"
160MHz
"
,
"
OFF
"
]
for
mode
in
modi
:
print
(
f
"
Check APSCT in
{
mode
}
mode
"
)
apsct
.
frequency
=
mode
apsct
.
set_apsct
()
if
mode
==
"
200MHz
"
:
apsct
.
pll_200
.
read_lock
()
if
mode
==
"
160MHz
"
:
apsct
.
pll_160
.
read_lock
()
apsct
.
sensors
.
apsct_sensors
()
state
=
state
&
apsct
.
check_apsct
()
apsct
.
frequency
=
"
200MHz
"
apsct
.
set_apsct
()
apsct
.
pll_200
.
read_lock
()
apsct
.
sensors
.
apsct_sensors
()
state
=
state
&
apsct
.
check_apsct
()
if
READ_ALL
:
apsct
.
pll_200
.
read_all_regs_pll
()
#
apsct.pll_160.read_all_regs_pll()
apsct
.
pll_160
.
read_all_regs_pll
()
apsct
.
read_IO_expanderis
()
if
state
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment