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
352a06ba
Commit
352a06ba
authored
2 years ago
by
Gijs Schoonderbeek
Browse files
Options
Downloads
Patches
Plain Diff
Added PPS check
parent
06c46a49
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
+48
-0
48 additions, 0 deletions
apsct_lib.py
with
48 additions
and
0 deletions
apsct_lib.py
+
48
−
0
View file @
352a06ba
...
...
@@ -17,6 +17,7 @@ Set APSCT_CLK
import
sys
import
APSCT_I2C
import
time
import
RPi.GPIO
as
gpio
sys
.
path
.
insert
(
0
,
'
.
'
)
import
os
if
os
.
name
==
"
posix
"
:
...
...
@@ -39,6 +40,7 @@ class ApsctClass:
self
.
pll_200
=
PllClass
(
"
200MHz
"
)
self
.
pll_160
=
PllClass
(
"
160MHz
"
)
self
.
sensors
=
ApsctSensors
()
self
.
pps
=
PpsClass
()
def
read_IO_expanderis
(
self
):
#
...
...
@@ -100,6 +102,7 @@ class ApsctClass:
# Check voltages, temp and lock on APSCT
#
result
=
self
.
sensors
.
check_values
()
result
=
result
&
self
.
pps
.
check_timing
()
if
self
.
frequency
==
"
200MHz
"
:
self
.
pll_200
.
read_lock
()
lock
=
self
.
pll_200
.
lock
...
...
@@ -437,3 +440,48 @@ class ApsctSensors:
else
:
self
.
temperature
=
9999
return
self
.
temperature
class
PpsClass
:
#
# Class to check the PPS signal
#
def
__init__
(
self
):
#
# Whats needed to measure the toggle on GPIO24
#
gpio
.
setmode
(
gpio
.
BCM
)
gpio
.
setup
(
24
,
gpio
.
IN
)
self
.
pps_time
=
999
def
time_pps
(
self
):
gpio
.
wait_for_edge
(
24
,
gpio
.
RISING
)
a
=
time
()
gpio
.
wait_for_edge
(
24
,
gpio
.
RISING
)
b
=
time
()
self
.
pps_time
=
(
b
-
a
)
/
2
return
self
.
pps_time
def
check_pps
(
self
):
gpio
.
add_event_detect
(
24
,
gpio
.
RISING
)
sleep
(
5
)
pps_ok
=
gpio
.
event_detected
(
24
)
gpio
.
remove_event_detect
(
24
)
return
pps_ok
def
print_pps
(
self
):
if
self
.
check_pps
():
print
(
f
"
Time between pps is
{
self
.
time_pps
()
:
4.2
f
}
s
"
)
else
:
print
(
"
No PPS found
"
)
def
check_timing
(
self
):
print
(
"
Check pps timing
"
,
end
=
""
)
self
.
timing
=
False
if
not
self
.
check_pps
():
print
(
"
no pps
"
)
return
False
timepps
=
self
.
time_pps
()
if
(
0.9
<
timepps
<
1.1
):
print
(
f
"
, timing is OK:
{
timepps
:
4.2
f
}
s
"
)
self
.
timing
=
True
return
self
.
timing
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