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
387ce96b
Commit
387ce96b
authored
2 years ago
by
Gijs Schoonderbeek
Browse files
Options
Downloads
Patches
Plain Diff
small modification to get is working on HW
parent
8ecf836e
No related branches found
No related tags found
1 merge request
!3
Apsct production
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
apsct_lib.py
+18
-11
18 additions, 11 deletions
apsct_lib.py
with
18 additions
and
11 deletions
apsct_lib.py
+
18
−
11
View file @
387ce96b
...
...
@@ -26,7 +26,7 @@ else:
I2CBUSNR
=
5
sleep_time
=
0.15
DEBUG
=
False
class
ApsctClass
:
#
...
...
@@ -96,6 +96,9 @@ class ApsctClass:
self
.
power
(
False
)
def
check_apsct
(
self
):
#
# Check voltages, temp and lock on APSCT
#
result
=
self
.
sensors
.
check_values
()
if
self
.
frequency
==
"
200MHz
"
:
self
.
pll_200
.
read_lock
()
...
...
@@ -129,11 +132,12 @@ class PllClass:
# Write Byte to the PLL
#
pll_rw
=
0x00
# 0 for write, 1 for read
if
DEBUG
:
stri
=
"
Write to address : 0x{1:{fill}2x} value 0x{0:{fill}2x}
"
.
format
(
wr_data
,
reg_address
,
fill
=
'
0
'
)
print
(
stri
)
self
.
dev_i2c_pll
.
write_bytes
(
0x06
,
0x2C
)
if
DEBUG
:
rd_bytes
=
self
.
dev_i2c_pll
.
read_bytes
(
0x06
,
1
)
if
DEBUG
:
stri
=
"
IO expander wrote 0x{0:x}, read 0x{1}
"
.
format
(
0x2C
,
rd_bytes
[
1
])
print
(
stri
)
data
=
(
reg_address
<<
9
)
+
(
pll_rw
<<
8
)
+
wr_data
...
...
@@ -188,6 +192,7 @@ class PllClass:
#
# Set registers on the PLL
#
print
(
f
"
Setup PPL
{
self
.
frequency
}
"
)
self
.
dev_i2c_pll
.
write_bytes
(
0x07
,
0x00
)
if
self
.
frequency
==
'
160MHz
'
:
self
.
dev_i2c_pll
.
write_bytes
(
0x03
,
0x08
)
...
...
@@ -367,17 +372,18 @@ class ApsctSensors:
#
# return result, True when OK, False in case of error
#
print
(
"
Check power sensor values
"
)
result
=
True
self
.
read_all_voltages
()
self
.
read_temp
()
for
pwr
in
self
.
power_supplies
:
expected
=
APSCT_I2C
.
PWR_VOUT
[
pwr
]
if
0.9
*
expected
>
self
.
voltages
[
pwr
]
>
1.1
*
expected
:
if
not
(
0.9
*
expected
<
self
.
voltages
[
pwr
]
<
1.1
*
expected
)
:
result
=
False
print
(
f
"
Error
{
pwr
}
expected
{
expected
}
V read
{
self
.
voltages
[
pwr
]
}
V
"
)
if
15
>
self
.
temperature
>
50
:
print
(
f
"
Error
:
{
pwr
:
<
9
}
expected
:
{
expected
}
V read
:
{
self
.
voltages
[
pwr
]
:
4.2
f
}
V
"
)
if
not
(
15
<
self
.
temperature
<
50
)
:
result
=
False
print
(
f
"
Error temperature read
{
self
.
temperature
}
°C
"
)
print
(
f
"
Error temperature read
{
self
.
temperature
:
4.2
f
}
°C
"
)
return
result
def
read_voltage
(
self
,
input_channel
=
0
):
...
...
@@ -394,7 +400,7 @@ class ApsctSensors:
if
DEBUG
:
stri
=
"
Word to select sens input is 0x{0:x}
"
.
format
(
channel_select_word
)
print
(
stri
)
sleep
(
0.
1
)
sleep
(
0.
2
)
self
.
dev_i2c_sensor
.
write_bytes
(
channel_select_word
,
0xB8
)
sleep
(
0.5
)
ret_ack
,
ret_value
=
self
.
dev_i2c_sensor
.
read_last_reg
(
3
)
...
...
@@ -407,6 +413,7 @@ class ApsctSensors:
steps
=
(
int
(
ret_value
,
16
)
&
0x1FFFFF
)
>>
6
voltage
=
one_step
*
steps
voltage
=
((
4.7
+
2.2
)
/
2.2
)
*
2
*
voltage
if
DEBUG
:
string
=
"
Voltage sens line {1} is {0:.4f} V
"
.
format
(
voltage
,
input_channel
)
print
(
string
)
return
voltage
...
...
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