-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsurf_board.py
More file actions
72 lines (55 loc) · 1.65 KB
/
Copy pathsurf_board.py
File metadata and controls
72 lines (55 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import surf
import sys
import calibrations.surf_calibrations as surf_cal
import time
#sys.path.insert(0, '/home/anita/astroparticlelab/')
def do(board):
dev=surf.Surf()
print 'identify:'
dev.identify()
print 'path:', dev.path
dev.labc.run_mode(0)
dev.labc.testpattern_mode(0)
dev.labc.reset_fifo()
dev.labc.reset_ramp()
dev.labc.dll(15) #disable DLL
time.sleep(1)
dev.i2c.default_config()
dev.clock(dev.internalClock)
dev.labc.default() #send default values to LAB registers
dev.set_phase(2)
dev.labc.automatch_phab(15)
if not surf_cal.check_board(board, dev.dna()):
print 'adding board to calibration json file..'
surf_cal.add_board(board, dev.dna())
else:
print 'cal file entry already exists for board: ', board
#
# if surf_cal.read_vadjn(dev.dna()) == None:
# print 'scanning for Vadjn..'
# vadjn = []
# for i in range(12):
# vadjn.append(dev.labc.autotune_vadjn(i))
#
# surf_cal.save_vadjn(dev.dna(), vadjn)
#
if surf_cal.read_vadjp(dev.dna()) == None:
print 'scanning for Vadjp..'
vadjp = []
for i in range(12):
vadjp.append(dev.labc.autotune_vadjp(i))
surf_cal.save_vadjp(dev.dna(), vadjp)
##turn on the DLL
time.sleep(1)
dev.labc.dll(15, mode=True)
##show the board status
dev.status()
return dev
if __name__ == '__main__':
board = 'CANOES'
if len(sys.argv) > 1:
board = sys.argv[1]
print '************************'
print 'boarding SURFv5:', board
print '************************'
do(board)