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
42357774
Commit
42357774
authored
Apr 04, 2017
by
Jan Pospisil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved AD9512 Config/Check methods to proper class
parent
5a5ceb58
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
52 deletions
+35
-52
AD9512.py
sw/AD9512.py
+26
-3
FFPG_driver.py
sw/FFPG_driver.py
+9
-49
No files found.
sw/AD9512.py
View file @
42357774
from
Spi
import
*
from
CommonFunctions
import
*
class
AD9512
(
Spi
):
Ad9512
Config
=
{
_Spi
Config
=
{
"Channel"
:
0
,
"CPol"
:
0
,
"CPha"
:
0
,
...
...
@@ -13,7 +14,7 @@ class AD9512(Spi):
}
def
__init__
(
self
,
wbOverlay
,
SpiBaseAddress
,
SpiOffset
=
0
):
super
(
AD9512
,
self
)
.
__init__
(
wbOverlay
,
self
.
Ad9512
Config
,
SpiBaseAddress
,
SpiOffset
)
super
(
AD9512
,
self
)
.
__init__
(
wbOverlay
,
self
.
_Spi
Config
,
SpiBaseAddress
,
SpiOffset
)
def
Write
(
self
,
Address
,
Data
,
SelfCommit
=
False
):
RnW
=
0
...
...
@@ -38,4 +39,26 @@ class AD9512(Spi):
return
Data
def
Commit
(
self
):
self
.
Write
(
0x5a
,
1
)
\ No newline at end of file
self
.
Write
(
0x5a
,
1
)
def
Config
(
self
,
Config
):
for
Register
in
Config
:
Address
=
Register
[
0
]
Data
=
Register
[
1
]
self
.
Write
(
Address
,
Data
)
self
.
Commit
()
def
Check
(
self
,
Config
):
print
"Checking AD9512 configuration..."
errors
=
0
for
Register
in
Config
:
Address
=
Register
[
0
]
Data
=
Register
[
1
]
DataRead
=
self
.
Read
(
Address
)
if
Data
<>
DataRead
:
ErrorMsg
(
"Data at address 0x
%02
x are different! Data read = 0x
%02
x, should be 0x
%02
x"
%
(
Address
,
DataRead
,
Data
))
errors
+=
1
if
errors
==
0
:
OkMsg
(
"no error found"
)
else
:
ErrorMsg
(
"found
%
d errors!"
%
errors
)
sw/FFPG_driver.py
View file @
42357774
...
...
@@ -51,7 +51,6 @@
##-----------------------------------------------------------------------------
import
time
from
CommonFunctions
import
*
from
Ffpg
import
*
# triggerPhase = 53.76 # same for both channels in the test setup
...
...
@@ -62,9 +61,9 @@ calibrationData = [ # -1 = uncalibrated
]
fmcSlot
=
1
# 0 | 1
channel
=
2
# 1 | 2
channel
=
1
# 1 | 2
ad9512Config
Original
=
(
ad9512Config
=
(
(
0x34
,
0x01
),
(
0x35
,
0x00
),
(
0x36
,
0x00
),
...
...
@@ -83,47 +82,6 @@ ad9512ConfigOriginal = (
(
0x58
,
0x20
)
)
ad9512Config
=
(
(
0x34
,
0x01
),
(
0x35
,
0x00
),
(
0x36
,
0x00
),
(
0x3f
,
0x03
),
(
0x45
,
0x05
),
(
0x4a
,
0x00
),
(
0x4c
,
0x00
),
(
0x4e
,
0x00
),
(
0x50
,
0x00
),
(
0x52
,
0x00
),
(
0x4b
,
0x40
),
(
0x4d
,
0x40
),
(
0x4f
,
0x40
),
(
0x51
,
0x40
),
(
0x53
,
0x40
),
(
0x58
,
0x20
)
)
def
Ad9512Config
(
pg
,
Config
):
for
Register
in
Config
:
Address
=
Register
[
0
]
Data
=
Register
[
1
]
pg
.
ad9512
.
Write
(
Address
,
Data
)
pg
.
ad9512
.
Commit
()
def
Ad9512Check
(
pg
,
Config
):
print
"Checking AD9512 configuration..."
errors
=
0
for
Register
in
Config
:
Address
=
Register
[
0
]
Data
=
Register
[
1
]
DataRead
=
pg
.
ad9512
.
Read
(
Address
)
if
Data
<>
DataRead
:
ErrorMsg
(
"Data at address 0x
%02
x are different! Data read = 0x
%02
x, should be 0x
%02
x"
%
(
Address
,
DataRead
,
Data
))
errors
+=
1
if
errors
==
0
:
OkMsg
(
"no error found"
)
else
:
ErrorMsg
(
"found
%
d errors!"
%
errors
)
def
Init
(
pg
):
global
calibrationData
global
ad9512Config
...
...
@@ -132,7 +90,7 @@ def Init(pg):
pg
.
SelectClock
(
"external"
,
400.789
)
pg
.
SetRatio
(
2
)
Ad9512Config
(
pg
,
ad9512Config
)
pg
.
ad9512
.
Config
(
ad9512Config
)
pg
.
SetOverflow
(
17820
)
pg
.
Ad9512Sync
()
...
...
@@ -150,7 +108,7 @@ def Init(pg):
def
TestSinglePulse
(
pg
,
channel
):
pg
.
ResetBadState
(
channel
)
pg
.
CreateSinglePulse
(
channel
,
start
=
0
,
width
=
5
0
,
polarity
=
1
)
pg
.
CreateSinglePulse
(
channel
,
start
=
10
*
(
channel
-
1
),
width
=
1
0
,
polarity
=
1
)
pg
.
EnableChannel
(
channel
)
pg
.
StartChannel
(
channel
)
...
...
@@ -181,12 +139,12 @@ pg = Ffpg(fmcSlot)
# pg.wb.SetDebugSv("wb_trace.svh")
# initialize the driver
#
Init(pg)
Init
(
pg
)
# create single pulse
# TestSinglePulse(pg, channel)
#
TestSinglePulse(pg, 1)
#
TestSinglePulse(pg, 2)
TestSinglePulse
(
pg
,
1
)
TestSinglePulse
(
pg
,
2
)
# create bunched pulses
# TestBunchPulses(pg, channel)
...
...
@@ -202,6 +160,8 @@ pg.PrintControl()
pg
.
PrintStatus
()
pg
.
PrintDebug
()
# pg.ad9512.Check(ad9512Config)
# pg.ad9512.debug = True
# pg.wb.SetDebug(True)
...
...
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