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
dbefc491
Commit
dbefc491
authored
Aug 16, 2016
by
Jan Pospisil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved status reporting, added debug register
parent
f66860fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
6 deletions
+26
-6
FFPG_driver.py
sw/FFPG_driver.py
+26
-6
No files found.
sw/FFPG_driver.py
View file @
dbefc491
...
...
@@ -152,9 +152,9 @@ def Ad9512Init():
# power down unused output (OUT2)
SpiWrite
(
0x3f
,
0x03
)
# fine delay
SpiWrite
(
0x34
,
0x0
)
# use fine delay
delay
=
1
# 0-31
SpiWrite
(
0x36
,
(
delay
&
0x1f
)
<<
1
)
# set fine delay
#
SpiWrite(0x34, 0x0) # use fine delay
#
delay = 1 # 0-31
#
SpiWrite(0x36, (delay&0x1f)<<1) # set fine delay
# select CLK1 input, power down CLK2 input
SpiWrite
(
0x45
,
0x05
)
# output frequency 200 MHz (divide by 2)
...
...
@@ -285,12 +285,24 @@ def DeletePulse(channel, start, stop):
ConfigurePulse
(
channel
,
start
,
stop
,
0
)
def
PrintBit
(
value
,
bit
,
label
,
ifSet
,
ifNotSet
):
print
(
' '
+
'['
+
str
(
bit
)
+
']'
+
label
+
':'
)
print
(
' '
+
'['
+
str
(
bit
)
+
']
'
+
label
+
':'
)
if
value
&
(
1
<<
bit
):
print
(
ConColors
.
GREEN
+
' 1: '
+
ifSet
+
ConColors
.
NONE
)
else
:
print
(
ConColors
.
RED
+
' 0: '
+
ifNotSet
+
ConColors
.
NONE
)
def
PrintBits
(
value
,
bitFrom
,
bitTo
,
label
,
descriptions
):
print
(
' '
+
'['
+
str
(
bitTo
)
+
':'
+
str
(
bitFrom
)
+
'] '
+
label
+
':'
)
value
&=
(
1
<<
bitTo
+
1
)
-
1
value
>>=
bitFrom
if
value
>
len
(
descriptions
)
-
1
:
color
=
ConColors
.
RED
description
=
'<unknown>'
else
:
color
=
ConColors
.
YELLOW
description
=
descriptions
[
value
]
print
(
color
+
' '
+
str
(
value
)
+
': '
+
description
+
ConColors
.
NONE
)
def
Status
():
print
(
'Status register:'
)
status
=
WbRead
(
'status'
)
...
...
@@ -307,11 +319,12 @@ def Status():
def
Control
():
print
(
'Control register: '
)
control
=
WbRead
(
'control'
)
# PrintBits(control, 0, 1, 'Clock selection', ('external clock', 'FPGA LOOP', 'onboard VCXO')) # not implemented
PrintBit
(
control
,
0
,
'Clock mux'
,
'VCXO'
,
'FPGA LOOP'
)
PrintBit
(
control
,
2
,
'Channel 1 output'
,
'enabled'
,
'disabled'
)
PrintBit
(
control
,
3
,
'Channel 2 output'
,
'enabled'
,
'disabled'
)
PrintBit
(
control
,
4
,
'Channel 1 mode'
,
'continuous'
,
'stop/one-shot'
)
PrintBit
(
control
,
6
,
'Channel 2 mode'
,
'continuous'
,
'stop/one-shot'
)
PrintBit
s
(
control
,
4
,
5
,
'Channel 1 mode'
,
(
'stopped'
,
'continuous'
,
'one-shot'
)
)
PrintBit
s
(
control
,
6
,
7
,
'Channel 2 mode'
,
(
'stopped'
,
'continuous'
,
'one-shot'
)
)
PrintBit
(
control
,
8
,
'LEDs'
,
'blinking'
,
'normal operation'
)
PrintBit
(
control
,
9
,
'AD9512'
,
'in reset'
,
'running'
)
...
...
@@ -337,6 +350,12 @@ def Stop(channel):
channel
*=
2
WbSetBits
(
'control'
,
0x30
<<
channel
,
0
)
# set mode STOP
def
Debug
():
print
(
'Debug:'
)
debug
=
WbRead
(
'debug'
)
PrintBits
(
debug
,
0
,
2
,
"CH1 FSM state"
,
(
"Stop"
,
"WaitForTrigger"
,
"Generating"
,
"Outputting"
,
"WaitForEnd"
))
PrintBits
(
debug
,
3
,
5
,
"CH2 FSM state"
,
(
"Stop"
,
"WaitForTrigger"
,
"Generating"
,
"Outputting"
,
"WaitForEnd"
))
###################################################################
## Test functions
###################################################################
...
...
@@ -390,6 +409,7 @@ TestPulse(1)
# TestPulse(2)
Control
()
Status
()
Debug
()
###################################################################
## debug ending
...
...
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