Commit d4ca5732 authored by Jan Pospisil's avatar Jan Pospisil

more debugging...

parent 8f664e40
......@@ -51,12 +51,11 @@ def toBin(x, count=8):
""" Integer to binary. Count is number of padding bits """
return "".join(map(lambda y:str((x>>y)&1), range(count-1, -1, -1)))
def hexDump( dataArray, bitsPerWord = 32, binary = False ):
def hexDump( dataArray, bitsPerWord = 32, binary = False, columns = 8 ):
"""
the ultimate hexDump function
first column is byte-wise address
"""
columns = 8
i = 0
for word in dataArray:
if i%columns == 0:
......
......@@ -64,7 +64,7 @@ calibrationData = [ # -1 = uncalibrated
fmcSlot = 1 # 0 | 1
channel = 2 # 1 | 2
ad9512Config = (
ad9512ConfigOriginal = (
(0x34, 0x01),
(0x35, 0x00),
(0x36, 0x00),
......@@ -83,6 +83,25 @@ ad9512Config = (
(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]
......@@ -162,10 +181,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, channel)
# TestSinglePulse(pg, 1)
# TestSinglePulse(pg, 2)
# create bunched pulses
# TestBunchPulses(pg, channel)
......@@ -195,19 +216,29 @@ pg.PrintDebug()
# pg.wb.SetDebugSv("")
# pg.wb.SetDebugSv("wb_trace.svh")
# # pg.ad9512._WriteConfig1(0x55)
# # pg.wb.Read("SpiBase", Offset = 1)
# pg.ad9512.Write(0x4A, 0x55)
# pg.ad9512.Write(0x5A, 0x1)
# pg.ad9512.Write(0x4A, 0x55, True)
# print(hex(pg.ad9512.Read(0x4A)))
# print(hex(pg.ad9512.Read(0x4A)))
# print(hex(pg.ad9512.Read(0x4A)))
# print(hex(pg.ad9512.Read(0x4A)))
# print(hex(pg.ad9512.Read(0x4A)))
# print(hex(pg.ad9512.Read(0x4A)))
# pg.wb.SetDebugSv("")
# pg.ad9512.Write(0x4A, 0x55, True)
# while True:
# pg.ad9512.Read(0x4A)
# time.sleep(0.2)
# for i in range(0, 0x5b):
# pg.ad9512.Write(0x4A, 0x55)
# time.sleep(0.2)
# # print "[0x%02x]: 0x%02x" % (i, pg.ad9512.Read(0x4A))
# RegsCount = 0x5A
# Regs = range(0, RegsCount+1)
# for i in range(0, RegsCount+1):
# Regs[i] = pg.ad9512.Read(i)
# hexDump(Regs, bitsPerWord = 8, columns = 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment