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
6e97c2da
Commit
6e97c2da
authored
May 02, 2017
by
Jan Pospisil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added new CLI command for driver initialization - has to be called once at the beginning
parent
da4ee7c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
29 deletions
+48
-29
FFPG_CLI.py
sw/FFPG_CLI.py
+48
-29
No files found.
sw/FFPG_CLI.py
View file @
6e97c2da
...
...
@@ -19,8 +19,11 @@ def myFloat(s):
print
(
"FFPG command line interface"
)
print
(
""
)
if
len
(
sys
.
argv
)
is
not
4
and
len
(
sys
.
argv
)
<
7
:
if
len
(
sys
.
argv
)
is
not
3
and
len
(
sys
.
argv
)
is
not
4
and
len
(
sys
.
argv
)
<
7
:
print
"Usage:"
print
" "
+
sys
.
argv
[
0
]
+
" <fmcSlot (LUN)> init"
print
" Perform main initialization (resetting, clearing, synchronizing...)"
print
" or"
print
" "
+
sys
.
argv
[
0
]
+
" <fmcSlot (LUN)> <channel> <polarity> <pulseWidth> <pulseDelay> <triggerLatency> [<bunches>]"
print
" Sets and starts selected channel on selected FMC mezzanine"
print
" or"
...
...
@@ -40,29 +43,33 @@ if len(sys.argv) is not 4 and len(sys.argv) < 7:
print
""
sys
.
exit
()
command
=
"configure"
fmcSlot
=
myInt
(
sys
.
argv
[
1
])
channel
=
myInt
(
sys
.
argv
[
2
])
if
sys
.
argv
[
3
]
==
"stop"
:
polarity
=
"stop"
if
sys
.
argv
[
2
]
==
"init"
:
command
=
"init"
else
:
polarity
=
myInt
(
sys
.
argv
[
3
])
pulseWidth
=
myFloat
(
sys
.
argv
[
4
])
pulseDelay
=
myFloat
(
sys
.
argv
[
5
])
triggerLatency
=
myFloat
(
sys
.
argv
[
6
])
bunches
=
[]
for
i
in
range
(
7
,
len
(
sys
.
argv
)):
if
"-"
in
sys
.
argv
[
i
]:
startBunch
,
stopBunch
=
sys
.
argv
[
i
]
.
split
(
"-"
,
2
)
bunches
=
bunches
+
range
(
myInt
(
startBunch
),
myInt
(
stopBunch
))
else
:
bunches
.
append
(
myInt
(
sys
.
argv
[
i
]))
channel
=
myInt
(
sys
.
argv
[
2
])
if
sys
.
argv
[
3
]
==
"stop"
:
command
=
"stop"
else
:
polarity
=
myInt
(
sys
.
argv
[
3
])
pulseWidth
=
myFloat
(
sys
.
argv
[
4
])
pulseDelay
=
myFloat
(
sys
.
argv
[
5
])
triggerLatency
=
myFloat
(
sys
.
argv
[
6
])
bunches
=
[]
for
i
in
range
(
7
,
len
(
sys
.
argv
)):
if
"-"
in
sys
.
argv
[
i
]:
startBunch
,
stopBunch
=
sys
.
argv
[
i
]
.
split
(
"-"
,
2
)
bunches
=
bunches
+
range
(
myInt
(
startBunch
),
myInt
(
stopBunch
))
else
:
bunches
.
append
(
myInt
(
sys
.
argv
[
i
]))
print
(
"Configuration:"
)
print
(
" fmcSlot (LUN) = "
+
str
(
fmcSlot
))
print
(
" c
hannel = "
+
str
(
channel
)
)
if
polarity
==
"stop"
:
print
(
" c
ommand = stop"
)
else
:
print
(
" c
ommand = "
+
command
)
if
command
==
"configure"
or
command
==
"stop"
:
print
(
" c
hannel = "
+
str
(
channel
)
)
if
command
==
"configure"
:
if
polarity
is
1
:
print
(
" polarity = "
+
str
(
polarity
)
+
" (positive pulses)"
)
else
:
...
...
@@ -75,11 +82,12 @@ print("")
if
fmcSlot
is
not
0
and
fmcSlot
is
not
1
:
raise
Exception
(
"fmcSlot (LUN) can be only 0 or 1!"
);
if
channel
is
not
1
and
channel
is
not
2
:
raise
Exception
(
"channel can be only 1 or 2!"
);
if
polarity
is
not
0
and
polarity
is
not
1
and
polarity
is
not
"stop"
:
raise
Exception
(
"polarity can be only 0 or 1!"
);
if
polarity
!=
"stop"
:
if
command
==
"configure"
or
command
==
"stop"
:
if
channel
is
not
1
and
channel
is
not
2
:
raise
Exception
(
"channel can be only 1 or 2!"
);
if
command
==
"configure"
:
if
polarity
is
not
0
and
polarity
is
not
1
:
raise
Exception
(
"polarity can be only 0 or 1!"
);
if
pulseWidth
<=
0
:
raise
Exception
(
"pulseWidth has to be > 0 ns!"
);
if
pulseDelay
<
0
:
...
...
@@ -97,6 +105,8 @@ def PrintFrequency(pg):
else
:
print
(
"RF clock frequency: (unstable)"
)
# import pdb; pdb.set_trace()
# create FFPG driver for FMC slot
pg
=
Ffpg
(
fmcSlot
)
...
...
@@ -107,7 +117,7 @@ pg = Ffpg(fmcSlot)
# pg.wb.SetDebugSv("wb_trace.svh")
# stop and disable channel
if
polarity
==
"stop"
:
if
command
==
"stop"
:
pg
.
StopChannel
(
channel
)
pg
.
DisableChannel
(
channel
)
print
"Done, channel stopped."
...
...
@@ -115,13 +125,22 @@ if polarity == "stop":
sys
.
exit
();
# initialize the driver
# pg.Reset() # this clears and stops both channel effectively inhibiting possibility of both channels running
if
command
==
"init"
:
pg
.
Reset
()
pg
.
SelectClock
(
"external"
,
400.789
)
pg
.
SetRatio
(
2
)
pg
.
SetOverflow
(
17820
)
pg
.
Ad9512Sync
()
pg
.
SetTriggerThreshold
(
0.5
)
pg
.
SetVcxoFrequency
(
-
0.2105
)
# 125.0000 MHz
print
"Done, driver initialized."
print
""
sys
.
exit
();
pg
.
SelectClock
(
"external"
,
400.789
)
pg
.
SetRatio
(
2
)
pg
.
SetOverflow
(
17820
)
pg
.
Ad9512Sync
()
pg
.
SetTriggerThreshold
(
0.5
)
pg
.
SetVcxoFrequency
(
-
0.2105
)
# 125.0000 MHz
# calibration
print
(
"Calibrating channel "
+
str
(
channel
)
+
" on FMC slot "
+
str
(
fmcSlot
)
+
" to "
+
str
(
triggerLatency
)
+
" ns"
)
if
triggerLatency
>
-
1
:
...
...
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