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
fd1793c3
Commit
fd1793c3
authored
2 years ago
by
Gijs Schoonderbeek
Browse files
Options
Downloads
Patches
Plain Diff
tested production_apsct on HW
parent
1676306e
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
+20
-4
20 additions, 4 deletions
apsct_lib.py
with
20 additions
and
4 deletions
apsct_lib.py
+
20
−
4
View file @
fd1793c3
...
...
@@ -158,7 +158,7 @@ class PllClass:
for
clk
in
range
(
2
):
Write_data
=
0x02
|
(
0
<<
CS
)
|
(
clk
<<
SCLK
)
|
(
int
(
bit
)
<<
SDI
)
self
.
dev_i2c_pll
.
write_bytes
(
0x02
,
Write_data
)
time
.
sleep
(
sleep_time
)
sleep
(
sleep_time
)
read_bit
=
''
for
cnt
in
range
(
8
*
nof_bytes
):
for
clk
in
[
0
,
1
]:
# Read after rizing edge
...
...
@@ -219,6 +219,19 @@ class PllClass:
stri
=
"
Reg nr 0x{:0>2x} value: 0x{:0>2x}
"
.
format
(
cnt
,
int
(
ret_value
[
start
:
start
+
8
],
2
))
print
(
stri
)
def
read_lock
(
self
):
#
# Read lock status
#
ret_value
=
self
.
Read_byte_PLL
(
0x00
,
nof_bytes
=
1
)
status_pll
=
int
(
ret_value
,
2
)
if
status_pll
==
0x04
:
print
(
"
PLL in lock
"
)
elif
(
status_pll
&
0x10
)
>
0
:
print
(
"
Not Locked --> No 10 MHz ref
"
)
else
:
print
(
"
Not locked --> PLL Error
"
)
def
read_lol
(
self
,
pll_frequency
=
'
200MHz
'
):
#
# Read loss of lock status
...
...
@@ -233,9 +246,9 @@ class PllClass:
ack
,
ret_value
=
I2C_IO_device_B
.
read_bytes
(
0x01
,
1
)
status_reg
=
int
(
ret_value
,
16
)
if
(
pll_frequency
==
'
200MHz
'
)
&
((
status_reg
&
0x10
)
>
0
):
print
(
"
lost lock
200MHz
"
)
print
(
"
200MHz has
lost lock
"
)
if
((
status_reg
&
0x20
)
>
0
)
&
(
pll_frequency
==
'
160MHz
'
):
print
(
"
lost lock 160MHz
"
)
print
(
"
160MHz has last lock
"
)
ack
,
ret_value
=
I2C_IO_device_A
.
read_bytes
(
0x01
,
1
)
old_reg
=
int
(
ret_value
,
16
)
I2C_IO_device_A
.
write_bytes
(
0x03
,
(
old_reg
|
0x10
))
# '0' is output
...
...
@@ -287,7 +300,9 @@ class EepromClass:
return
False
else
:
ret_ack
,
ret_value
=
self
.
dev_i2c_eeprom
.
read_bytes
(
address
,
nof_bytes
)
str_return
=
bytes
.
fromhex
(
ret_value
[:
nof_bytes
*
2
]).
decode
(
'
UTF-8
'
)
ret_value
=
bytes
.
fromhex
(
ret_value
[:
nof_bytes
*
2
])
#print(" ret value = {}".format(ret_value))
str_return
=
ret_value
.
decode
(
'
UTF-8
'
)
return
str_return
def
wr_rd_eeprom
(
self
,
value
=
"
APSPU-1
"
,
address
=
0
):
...
...
@@ -300,6 +315,7 @@ class EepromClass:
#
if
self
.
write_eeprom
(
value
,
address
=
0
):
ret_value
=
self
.
read_eeprom
(
address
=
0
,
nof_bytes
=
len
(
value
))
print
(
ret_value
)
stri
=
"
Wrote to EEPROM register 0x{2:x} : {0}, Read from EEPROM: {1}
"
.
format
(
value
,
ret_value
,
address
)
print
(
stri
)
if
ret_value
==
value
:
...
...
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