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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
python_test_scripts
Commits
4e317e3c
Commit
4e317e3c
authored
3 years ago
by
Gijs Schoonderbeek
Browse files
Options
Downloads
Patches
Plain Diff
Added readout of loss of lock (LOL)
parent
4a5e88ac
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
APSCT_CLK_I2C.py
+31
-5
31 additions, 5 deletions
APSCT_CLK_I2C.py
with
31 additions
and
5 deletions
APSCT_CLK_I2C.py
+
31
−
5
View file @
4e317e3c
...
...
@@ -26,15 +26,15 @@ else:
DEBUG
=
False
I2CBUSNR
=
5
sleep_time
=
0.15
SET_PLL
=
True
SET_PLL
=
False
#
True
READ_LOCK
=
True
READ_ALL
=
False
CHECK_EEPROM
=
False
PWR_RST
=
False
#True #False
READ_SENSOR
=
True
READ_SENSOR
=
False
#
True
READ_REGS
=
False
#True
CLK_FREQ
=
'
200MHz
'
#
'160MHz'
CLK_FREQ
=
'
160MHz
'
dev_i2c_eeprom
=
I2C
(
0x50
)
dev_i2c_eeprom
.
bus_nr
=
I2CBUSNR
...
...
@@ -151,11 +151,11 @@ def setup_pll(pll_frequency='200MHz') :
if
pll_frequency
==
'
160MHz
'
:
print
(
"
Set PLL to 160 MHz mode
"
)
pll_address
=
PLL_160M
I2C_device
.
write_bytes
(
0x03
,
0x0
F
)
I2C_device
.
write_bytes
(
0x03
,
0x0
8
)
else
:
print
(
"
Set PLL to 200 MHz mode
"
)
pll_address
=
PLL_200M
I2C_device
.
write_bytes
(
0x03
,
0x
FF
)
I2C_device
.
write_bytes
(
0x03
,
0x
28
)
Write_byte_PLL
(
0x03
,
0x0C
,
pll_address
)
sleep
(
0.5
)
Write_byte_PLL
(
0x03
,
0x08
,
pll_address
)
...
...
@@ -290,6 +290,31 @@ def read_temp():
else
:
print
(
"
Error reading tempeature
"
)
def
read_lol
(
pll_frequency
=
'
200MHz
'
):
I2C_IO_device_A
=
I2C
(
0x20
,
BUSNR
=
I2CBUSNR
)
I2C_IO_device_A
.
write_bytes
(
0x06
,
0x2C
)
# '0' is output
I2C_IO_device_A
.
write_bytes
(
0x07
,
0x00
)
# '0' is output
I2C_IO_device_B
=
I2C
(
0x21
,
BUSNR
=
I2CBUSNR
)
I2C_IO_device_B
.
write_bytes
(
0x06
,
0x2C
)
# '0' is output
I2C_IO_device_B
.
write_bytes
(
0x07
,
0xFF
)
# '0' is output
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
"
)
if
((
status_reg
&
0x20
)
>
0
)
&
(
pll_frequency
==
'
160MHz
'
):
print
(
"
lost lock 160MHz
"
)
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
sleep
(
1
)
I2C_IO_device_A
.
write_bytes
(
0x03
,
(
old_reg
&
0xEF
))
# '0' is output
#if READ_REGS:
# read_all_regs_pll(CLK_FREQ)
...
...
@@ -329,3 +354,4 @@ if READ_ALL:
if
READ_SENSOR
:
apsct_sensors
()
read_lol
(
CLK_FREQ
)
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