Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 2cha
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC DEL 1ns 2cha
Commits
8672b76f
Commit
8672b76f
authored
Nov 03, 2016
by
Jan Pospisil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
triggerLatency as an argument
parent
8bf37ab4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
20 deletions
+24
-20
FFPG_CLI.py
sw/FFPG_CLI.py
+23
-19
Ffpg.py
sw/Ffpg.py
+1
-1
No files found.
sw/FFPG_CLI.py
View file @
8672b76f
#!/usr/bin/env python
# coding: utf8
# TODO:
# - floats in arguments
# - bunch assert (0-3563)
# - when no bunches are provided, stay in high/low according to polarity
# - fixed sub-bunch period, just check (warning) against "real" input frequency
# - relax bunch boundary check, fix continuous pulses (25 ns puls in two subsequent bunches) -> constraint to the help
import
sys
from
Ffpg
import
*
def
myInt
(
s
):
if
s
.
isdigit
()
:
try
:
return
int
(
s
)
e
lse
:
e
xcept
:
return
None
calibrationData
=
[
# -1 = uncalibrated
# channel 1, channel 2
[
-
1
,
-
1
],
# FMC slot 0
[
-
1
,
-
1
]
# FMC slot 1
]
print
(
"FFPG command line interface"
)
print
(
""
)
if
len
(
sys
.
argv
)
is
not
4
and
len
(
sys
.
argv
)
<
7
:
if
len
(
sys
.
argv
)
is
not
4
and
len
(
sys
.
argv
)
<
8
:
print
"Usage:"
print
" "
+
sys
.
argv
[
0
]
+
" <fmcSlot (LUN)> <channel> <polarity> <pulseWidth> <pulseDelay> <bunches>"
print
" "
+
sys
.
argv
[
0
]
+
" <fmcSlot (LUN)> <channel> <polarity> <pulseWidth> <pulseDelay> <
triggerLatency> <
bunches>"
print
" Sets and starts selected channel on selected FMC mezzanine"
print
" or"
print
" "
+
sys
.
argv
[
0
]
+
" <fmcSlot (LUN)> <channel> stop"
...
...
@@ -31,7 +32,8 @@ if len(sys.argv) is not 4 and len(sys.argv) < 7:
print
" <channel> - 1 | 2"
print
" <polarity> - 0 | 1"
print
" <pulseWidth> - positive number in [ns]"
print
" <pulseDelay> - nonegative number in [ns]"
print
" <pulseDelay> - non-negative number in [ns]"
print
" <triggerLatency> - non-negative number in [ns], or -1 (calibration disabled)"
print
" <bunches> - space separated list of bunch numbers"
print
""
sys
.
exit
()
...
...
@@ -44,8 +46,9 @@ else:
polarity
=
myInt
(
sys
.
argv
[
3
])
pulseWidth
=
myInt
(
sys
.
argv
[
4
])
pulseDelay
=
myInt
(
sys
.
argv
[
5
])
triggerLatency
=
myInt
(
sys
.
argv
[
6
])
bunches
=
[]
for
i
in
range
(
6
,
len
(
sys
.
argv
)):
for
i
in
range
(
7
,
len
(
sys
.
argv
)):
bunches
.
append
(
myInt
(
sys
.
argv
[
i
]))
print
(
"Configuration:"
)
...
...
@@ -60,6 +63,7 @@ else:
print
(
" polarity = "
+
str
(
polarity
)
+
" (negative pulses)"
)
print
(
" pulseWidth = "
+
str
(
pulseWidth
)
+
" ns"
)
print
(
" pulseDelay = "
+
str
(
pulseDelay
)
+
" ns"
)
print
(
" triggerLatency = "
+
str
(
triggerLatency
)
+
" ns"
)
print
(
" bunches = "
+
str
(
bunches
))
print
(
""
)
...
...
@@ -74,7 +78,8 @@ if polarity != "stop":
raise
Exception
(
"pulseWidth has to be > 0 ns!"
);
if
pulseDelay
<
0
:
raise
Exception
(
"pulseDelay has to be >= 0 ns!"
);
# TODO: assert for bunches?
if
triggerLatency
<
0
and
triggerLatency
!=
-
1
:
raise
Exception
(
"triggerLatency has to be >= 0 ns or -1!"
);
def
PrintFrequency
(
pg
):
frequency
=
pg
.
GetFrequency
()
...
...
@@ -109,10 +114,9 @@ pg.Ad9512Sync()
pg
.
SetTriggerThreshold
(
0.5
)
pg
.
SetVcxoFrequency
(
-
0.2105
)
# 125.0000 MHz
# calibration
triggerPhase
=
calibrationData
[
fmcSlot
][
channel
-
1
]
print
(
"Calibrating channel "
+
str
(
channel
)
+
" on FMC slot "
+
str
(
fmcSlot
)
+
" to "
+
str
(
triggerPhase
)
+
" ns"
)
if
triggerPhase
>
-
1
:
pg
.
SetTriggerPhase
(
channel
,
triggerPhase
)
print
(
"Calibrating channel "
+
str
(
channel
)
+
" on FMC slot "
+
str
(
fmcSlot
)
+
" to "
+
str
(
triggerLatency
)
+
" ns"
)
if
triggerLatency
>
-
1
:
pg
.
SetTriggerPhase
(
channel
,
triggerLatency
)
else
:
print
(
" (Skipping this calibration, no calibration data (-1) provided.)"
)
...
...
@@ -125,7 +129,7 @@ pg.StartChannel(channel)
# print some info
pg
.
PrintVersion
()
# print("Actual temperature: "+str(pg.temp.ReadTemperature()) + " °C")
print
(
"Actual temperature: (temp
a
rature read-out disabled - it is too slow)"
)
print
(
"Actual temperature: (temp
e
rature read-out disabled - it is too slow)"
)
PrintFrequency
(
pg
)
pg
.
PrintControl
()
pg
.
PrintStatus
()
...
...
sw/Ffpg.py
View file @
8672b76f
...
...
@@ -378,7 +378,7 @@ class Ffpg(object):
# calculate pulse shape inside the bunch
rfToBunchRatio
=
int
(
round
(
lhcBunchPeriod
/
clockPeriod
))
if
rfToBunchRatio
!=
5
:
warnings
.
warn
(
"rfToBunchRatio is not 5 - it should be in the 'normal' setup!"
,
stacklevel
=
2
)
warnings
.
warn
(
"rfToBunchRatio is not 5 - it should be
,
in the 'normal' setup!"
,
stacklevel
=
2
)
pulseStartBit
=
int
(
pulseDelay
/
clockPeriod
)
pulseStartFineDelay
=
pulseDelay
-
pulseStartBit
*
clockPeriod
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment