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
aad763bf
Commit
aad763bf
authored
4 years ago
by
Gijs Schoonderbeek
Browse files
Options
Downloads
Patches
Plain Diff
Update script not working yet
parent
d2c8d301
No related branches found
No related tags found
1 merge request
!2
Modified the scripts to run on Raspberry Pi.
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
UniBoard2_Read_LOC_PWR.py
+12
-12
12 additions, 12 deletions
UniBoard2_Read_LOC_PWR.py
rd_unb2c.py
+22
-23
22 additions, 23 deletions
rd_unb2c.py
with
34 additions
and
35 deletions
UniBoard2_Read_LOC_PWR.py
+
12
−
12
View file @
aad763bf
...
...
@@ -18,10 +18,10 @@ else:
from
I2C_serial
import
*
from
UniBoard2_I2C
import
*
I2CBUSNR
=
1
I2CBUSNR
=
3
LOC_PWR
=
I2C
(
LOC_POWER_SUPPLIES
[
0
]
)
LOC_PWR
=
I2C
(
0x53
)
LOC_PWR
.
bus
=
I2CBUSNR
ret_ack
,
ret_value
=
LOC_PWR
.
read_bytes
(
0
)
if
ret_ack
<
1
:
...
...
@@ -30,13 +30,13 @@ else:
pr_stri
=
"
Found device at address 0x{:02x}
"
.
format
(
LOC_PWR
.
I2C_Address
)
print
(
pr_stri
)
value
=
[]
ret_ack
,
vout_mod
=
LOC_PWR
.
read_bytes
(
LP_VOUT_MODE
,
1
)
ret_ack
,
ret_value
=
LOC_PWR
.
read_bytes
(
LP_VOUT
,
2
)
vout
=
calc_lin_3bytes
(
ret_value
,
vout_mod
)
print
(
"
vout
=
"
,
vout
)
ret_ack
,
ret_value
=
LOC_PWR
.
read_bytes
(
LP_IOUT
,
2
)
iout
=
calc_lin_2bytes
(
ret_value
)
print
(
"
Output Current :
"
,
iout
)
ret_ack
,
ret_value
=
LOC_PWR
.
read_bytes
(
LP_temp
,
2
)
temp
=
calc_lin_2bytes
(
ret_value
)
print
(
"
temperature :
"
,
temp
)
ret_ack
,
vout_mod
=
LOC_PWR
.
read_bytes
(
0x00
,
1
)
#
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)
#
iout = calc_lin_2bytes(ret_value)
#
print("Output Current :",iout)
#
ret_ack,ret_value = LOC_PWR.read_bytes(LP_temp, 2)
#
temp = calc_lin_2bytes(ret_value)
#
print("temperature :",temp)
This diff is collapsed.
Click to expand it.
rd_unb2c.py
+
22
−
23
View file @
aad763bf
...
...
@@ -4,13 +4,11 @@ Read Hardware info form UNB2C
import
sys
import
time
import
os
sys
.
path
.
insert
(
0
,
'
.
'
)
from
UniBoard2_I2C
import
*
if
os
.
name
==
"
posix
"
:
from
I2C_serial_pi
import
*
else
:
from
I2C_serial
import
*
I2CBUSNR
=
1
I2CBUSNR
=
3
QSFP_PORT
=
[]
QSFP_PORT
.
append
(
0x08
)
...
...
@@ -21,23 +19,23 @@ QSFP_PORT.append(0x40)
QSFP_PORT
.
append
(
0x80
)
def
rw_eeprom
(
value
=
0xAB
):
I2C_eeprom
=
I2C
(
0x53
)
I2C_eeprom
.
bus
=
I2CBUSNR
I2C_eeprom
=
I2C
(
0x53
,
BUSNR
=
3
)
I2C_eeprom
.
write_bytes
(
0x00
,
value
)
I2C_eeprom
.
write_pointer
(
0x00
)
ret_ack
,
ret_value
=
I2C_eeprom
.
read_last_reg
(
1
)
if
ret_ack
:
I2C_eeprom
.
read_bytes
(
0x00
,
1
)
# I2C_eeprom.write_pointer(0x00)
# ret_ack, ret_value = I2C_eeprom.read_last_reg(1)
if
0
:
#ret_ack:
stri
=
"
EEPROM readback : {0}
"
.
format
(
ret_value
)
print
(
stri
)
else
:
print
(
"
ACK nok
"
)
def
front_led
(
value
=
0xFF
):
main_switch
=
I2C
(
0x71
)
main_switch
.
bus
=
I2CBUSNR
def
front_led
(
value
=
0xFF
,
ADDRESS
=
0x71
):
main_switch
=
I2C
(
ADDRESS
,
BUSNR
=
I2CBUSNR
)
#
main_switch.bus = I2CBUSNR
main_switch
.
write_pointer
(
0x20
)
#select LED
front
=
I2C
(
0x41
)
front
.
bus
=
I2CBUSNR
front
=
I2C
(
ADDRESS
=
0x41
,
BUSNR
=
I2CBUSNR
)
#
front.bus = I2CBUSNR
front
.
write_bytes
(
0x03
,
0
)
front
.
write_bytes
(
0x01
,
value
)
sleep
(
0.5
)
...
...
@@ -83,7 +81,7 @@ def read_ddr(node_nr = 0, module=0):
ret_value
.
append
(
int
(
raw_ret
[
0
:
2
],
16
))
ret_value
.
append
(
int
(
raw_ret
[
2
:
4
],
16
))
temp
=
(((
ret_value
[
0
]
&
0x1F
)
*
0x100
)
+
(
ret_value
[
1
]
&
0xFC
))
*
0.0625
stri
=
"
Temperature DDR4 in slot {0} node {1} is {2:3.2f}
°
C
"
.
format
(
module
,
node_nr
,
temp
)
stri
=
"
Temperature DDR4 in slot {0} node {1} is {2:3.2f} C
"
.
format
(
module
,
node_nr
,
temp
)
print
(
stri
)
def
read_qsfp
(
node_nr
=
0
,
module
=
0
):
...
...
@@ -111,13 +109,14 @@ def read_qsfp(node_nr = 0, module=0):
if
0
:
rw_eeprom
(
0xCD
)
main_switch
=
I2C
(
0x71
)
main_switch
.
bus
=
I2CBUSNR
node_switch
=
I2C
(
0x72
)
node_switch
.
bus
=
I2CBUSNR
main_switch
.
write_pointer
(
0x20
)
#select LED
else
:
# main_switch= I2C(0x71)
# main_switch.bus = I2CBUSNR
# node_switch = I2C(0x72)
# node_switch.bus = I2CBUSNR
# main_switch.write_pointer(0x20) #select LED
front_led
()
if
1
:
if
0
:
for
node_cnt
in
range
(
4
):
for
module_cnt
in
range
(
2
):
read_ddr
(
node_nr
=
node_cnt
,
module
=
module_cnt
)
...
...
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