20
D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

Embed Size (px)

Citation preview

Page 1: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

D0 CFT AFE Module

Phase V Test StandVBA Based Control Code

PPD / EED VBA Class Session IIIMay, 18 2004

M. Matulik

Page 2: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 2

Page 3: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 3

VB_Writew

Function VB_Writew(Address As Long, lValue As Long) As Integer Dim i As Integer i = writevmeli(Address, lValue) VB_Writew = iEnd Function

Page 4: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 4

InitializeSASEQ

Static Function InitializeSASEQ(lHDIEnable As Long) As Integer'Performs the operation of initializing the SASEQ. This results in the SVX chips being placed'into initialize mode, ready for downloading. In addition, the parameter passed to this procedure'is used to control the HDI enable bits (controls the output enables on the transceiver(s) connected'to the SVX control and data busses).''This sequence was copied from the SASEQ initialization list processor worksheet''Required modules: io_617.bas or equivalent''Compiled: M. Matulik

Dim iPlace As IntegerDim lAdd As LongDim lVal As Long

InitializeSASEQ = 0 iPlace = VB_clrlatcherri ' clear the latching bit3 status error flg' Write to SASEQ CROSSWID register lAdd = lSASeqBaseAdd + 6 '0x50D006 lVal = 48 '0x30 iPlace = VB_Writew(lAdd, lVal)' Write to SASEQ CALVOLT register lAdd = lSASeqBaseAdd + 8 '0x50d008 lVal = 0

Page 5: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 5

InitializeSASEQ

lVal = 18 '0x12 iPlace = VB_Writew(lAdd, lVal)' Write to SASEQ PCID register lAdd = lSASeqBaseAdd + 12 '0x50D00C lVal = 208 '0xD0 iPlace = VB_Writew(lAdd, lVal)' Write to SASEQ IGNORE register (controls HDI enable) lAdd = lSASeqBaseAdd + 18 '0x50D012 lVal = lHDIEnable '0x03 enable HDI on chain 1 and 2 '0x12 ignore chain 1, enable HDI on chain 2 '0x21 ignore chain 2, enable HDI on chain 1 '0x30 ignore both chains, disable HDIs on both chains iPlace = VB_Writew(lAdd, lVal)' Write to SASEQ CSR lAdd = lSASeqBaseAdd + 14 '0x50D00E lVal = 166 '0xA6 iPlace = VB_Writew(lAdd, lVal)' Write to SASEQ TRIGGER register lAdd = lSASeqBaseAdd + 24 '0x50D018 lVal = 0 ' set 132ns mode iPlace = VB_Writew(lAdd, lVal)' Write to SASEQ TRIGGER register lAdd = lSASeqBaseAdd + 24 '0x50D018 lVal = 128 '0x80 set idle mode iPlace = VB_Writew(lAdd, lVal)

Page 6: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 6

InitializeSASEQ

If VB_islatcherri = 0 Then 'No VME errors detected Else InitializeSASEQ = 1 iErrorCode = iSaseqError iTestCode = iSaseqInit iChannelNumber = -1 sErrorValue = -1 iBoardHanded = -1 Call SortErrors End If End Function

Page 7: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 7

Page 8: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 8

Scope of AFE Test Stand Code

Trivial user entry Entry error checking.

Verify Test Stand Hardware Functionality Complete Test of AFE Module

Verify 1553 Communication Path. Verify the Functionality of the FIFO. Verify Revision Level of Micro Firmware. Download VSVX CPLD parameters.

Page 9: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 9

Scope of AFE Test Stand Code

Complete Test of AFE Module Download SVX parameters. Perform VRef Sweep to determine

operating point for each of the 32 SIFT chips on the AFE Module.Use these operating points for subsequent

Data Collection.

Page 10: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 10

Scope of AFE Test Stand Code

Complete Test of AFE Module Perform Data Collection Routine.

Write test specific values to registers on AFE Module and AFE Test Module.

Obtain Digitized Mean and Discriminator Occupancy for all channels.

Perform VLPC Bias Voltage and Cryogenic Temperature Control Tests as necessary.

Page 11: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 11

Scope of AFE Test Stand Code

Complete Test of AFE Module Analyze Channel Data for Correct

Values of Discriminator Occupancy and Digitized Mean.Three types of AFE Modules can be tested

with different expected Mean values.

Generate ACSII files listing results of tests just completed, appending to files of previous test results.

Page 12: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 12

Scope of AFE Test Stand Code

Save raw data of test results to ASCII files for off-line, more extensive data analysis.

Page 13: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 13

Page 14: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 14

Page 15: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 15

Page 16: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 16

Phase V AFE Test Stand VBA code

Collaborative effort, 5+ people writing code.

Highly modular – each code writer responsible for syntax within own module(s).

Pass variables to called functions. Use of global variables across all

modules.

Page 17: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 17

Phase V AFE Test Stand VBA code

Code sections freely stolen from existing/running VBA code, modified to utilize globally defined variables.

Each imported module was required to compile without errors – each code writer was given the most recent copy of the code.

Logic errors corrected during debug.

Page 18: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 18

Phase V AFE Test Stand VBA code

What did we wind up with? A lot of code. A lot of experience. A functioning set of code. A useful base for generating diagnostic

programs.

Page 19: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 19

Phase V AFE Test Stand VBA code

What would we change? Don’t rely as much on global variables. Insist on a more common coding style

from all of the programmers. Take more time up front to optimize

subroutine and function operation.

Page 20: D0 CFT AFE Module Phase V Test Stand VBA Based Control Code PPD / EED VBA Class Session III May, 18 2004 M. Matulik

EED

PPD / EED VBA Session III

May 18, 2004 20

When you have problems:

Verify logic. Check passed variables. Call 2554.