Skip to content
GitLab
Explore
Sign in
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
81416dc3
Commit
81416dc3
authored
4 years ago
by
Gijs Schoonderbeek
Browse files
Options
Downloads
Patches
Plain Diff
First version after HW mod. working at 10Mbit/s
parent
d53092fe
No related branches found
No related tags found
1 merge request
!2
Modified the scripts to run on Raspberry Pi.
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
spi_switch_Unb2c.py
+64
-9
64 additions, 9 deletions
spi_switch_Unb2c.py
with
64 additions
and
9 deletions
spi_switch_Unb2c.py
+
64
−
9
View file @
81416dc3
...
@@ -137,8 +137,52 @@ def read_link_status(ports=4):
...
@@ -137,8 +137,52 @@ def read_link_status(ports=4):
stri
+=
"
link down
"
stri
+=
"
link down
"
print
(
stri
)
print
(
stri
)
# Read phy registister status
# Read phy registister status
# read_switch(0x80+cnt,0x1e)
for
cnt
in
range
(
4
):
ret
=
read_switch
(
0x80
+
cnt
,
0x02
,
pr_stri
=
False
)
stri
=
"
Phy status ch {}
"
.
format
(
cnt
)
if
ret
[
1
]
&
0x20
:
stri
+=
"
AN_complete
"
if
ret
[
1
]
&
0x04
:
stri
+=
"
link up
"
if
ret
[
1
]
&
0x10
:
stri
+=
"
remote fault
"
# print(stri)
ret
=
read_switch
(
0x80
+
cnt
,
0x14
,
pr_stri
=
False
)
stri
+=
"
1000BASE-T status ch{}
"
.
format
(
cnt
)
if
ret
[
2
]
&
0x10
:
stri
+=
"
remote status is good
"
if
ret
[
2
]
&
0x20
:
stri
+=
"
local status is good
"
if
ret
[
2
]
&
0x40
:
stri
+=
"
local master
"
else
:
stri
+=
"
local slave
"
else
:
stri
+=
"
No link
"
print
(
stri
)
write_switch_bytes
(
0x80
+
cnt
,
0x3c
,
[
0x35
,
0x08
])
ret
=
read_switch
(
0x80
+
cnt
,
0x3e
)
if
0
:
print
(
"
Drop packet count register
"
)
for
cnt
in
range
(
16
):
# read_switch(0x41,0x80+2*cnt)
read_switch
(
0x0
,
0x0
+
cnt
)
print
(
"
Port State Override
"
)
for
cnt
in
range
(
16
):
# read_switch(0x41,0x80+2*cnt)
read_switch
(
0x0
,
0x60
+
cnt
)
read_switch
(
0x0
,
0x10
)
read_switch
(
0x0
,
0x20
)
if
1
:
print
(
"
Receive count register
"
)
if
1
:
print
(
"
Receive count register
"
)
for
cnt
in
range
(
16
):
write_switch_bytes
(
0x10
+
cnt
,
0x20
,
[
0xD0
,
0x09
])
time
.
sleep
(
0.5
)
for
cnt
in
range
(
16
):
# read_switch(0x41,0x80+2*cnt)
read_switch
(
0x10
+
cnt
,
0x2e
)
# Open a connection to a specific bus and device (chip select pin)
# Open a connection to a specific bus and device (chip select pin)
...
@@ -172,12 +216,23 @@ elif sys.argv[1] == "set":
...
@@ -172,12 +216,23 @@ elif sys.argv[1] == "set":
read_switch
(
0x40
,
0x01
)
read_switch
(
0x40
,
0x01
)
print
(
"
strap resistors
"
)
print
(
"
strap resistors
"
)
read_switch
(
0x01
,
0x70
)
read_switch
(
0x01
,
0x70
)
if
1
:
print
(
"
write and read SGMII register CH0
"
)
print
(
"
write and read SGMII register CH0
"
)
write_switch_bytes
(
0x10
,
0x24
,
[
0x44
,
0x00
])
write_switch_bytes
(
0x10
,
0x24
,
[
0x44
,
0x00
])
read_switch
(
0x10
,
0x24
)
read_switch
(
0x10
,
0x24
)
print
(
"
write and read SGMII register CH3
"
)
print
(
"
write and read SGMII register CH3
"
)
write_switch_bytes
(
0x13
,
0x24
,
[
0x44
,
0x00
])
write_switch_bytes
(
0x13
,
0x24
,
[
0x44
,
0x00
])
read_switch
(
0x13
,
0x24
)
read_switch
(
0x13
,
0x24
)
write_switch_bytes
(
0x0
,
0x20
,
[
0x06
])
for
cnt
in
range
(
16
):
write_switch_bytes
(
0x0
,
0x0
+
cnt
,
[
0x00
])
for
cnt
in
range
(
4
):
write_switch_bytes
(
0x80
+
cnt
,
0x00
,
[
0x00
,
0x01
])
ret
=
read_switch
(
0x80
+
cnt
,
0x00
)
for
cnt
in
range
(
16
):
write_switch_bytes
(
0x10
+
cnt
,
0x00
,
[
0x40
,
0x11
])
write_switch_bytes
(
0x10
+
cnt
,
0x20
,
[
0xD0
,
0x09
])
else
:
else
:
print
(
"
spi_switch_Unb2c stat for status
"
)
print
(
"
spi_switch_Unb2c stat for status
"
)
print
(
"
spi_switch_Unb2c set to set registers
"
)
print
(
"
spi_switch_Unb2c set to set registers
"
)
...
...
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