DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
timing.shells.boards.BoardShell Class Reference
Inheritance diagram for timing.shells.boards.BoardShell:
[legend]
Collaboration diagram for timing.shells.boards.BoardShell:
[legend]

Public Member Functions

 soft_reset (self)
 
 enableI2CSwitch (self)
 
 readUID (self)
 
 scanI2C (self)
 
 pingI2CSlaves (self)
 
 measureClockFrequency (self)
 
 status (self)
 
 pllstatus (self, verbose=False)
 

Public Attributes

 i2cMasters = lIO.getNode(lI2CName)
 

Detailed Description

docstring for BoardShell

Definition at line 21 of file boards.py.

Member Function Documentation

◆ enableI2CSwitch()

timing.shells.boards.BoardShell.enableI2CSwitch ( self)

Reimplemented in timing.shells.fmc.FMCShell.

Definition at line 36 of file boards.py.

36 def enableI2CSwitch(self):
37 try:
38 # Wake up the switch
39 self.getAX3Slave().write_i2c(0x01, 0x7f)
40 except RuntimeError:
41 pass
42
43 x = self.getAX3Slave().read_i2c(0x01)
44 return x

◆ measureClockFrequency()

timing.shells.boards.BoardShell.measureClockFrequency ( self)

Definition at line 82 of file boards.py.

82 def measureClockFrequency(self):
83 lDevice = self.device
84 lBoardType = self.info.boardType
85
86 # secho("PLL Clock frequency measurement:", fg='cyan')
87 # Measure the generated clock frequency
88 freqs = {}
89 for i in range(1 if lBoardType == kBoardTLU else 2):
90 lDevice.getNode("io.freq.ctrl.chan_sel").write(i)
91 lDevice.getNode("io.freq.ctrl.en_crap_mode").write(0)
92 lDevice.dispatch()
93 time.sleep(2)
94 fq = lDevice.getNode("io.freq.freq.count").read()
95 fv = lDevice.getNode("io.freq.freq.valid").read()
96 lDevice.dispatch()
97 freqs[i] = int(fq) * 119.20928 / 1000000 if fv else 'NaN'
98
99 lFreqs = {
100 'PLL': freqs[0]
101 }
102 if lBoardType != kBoardTLU:
103 lFreqs['CDR'] = freqs[1]
104
105 return lFreqs
106

◆ pingI2CSlaves()

timing.shells.boards.BoardShell.pingI2CSlaves ( self)

Definition at line 69 of file boards.py.

69 def pingI2CSlaves(self):
70 lIO = self.device.getNode('io')
71 lRes = {}
72 for lI2CName in self.i2cMasters:
73 lI2CNode = lIO.getNode(lI2CName)
74 for lSlaveName in lI2CNode.get_slaves():
75 lRes[lI2CName+'.'+lSlaveName] = (lSlaveName, lI2CNode.get_slave_address(lSlaveName), lI2CNode.get_slave(lSlaveName).ping())
76
77 return lRes

◆ pllstatus()

timing.shells.boards.BoardShell.pllstatus ( self,
verbose = False )

Definition at line 122 of file boards.py.

122 def pllstatus(self, verbose=False):
123 def dec_rng( word, ibit, nbits=1):
124 return (word >> ibit) & ((1<<nbits)-1)
125
126 lDevice = self.device
127 lBoardType = self.info.boardType
128 lIO = lDevice.getNode('io')
129
130 # Access the clock chip
131 if lBoardType in [kBoardPC059, kBoardTLU]:
132 lI2CBusNode = lIO.getNode("i2c")
133 lSIChip = SI534xSlave(lI2CBusNode, lI2CBusNode.get_slave('SI5345').get_i2c_address())
134 else:
135 lSIChip = lIO.getNode('pll_i2c')
136
137 # echo("PLL Configuration id: {}".format(style(lSIChip.read_config_id(), fg='cyan')))
138 # secho("PLL Information", fg='cyan')
139 lConfigID = lSIChip.read_config_id()
140 lVersion = collections.OrderedDict()
141 lVersion['Part number'] = lSIChip.read_device_version()
142 lVersion['Device grade'] = lSIChip.read_clock_register(0x4)
143 lVersion['Device revision'] = lSIChip.read_clock_register(0x5)
144 # toolbox.printRegTable(lVersion)
145
146 w = lSIChip.read_clock_register(0xc)
147
148 lRegisters = collections.OrderedDict()
149 lRegisters['SYSINCAL'] = dec_rng(w, 0)
150 lRegisters['LOSXAXB'] = dec_rng(w, 1)
151 lRegisters['XAXB_ERR'] = dec_rng(w, 3)
152 lRegisters['SMBUS_TIMEOUT'] = dec_rng(w, 5)
153
154 w = lSIChip.read_clock_register(0xd)
155
156 lRegisters['LOS'] = dec_rng(w, 0, 4)
157 lRegisters['OOF'] = dec_rng(w, 4, 4)
158
159 w = lSIChip.read_clock_register(0xe)
160
161 lRegisters['LOL'] = dec_rng(w, 1)
162 lRegisters['HOLD'] = dec_rng(w, 5)
163
164 w = lSIChip.read_clock_register(0xf)
165 lRegisters['CAL_PLL'] = dec_rng(w, 5)
166
167 w = lSIChip.read_clock_register(0x11)
168 lRegisters['SYSINCAL_FLG'] = dec_rng(w, 0)
169 lRegisters['LOSXAXB_FLG'] = dec_rng(w, 1)
170 lRegisters['XAXB_ERR_FLG'] = dec_rng(w, 3)
171 lRegisters['SMBUS_TIMEOUT_FLG'] = dec_rng(w, 5)
172
173 w = lSIChip.read_clock_register(0x12)
174 lRegisters['OOF (sticky)'] = dec_rng(w, 4, 4)
175
176 # secho("PLL Status", fg='cyan')
177 return (lConfigID, lVersion, lRegisters)
178 # toolbox.printRegTable(lRegisters)
179# ------------------------------------------------------------------------------
180
181

◆ readUID()

timing.shells.boards.BoardShell.readUID ( self)

Definition at line 49 of file boards.py.

49 def readUID(self):
50 lValues = self.getUIDSlave().read_i2cArray(0xfa, 6)
51 lUniqueID = 0x0
52 for lVal in lValues:
53 lUniqueID = ( lUniqueID << 8 ) | lVal
54 return lUniqueID

◆ scanI2C()

timing.shells.boards.BoardShell.scanI2C ( self)

Definition at line 59 of file boards.py.

59 def scanI2C(self):
60 lIO = self.device.getNode('io')
61 lRes = {}
62 for lI2CName in self.i2cMasters:
63 lRes[lI2CName] = lIO.getNode(lI2CName).scan()
64 return lRes

◆ soft_reset()

timing.shells.boards.BoardShell.soft_reset ( self)

Definition at line 26 of file boards.py.

26 def soft_reset(self):
27 lIO = self.device.getNode('io')
28
29 # Global soft reset
30 lIO.getNode('csr.ctrl.soft_rst').write(0x1)
31 lIO.getClient().dispatch()

◆ status()

timing.shells.boards.BoardShell.status ( self)

Definition at line 108 of file boards.py.

108 def status(self):
109 def dec_rng( word, ibit, nbits=1):
110 return (word >> ibit) & ((1<<nbits)-1)
111
112 lDevice = self.device
113 lIO = lDevice.getNode('io')
114
115 # echo()
116 # echo( "--- " + style("IO status", fg='cyan') + " ---")
117 return toolbox.readSubNodes(lIO.getNode('csr.stat'))

Member Data Documentation

◆ i2cMasters

timing.shells.boards.BoardShell.i2cMasters = lIO.getNode(lI2CName)

Definition at line 62 of file boards.py.


The documentation for this class was generated from the following file: