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
7c2de7c9
Commit
7c2de7c9
authored
4 years ago
by
Gijs Schoonderbeek
Browse files
Options
Downloads
Patches
Plain Diff
Update rd_unb2c.py reading first POL working for current and temp.
parent
019e19ff
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
rd_unb2c.py
+38
-19
38 additions, 19 deletions
rd_unb2c.py
with
38 additions
and
19 deletions
rd_unb2c.py
+
38
−
19
View file @
7c2de7c9
...
...
@@ -59,24 +59,44 @@ def front_led(value=0xFF):
sleep
(
0.2
)
front
.
write_bytes
(
0x01
,
0xf
)
def
read_pol
(
i2c_addr
):
def
read_pol
(
node_nr
,
i2c_addr
):
main_switch
=
I2C
(
0x71
)
main_switch
.
bus
=
I2CBUSNR
ret_ack
=
main_switch
.
write_bytes
(
0x0
,
0x01
<<
node_nr
)
#select Node
if
ret_ack
<
1
:
print
(
"
Main I2C switch not found
"
)
else
:
node_switch
=
I2C
(
0x72
)
node_switch
.
bus
=
I2CBUSNR
ret_ack
=
node_switch
.
write_bytes
(
0x0
,
0x20
)
#select DDR4
if
ret_ack
<
1
:
print
(
"
Node I2C switch not found
"
)
else
:
LOC_PWR
=
I2C
(
i2c_addr
)
LOC_PWR
.
bus
=
I2CBUSNR
ret_ack
,
ret_value
=
LOC_PWR
.
read_bytes
(
0
)
if
ret_ack
<
1
:
print
(
"
no device found
"
)
else
:
pr_stri
=
"
Found device at address 0x{:02x}
"
.
format
(
LOC_PWR
.
I2C_Address
)
print
(
pr_stri
)
ret_ack
,
ret_value
=
LOC_PWR
.
read_bytes
(
LP_VOUT
,
2
)
vout
=
calc_lin_3bytes
(
ret_value
,
vout_mod
)
print
(
"
read =
"
,
vout_mod
)
ret_ack
,
ret_value
=
LOC_PWR
.
read_bytes
(
LP_IOUT
,
2
)
# pr_stri = "Found device at address 0x{:02x}".format(LOC_PWR.I2C_Address)
# print(pr_stri)
ret_ack
,
vout_mod
=
LOC_PWR
.
read_bytes
(
LP_VOUT
,
2
)
# vout_mod = int(vout_mod,16)
# vout = calc_lin_3bytes(ret_value, vout_mod)
ret_ack
,
raw_value
=
LOC_PWR
.
read_bytes
(
LP_IOUT
,
2
)
ret_value
=
[]
ret_value
.
append
(
int
(
raw_value
[:
2
],
16
))
ret_value
.
append
(
int
(
raw_value
[
2
:],
16
))
iout
=
calc_lin_2bytes
(
ret_value
)
print
(
"
Output Current :
"
,
iout
)
ret_ack
,
ret_value
=
LOC_PWR
.
read_bytes
(
LP_temp
,
2
)
stri
=
"
Output Current :{0:2.2f} A
"
.
format
(
iout
)
print
(
stri
)
ret_ack
,
raw_value
=
LOC_PWR
.
read_bytes
(
LP_temp
,
2
)
ret_value
=
[]
ret_value
.
append
(
int
(
raw_value
[:
2
],
16
))
ret_value
.
append
(
int
(
raw_value
[
2
:],
16
))
temp
=
calc_lin_2bytes
(
ret_value
)
print
(
"
temperature :
"
,
temp
)
stri
=
"
temperature :{0:2.2f} Deg C
"
.
format
(
temp
)
print
(
stri
)
def
read_ddr
(
node_nr
=
0
,
module
=
0
):
main_switch
=
I2C
(
0x71
)
...
...
@@ -140,10 +160,9 @@ def read_qsfp(node_nr = 0, module=0):
stri
=
"
Voltage QSFP in slot {0} node {1} is {2:3.2f} V
"
.
format
(
module
,
node_nr
,
Power_in_mod
)
print
(
stri
)
if
0
:
if
1
:
rw_eeprom
(
0xCD
)
front_led
()
else
:
for
node_cnt
in
range
(
4
):
for
module_cnt
in
range
(
2
):
read_ddr
(
node_nr
=
node_cnt
,
module
=
module_cnt
)
...
...
@@ -151,4 +170,4 @@ else:
for
qsfp_cnt
in
range
(
6
):
read_qsfp
(
node_nr
=
node_cnt
,
module
=
qsfp_cnt
)
for
node_cnt
in
range
(
4
):
read_pol
(
LOC_POWER_CORE
)
read_pol
(
node_cnt
,
LOC_POWER_CORE
)
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