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
824d0c22
Commit
824d0c22
authored
1 year ago
by
Gijs Schoonderbeek
Browse files
Options
Downloads
Patches
Plain Diff
Update APSPU script for production test setup. Tested first 2 PTS boards
parent
f1231ace
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
APSPU_I2C.py
+9
-2
9 additions, 2 deletions
APSPU_I2C.py
apspu_lib.py
+47
-19
47 additions, 19 deletions
apspu_lib.py
with
56 additions
and
21 deletions
APSPU_I2C.py
+
9
−
2
View file @
824d0c22
...
...
@@ -37,9 +37,15 @@ VOUT_POLS = {"CTR_LBA": 8.0,
"
CTR_RCU2_A
"
:
5.60009765625
,
"
CTR_RCU2_D
"
:
3.2998046875
}
IOUT_POLS
=
{
"
CTR_LBA
"
:
0.
2
,
IOUT_POLS
=
{
"
CTR_LBA
"
:
0.
48
,
"
CTR_RCU2_A
"
:
0.6
,
"
CTR_RCU2_D
"
:
0.2
}
"
CTR_RCU2_D
"
:
0.61
}
STORE_PWD
=
{
"
CTR_LBA
"
:
0x61
,
"
CTR_RCU2_A
"
:
0x4B
,
"
CTR_RCU2_D
"
:
0x35
}
MAX_TEMP
=
110
LP_VIN
=
0x88
LP_VOUT_MODE
=
0x20
...
...
@@ -58,6 +64,7 @@ LP_ON_OFF_CONFIG = 0x02
LP_OPERATION
=
0x01
LP_WRITE_PROTECT
=
0x10
LP_STORE_DEFAULT_ALL
=
0x12
LP_OT_FAULT_LIMIT
=
0x4F
#
# Central I2C Devices
#
...
...
This diff is collapsed.
Click to expand it.
apspu_lib.py
+
47
−
19
View file @
824d0c22
...
...
@@ -87,6 +87,8 @@ class ApspuClass:
f
"
set
{
1.2
*
VOUT_POLS
[
pol
.
name
]
}
read back
{
ov_out
}
"
)
exit
()
pol
.
set_on_off_config
()
print
(
f
"
Set max temp
{
MAX_TEMP
}
C
"
)
pol
.
set_temp_limit_pol
(
MAX_TEMP
)
pol
.
on_off
(
True
)
pol
.
write_to_nvm
()
print
(
"
Done
"
)
...
...
@@ -98,7 +100,7 @@ class ApspuClass:
#
#print("--------- \nProgram Pols\n---------")
for
pol
in
self
.
pols
:
print
(
f
"
Set Pol
{
pol
.
name
}
to
{
VOUT_POLS
[
pol
.
name
]
:
4.2
f
}
V
"
)
print
(
f
"
Labview:
Set Pol
{
pol
.
name
}
to
{
VOUT_POLS
[
pol
.
name
]
:
4.2
f
}
V
"
)
pol
.
set_vout_pol
(
VOUT_POLS
[
pol
.
name
])
vout
=
pol
.
read_vout_set
()
if
not
(
0.9
*
VOUT_POLS
[
pol
.
name
]
<
vout
<
1.1
*
VOUT_POLS
[
pol
.
name
]):
...
...
@@ -120,6 +122,8 @@ class ApspuClass:
return
returnstring
exit
()
pol
.
set_on_off_config
()
print
(
f
"
Set max temp
{
MAX_TEMP
}
C
"
)
pol
.
set_temp_limit_pol
(
MAX_TEMP
)
pol
.
on_off
(
True
)
pol
.
write_to_nvm
()
returnstring
=
(
"
Programming OK
"
)
...
...
@@ -157,7 +161,7 @@ class ApspuClass:
for
pol
in
self
.
pols
:
check_ok
=
check_ok
&
pol
.
check_pol
()
check_ok
=
check_ok
&
self
.
fans
.
check_fans
()
check_ok
=
check_ok
&
self
.
eeprom
.
wr_rd_eeprom
(
value
=
"
PROD_CHECK
"
,
address
=
0x30
)
check_ok
=
check_ok
&
self
.
eeprom
.
wr_rd_eeprom
(
data
=
"
PROD_CHECK
"
,
address
=
0x30
)
if
check_ok
:
print
(
"
APSPU OK
"
)
else
:
...
...
@@ -328,7 +332,7 @@ class PolClass:
if
DEBUG
:
ret_ack
,
raw_value
=
self
.
pol_dev
.
read_bytes
(
LP_ON_OFF_CONFIG
,
1
)
print
(
f
"
Current setting ON/OFF register 0x
{
int
(
raw_value
,
16
)
:
02
x
}
"
)
on_off_bit
=
not
1
<<
0
on_off_bit
=
0
<<
0
polarity_pin
=
1
<<
1
use_external
=
0
<<
2
use_soft
=
1
<<
3
...
...
@@ -394,6 +398,24 @@ class PolClass:
ret_ack
=
self
.
pol_dev
.
write_bytes
(
LP_VOUT_OV_LIMIT
,
wr_data
)
return
ret_ack
def
set_temp_limit_pol
(
self
,
value
):
#
# Function to set the temperature limit of the DC/DC converter
#
# value is the max temperature
# return I2C ack
#
ret_ack
=
False
if
self
.
status
:
wr_value
=
f
"
{
value
:
02
x
}
"
if
DEBUG
:
print
(
f
"
Calculated wr_value is 0x
{
wr_value
}
"
)
wr_data
=
[]
wr_data
.
append
(
value
)
wr_data
.
append
(
0
)
ret_ack
=
self
.
pol_dev
.
write_bytes
(
LP_OT_FAULT_LIMIT
,
wr_data
)
return
ret_ack
def
write_to_nvm
(
self
):
#
# Function to write the POL's registers to NVM memory
...
...
@@ -401,15 +423,17 @@ class PolClass:
# return is always True
#
print
(
f
"
Store to NVM for POL
{
self
.
name
}
"
)
# self.on_off(on=False)
if
True
:
ret_ack
=
self
.
pol_dev
.
write_pointer
(
0x15
)
sleep
(
1
)
else
:
ret_ack
=
self
.
pol_dev
.
write_bytes
(
0x10
,
0x00
)
sleep
(
2
)
ret_ack
=
self
.
pol_dev
.
write_bytes
(
0x15
,
STORE_PWD
[
self
.
name
])
sleep
(
2
)
else
:
#Pi only
self
.
pol_dev
.
close
()
command
=
f
"
i2c
set
-y 1
0x
{
CTR_POLS
[
self
.
name
]
:
02
X
}
0x15
cp
"
command
=
f
"
i2c
transfer
-y 1
w1@
{
CTR_POLS
[
self
.
name
]
:
02
X
}
0x15
"
os
.
system
(
command
)
os
.
system
(
command
)
self
.
pol_dev
.
open
()
self
.
pol_dev
.
open_i2c
()
return
True
def
read_vin
(
self
):
...
...
@@ -744,7 +768,7 @@ def reset_dc_dc_converters():
def
read_qr
():
apspu
=
EepromClass
()
print
(
"
Read QR code from EEPROM
"
)
return
apspu
.
read_eeprom_lv
(
address
=
0x20
,
nof_bytes
=
1
7
)
return
apspu
.
read_eeprom_lv
(
address
=
0x20
,
nof_bytes
=
1
8
)
def
read_version
():
apspu
=
EepromClass
()
...
...
@@ -779,18 +803,22 @@ def main():
#
# Function to test the class, read all info and dump on the screen
#
user
=
"
Henri
"
user
=
"
LabView
"
# user = "Gijs"
apspu
=
ApspuClass
()
if
user
==
"
Gijs
"
:
apspu
.
apspu_on_off
(
False
)
sleep
(
5
)
apspu
.
set_pols
()
apspu
.
apspu_on_off
(
True
)
sleep
(
10
)
sleep
(
2
)
# apspu.set_pols_lv()
# temp = input("Switch dip's and press enter")
# apspu.apspu_on_off(True)
# sleep(10)
# apspu.eeprom.wr_rd_eeprom(data="APSPU-rev3.0", address=0)
apspu
.
eeprom
.
wr_rd_eeprom
(
data
=
"
APSPU-202419-00002
"
,
address
=
0x20
)
apspu
.
read_all
()
apspu
.
print_status
()
apspu
.
check_apspu
(
)
apspu
.
eeprom
.
wr_rd_eeprom
(
value
=
"
APSPU-2
"
,
address
=
0
)
apspu
.
apspu_on_off
(
False
)
#
apspu.
check_apspu(
)
elif
user
==
"
Henri
"
:
apspu_off
()
program_dc_dc_converters
()
...
...
@@ -801,10 +829,10 @@ def main():
current
(
pol_cnt
)
for
fan_cnt
in
range
(
3
):
fan_speed
(
fan_cnt
)
print
(
write_qr
(
"
APSPU-2
2091-
001
00
"
))
print
(
write_qr
(
"
APSPU-2
02419-0
001
"
))
qr
=
read_qr
()
print
(
qr
)
print
(
write_qr
(
"
APSPU-rev
2
.0
"
))
print
(
write_qr
(
"
APSPU-rev
3
.0
"
))
print
(
read_version
())
print
(
read_id
())
apspu_off
()
...
...
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