SuperKEKB XRM system, Page 2 of 2  Not logged in ELOG logo
ID Date Author Type Subject
  21   Fri Oct 4 10:18:44 2019 M. Andrewdocumentationinstructions for checking boardstack status and temperature
This is done from sixrmlaptop02 (a.k.a. balrog017).  These scripts are not in the $PATH, so you must cd to ~/build/uh-svn-repo/trunk/software/b2l/scripts_dev before running them.

To check basic status (whether you can talk to a boardstack, which firmware is programmed on it, what the temperature is, etc):
idlab@balrog017:~/build/uh-svn-repo/trunk/software/b2l/scripts_dev$ ./get_status.py 0
Writing output from ./get_status.py to logfile: logs/2019-10-05.051508.s17a.SCROD004.get_status.log
SCROD #4 RawVoltages: 1.880 V 3.861 V 4.807 V
 WARNING: RAW2 voltage unnecessarily high (by 0.762 V)
 WARNING: RAW3 voltage unnecessarily high (by 0.383 V)
         FPGA_ver ARM_ver  trigMask DieTemp WallTemp -----other------ ARM_stat
   SCROD 00010095 0000006e 0000000f  52.7 C  34.5 C  31.1 C  13.2 %RH Running
carrier0 00000062 00000021 00000000  61.1 C  43.8 C  39.0 C  41.8 C   Running
carrier1 00000062 00000021 00000000  60.2 C  46.0 C  41.2 C  44.2 C   Running
carrier2 00000062 00000021 00000000  59.9 C  46.0 C  42.2 C  44.8 C   Running
carrier3 00000062 00000021 00000000  60.7 C  44.2 C  41.5 C  43.2 C   Running
readoutBitSlip (IRSX config?) = [0, 0, 0, 0]
readoutWindows (prep done?)   = [0, 0, 0, 0]
Feature extraction mode       = 0 Normal
SCROD_AxiCommon_asicTimeoutMask: 0
ProcessPacketProblemCounter = 0
nSamplesWrongCounter = 0
SCROD_PS_EXTENDED_STATUS_ADDR = 0x1
SCROD_PS_pendingWaves = 0
SCROD_PS_procEventCnt = 0
SCROD_PS_totalWaves = 0
SCROD_AxiCommon_eventCnt = 0
SCROD_AxiCommon_pendingEventCount = 0
SCROD_AxiCommon_maxPendingEventCount = 0
SCROD_PS_AXI_FAULT_STATUS_ADDR = 0x0
SCROD_PS_AXI_FAULT_ADDRESS_ADDR = 0x0
SCROD_PS_OFFENDING_ADDRESS0_ADDR = 0x0
SCROD_PS_OFFENDING_ADDRESS1_ADDR = 0x0

Note:  Before configuration, the warning messages about the raw voltages being too high should be ignored.

To check detailed temperature, humidity and power draw:
idlab@balrog017:~/build/uh-svn-repo/trunk/software/b2l/scripts_dev$ ./log_temps.py 0
Writing output from ./log_temps.py to logfile: logs/2019-10-05.052200.s17a.SCROD004.log_temps.log

------------------------------------------------------------
s17a.SCROD004  DATE 2019-10-05 05:22:00.661181
Parameter          SCROD carrier0 carrier1 carrier2 carrier3
----------         ----- -------- -------- -------- --------
fwVersion       00010095 00000062 00000062 00000062 00000062
elfVersion      0000006e 00000021 00000021 00000021 00000021
------------------------------------------------------------
tempFPGA          53.6 C   61.4 C   60.8 C   60.5 C   60.7 C
tempFPGAMAX       55.6 C   63.7 C   62.8 C   62.9 C   63.5 C
tempWall          35.0 C   44.2 C   46.5 C   46.5 C   44.8 C
tempWallMAX       35.0 C   44.2 C   46.8 C   46.5 C   45.0 C
tADC0                                                       
tADC0MAX                                                    
tADC1                                                       
tADC1MAX                                                    
tempASIC01                 39.5 C   41.8 C   42.8 C   42.0 C
tempASIC23                 42.2 C   45.0 C   45.5 C   43.8 C
tempASIC01MAX              39.5 C   42.0 C   42.8 C   42.0 C
tempASIC23MAX              42.2 C   45.0 C   45.5 C   43.8 C
humidityTemp      31.3 C                                    
humidityTempMAX   31.3 C                                    
trigTranTemp                                                
trigTranTempMAX                                             
dataTranTemp       0.0 C                                    
dataTranTempMAX    0.0 C                                    
tempMAX           55.6 C   63.7 C   62.8 C   62.9 C   63.5 C
maximum temperature measured on this boardstack is:   63.7 C
------------------------------------------------------------
humidity         12.9 %RH                                    
------------------------------------------------------------
vRAW1            1.875 V                                    
vRAW2            3.860 V                                    
 WARNING: RAW2 voltage unnecessarily high (by 0.761 V)
vRAW3            4.803 V                                    
 WARNING: RAW3 voltage unnecessarily high (by 0.379 V)
vPINT1p0         0.990 V  1.014 V  1.004 V  0.997 V  1.004 V
vINT1p0          0.994 V  1.012 V  1.004 V  0.998 V  1.003 V
vBRAM1p0         0.994 V  1.012 V  1.004 V  0.998 V  1.004 V
vGTX1p0          0.998 V                                    
vGTX1p2          1.194 V                                    
vDDR1p2          1.193 V                                    
vPLLPAUX1p8      1.800 V  1.805 V  1.807 V  1.801 V  1.802 V
vAUXIO1p8        1.795 V                                    
vAUX1p8          1.792 V  1.813 V  1.795 V  1.795 V  1.796 V
vVCCO1p8         1.795 V                                    
v2p5             2.494 V                                    
vMIO2p5          2.492 V                                    
vVCCO2p5         2.492 V                                    
v3p3             3.266 V                                    
vASIC0                                                      
vASIC1                                                      
vASIC2                                                      
vASIC3                                                      
vRAW1            1.875 V                                    
vRAW2            3.860 V                                    
 WARNING: RAW2 voltage unnecessarily high (by 0.761 V)
vRAW3            4.803 V                                    
 WARNING: RAW3 voltage unnecessarily high (by 0.379 V)
------------------------------------------------------------
iPINT1p0                                                    
iINT1p0           921 mA                                    
iBRAM1p0           17 mA                                    
iGTX1p0           679 mA                                    
iGTX1p2           468 mA                                    
iDDR1p2            52 mA                                    
iPLLPAUX1p8        84 mA                                    
iAUXIO1p8          29 mA                                    
iAUX1p8           157 mA                                    
iVCCO1p8           83 mA                                    
i2p5              107 mA                                    
iMIO2p5            22 mA                                    
iVCCO2p5           42 mA                                    
i3p3              174 mA                                    
iPINT1p0MAX                                                 
iINT1p0MAX        924 mA                                    
iBRAM1p0MAX        21 mA                                    
iGTX1p0MAX        678 mA                                    
iGTX1p2MAX        471 mA                                    
iDDR1p2MAX         66 mA                                    
iPLLPAUX1p8MAX     91 mA                                    
iAUXIO1p8MAX       32 mA                                    
iAUX1p8MAX        160 mA                                    
iVCCO1p8MAX        87 mA                                    
i2p5MAX           110 mA                                    
iMIO2p5MAX         25 mA                                    
iVCCO2p5MAX        44 mA                                    
i3p3MAX           181 mA                                    
iASIC0                                                      
iASIC1                                                      
iASIC2                                                      
iASIC3                                                      
iASIC0MAX                                                   
iASIC1MAX                                                   
iASIC2MAX                                                   
iASIC3MAX                                                   
------------------------------------------------------------
pASIC0                                                      
pASIC1                                                      
pASIC2                                                      
pASIC3                                                      
pAMPs                                                       
pASICs                                                      
------------------------------------------------------------

Note:  There are no entries for some items above because those features are not present on the "carrier revE2 (special XRM edition)"

Other various scripts are available, some of which have functionality you can guess from the name:
idlab@balrog017:~/build/uh-svn-repo/trunk/software/b2l/scripts_dev$ ls -lart *.py *.sh
-rwxr-x--- 1 idlab idlab  1925 Sep 30  2017 get_n_events.sh
-rwxr-x--- 1 idlab idlab   994 Dec 28  2017 ADC_threshold_scan.sh
-rwxr-x--- 1 idlab idlab   677 Dec 20  2018 b2lreg.py
-rwxr-x--- 1 idlab idlab   609 Jan 15  2019 getReady.sh
-rwxr-x--- 1 idlab idlab  3514 Jan 15  2019 dumpregisters.sh
-rwxr-x--- 1 idlab idlab    95 Feb  9  2019 run_all_gnuplots.sh
-rw-r----- 1 idlab idlab  1163 Feb 14  2019 irsx.py
-rwxr-x--- 1 idlab idlab   694 Mar  2  2019 watchVirtualTTYs.py
-rwxr-x--- 1 idlab idlab   612 Mar  9  2019 setTimeout.py
-rwxr-x--- 1 idlab idlab  3890 Mar  9  2019 scrod_currents.py
-rw-r----- 1 idlab idlab   627 Mar  9  2019 ReadThreshold.py
-rw-r----- 1 idlab idlab   563 Mar  9  2019 ReadFB.py
-rwxr-x--- 1 idlab idlab   777 Mar  9  2019 prep1carrier_data_trueROI.py
-rwxr-x--- 1 idlab idlab  3721 Mar  9  2019 prep1asic_data_trueROI.py
-rwxr-x--- 1 idlab idlab  4155 Mar  9  2019 monitor_temp.py
-rwxr-x--- 1 idlab idlab  1583 Mar  9  2019 live_voltage_readout.py
-rwxr-x--- 1 idlab idlab  9860 Mar  9  2019 juice.py
-rw-r----- 1 idlab idlab 25619 Mar  9  2019 irsxSetFunction.py
-rw-r----- 1 idlab idlab  2356 Mar  9  2019 DebugInfoWarningError24.py
-rwxr-x--- 1 idlab idlab  1100 Mar  9  2019 config1carrier_trueROI.py
-rwxr-x--- 1 idlab idlab  1192 Mar  9  2019 config1carrier_fast.py
-rwxr-x--- 1 idlab idlab 21683 Mar  9  2019 config1asic_trueROI.py
-rwxr-x--- 1 idlab idlab  3323 Mar  9  2019 config1asic_fast.py
-rwxr-x--- 1 idlab idlab  7904 Mar  9  2019 measure_iASIC_as_a_function_of_vbias_and_vbias2.py
-rwxr-x--- 1 idlab idlab 21195 Mar  9  2019 ethudp.py
-rwxr-x--- 1 idlab idlab  4768 Mar 12  2019 scanLoadLatch.py
-rwxr-x--- 1 idlab idlab 34947 Mar 15  2019 threshScan1boardstack.py
-rw-r----- 1 idlab idlab  3686 Mar 16  2019 B2L_errorstats.py
-rwxr-x--- 1 idlab idlab  3388 Mar 21  2019 get_fe_ped.py
-rwxr-x--- 1 idlab idlab   862 Mar 21  2019 config1boardstack_trueROI.py
-rwxr-x--- 1 idlab idlab  6997 Mar 26  2019 get_status.py
-rwxr-x--- 1 idlab idlab 25247 Mar 30  2019 testPollableMemory.py
-rwxr-x--- 1 idlab idlab  6305 Apr  6 08:54 log_temps.py
-rwxr-x--- 1 idlab idlab    68 May 18 09:23 edit.sh
-rwxr-x--- 1 idlab idlab   171 May 23 10:56 what_I_am_doing_right_now.sh
-rw-r----- 1 idlab idlab  1021 May 23 10:56 SCROD_PS_defs.py
-rwxr-x--- 1 idlab idlab  4119 May 23 10:56 prep1boardstack_fe.py
-rwxr-x--- 1 idlab idlab  3816 Jun 22 03:17 config1boardstack_fast.py
-rwxr-x--- 1 idlab idlab  1111 Jun 22 03:18 prep1boardstack_data_trueROI.py
-rwxr-x--- 1 idlab idlab   278 Jun 27 03:49 push_peds.sh
-rwxr-x--- 1 idlab idlab 10903 Sep 18 05:17 xrm.py
  22   Fri Oct 4 10:33:53 2019 M. Andrewdocumentationinstructions for boardstack configuration
This is done from sixrmlaptop02 (a.k.a. balrog017).  These scripts are not in the $PATH, so you must cd to ~/build/uh-svn-repo/trunk/software/b2l/scripts_dev before running them.

To configure the ASICs, set desired modes in the PL/PS (programmable logic/processing system) for operation, and then acquire pedestals:
idlab@balrog017:~/build/uh-svn-repo/trunk/software/b2l/scripts_dev$ ../scripts_rel/configure_boardstack_then_acquire_and_check_pedestals.sh a
/home/idlab/build/uh-svn-repo/trunk/software/b2l/scripts_rel/../scripts_dev/.config
$hslb_list = " a"

running in _fast mode from /home/idlab/build/uh-svn-repo/trunk/software/b2l/scripts_dev

xrm trigger enabled (4ad) = 00000000
number of carriers detected = 4
set up all registers on hslb a (boardstack 0)...
Writing output from ./config1boardstack_fast.py to logfile: logs/2019-10-05.053059.s17a.SCROD004.config1boardstack_fast.log
reg24b2 = 00000000 CARRIER_AxiCommon_heapEnabled
reg44b2 = 00000000 CARRIER_AxiCommon_heapEnabled
reg64b2 = 00000000 CARRIER_AxiCommon_heapEnabled
reg84b2 = 00000000 CARRIER_AxiCommon_heapEnabled
[ 0.000] ##########################################################
[ 0.000] ## Starting configuration of BS 0 / carrier 0 
[ 0.002] Writing trigger thresholds to PS registers
[ 0.020] Writing sstFB values (110, 109, 110, 110) to PS registers
[ 0.022] Starting asic fast autoconfiguration on carrier PS
[ 0.000] ##########################################################
[ 0.000] ## Starting configuration of BS 0 / carrier 1 
[ 0.003] Writing trigger thresholds to PS registers
[ 0.021] Writing sstFB values (110, 110, 110, 109) to PS registers
[ 0.023] Starting asic fast autoconfiguration on carrier PS
[ 0.000] ##########################################################
[ 0.000] ## Starting configuration of BS 0 / carrier 2 
[ 0.005] Writing trigger thresholds to PS registers
[ 0.023] Writing sstFB values (110, 110, 109, 109) to PS registers
[ 0.026] Starting asic fast autoconfiguration on carrier PS
[ 0.000] ##########################################################
[ 0.000] ## Starting configuration of BS 0 / carrier 3 
[ 0.007] Writing trigger thresholds to PS registers
[ 0.026] Writing sstFB values (110, 110, 110, 110) to PS registers
[ 0.028] Starting asic fast autoconfiguration on carrier PS
Wait until all ASICs are configured...
00 0001[1] 0001[1] 0001[1] 0001[1] 
00 0001[7] 0001[7] 0001[7] 0001[7] 
01 0001[7] 0001[7] 0001[7] 0001[7] 
01 0001[7] 0001[7] 0001[7] 0001[7] 
02 0001[7] 0001[7] 0001[7] 0001[7] 
02 fff2[e] 0001[7] fff2[e] 0001[7] 
03 fff2[e] fff2[e] fff2[e] 0001[7] 
03 fff2[e] fff2[e] fff2[e] fff2[e] 
03 fff2[e] fff2[e] fff2[e] fff2[e] 
*****************************************************
carrier 0 configuration SUCCESS for all ASICS
carrier 1 configuration SUCCESS for all ASICS
carrier 2 configuration SUCCESS for all ASICS
carrier 3 configuration SUCCESS for all ASICS
*****************************************************
return value = 0
prepare boardstack to take data...
Writing output from ./prep1boardstack_data_trueROI.py to logfile: logs/2019-10-05.053103.s17a.SCROD004.prep1boardstack_data_trueROI.log
Found 4 carriers
BS 0, carrier 0, asic 0 [ phase: 1 0 ] ready for data
BS 0, carrier 0, asic 1 [ phase: 1 0 ] ready for data
BS 0, carrier 0, asic 2 [ phase: 0 ] ready for data
BS 0, carrier 0, asic 3 [ phase: 0 ] ready for data
BS 0, carrier 1, asic 0 [ phase: 1 1 0 ] ready for data
BS 0, carrier 1, asic 1 [ phase: 1 0 ] ready for data
BS 0, carrier 1, asic 2 [ phase: 0 ] ready for data
BS 0, carrier 1, asic 3 [ phase: 0 ] ready for data
BS 0, carrier 2, asic 0 [ phase: 0 ] ready for data
BS 0, carrier 2, asic 1 [ phase: 0 ] ready for data
BS 0, carrier 2, asic 2 [ phase: 0 ] ready for data
BS 0, carrier 2, asic 3 [ phase: 0 ] ready for data
BS 0, carrier 3, asic 0 [ phase: 1 0 ] ready for data
BS 0, carrier 3, asic 1 [ phase: 1 0 ] ready for data
BS 0, carrier 3, asic 2 [ phase: 1 0 ] ready for data
BS 0, carrier 3, asic 3 [ phase: 0 ] ready for data
return value = 0
ask PS to acquire pedestals...
Writing output from ./prep1boardstack_fe.py to logfile: logs/2019-10-05.053103.s17a.SCROD004.prep1boardstack_fe.log
Taking pedestals...
remaining triggers = 54785
remaining triggers = 54273
remaining triggers = 53505
remaining triggers = 52993
remaining triggers = 52481
remaining triggers = 51713
remaining triggers = 51201
remaining triggers = 50433
remaining triggers = 49921
remaining triggers = 49409
remaining triggers = 48641
remaining triggers = 48129
remaining triggers = 47361
remaining triggers = 46849
remaining triggers = 46337
remaining triggers = 45569
remaining triggers = 45057
remaining triggers = 44289
remaining triggers = 43777
remaining triggers = 43265
remaining triggers = 42497
remaining triggers = 41985
remaining triggers = 41217
remaining triggers = 40705
remaining triggers = 40193
remaining triggers = 39425
remaining triggers = 38913
remaining triggers = 38145
remaining triggers = 37633
remaining triggers = 36865
remaining triggers = 36353
remaining triggers = 35841
remaining triggers = 35073
remaining triggers = 34561
remaining triggers = 33793
remaining triggers = 33281
remaining triggers = 32769
remaining triggers = 32001
remaining triggers = 31489
remaining triggers = 30721
remaining triggers = 30209
remaining triggers = 29697
remaining triggers = 28929
remaining triggers = 28417
remaining triggers = 27649
remaining triggers = 27137
remaining triggers = 26625
remaining triggers = 25857
remaining triggers = 25345
remaining triggers = 24577
remaining triggers = 24065
remaining triggers = 23553
remaining triggers = 22785
remaining triggers = 22273
remaining triggers = 21505
remaining triggers = 20993
remaining triggers = 20481
remaining triggers = 19713
remaining triggers = 19201
remaining triggers = 18433
remaining triggers = 17921
remaining triggers = 17409
remaining triggers = 16641
remaining triggers = 16129
remaining triggers = 15361
remaining triggers = 14849
remaining triggers = 14337
remaining triggers = 13569
remaining triggers = 13057
remaining triggers = 12289
remaining triggers = 11777
remaining triggers = 11265
remaining triggers = 10497
remaining triggers = 9985
remaining triggers = 9217
remaining triggers = 8705
remaining triggers = 8193
remaining triggers = 7425
remaining triggers = 6913
remaining triggers = 6145
remaining triggers = 5633
remaining triggers = 4865
remaining triggers = 4353
remaining triggers = 3841
remaining triggers = 3073
remaining triggers = 2561
remaining triggers = 1793
remaining triggers = 1281
remaining triggers = 769
remaining triggers = 0
Pedestal Calc Success
Feature extraction mode = Passthru
write pedestals to disk...
collecting data in background thread (file peds/ped_hslb_s17a.dat)...
starting to collect data...
triggering readout of pedestals...
0/0
0/1
0/2
0/3
0/4
0/5
0/6
0/7
collected 8192 packets
-rw-r----- 1 idlab idlab 17072128 Oct  5 05:32 peds/ped_hslb_s17a.dat

Correctly read out 8192.0 packets

Splitting peds/ped_hslb_s17a.dat into peds/ped_hslb_s17a.ped.dat and peds/ped_hslb_s17a.RMS.dat
4096+0 records in
4096+0 records out
8536064 bytes (8.5 MB, 8.1 MiB) copied, 0.0356023 s, 240 MB/s
4096+0 records in
4096+0 records out
8536064 bytes (8.5 MB, 8.1 MiB) copied, 0.0414147 s, 206 MB/s
-rw-r----- 1 idlab idlab 8536064 Oct  5 05:32 peds/ped_hslb_s17a.ped.dat
-rw-r----- 1 idlab idlab 8536064 Oct  5 05:32 peds/ped_hslb_s17a.RMS.dat
use 'peddump' to read the files peds/ped_hslb_s17a.ped.dat and peds/ped_hslb_s17a.RMS.dat
convert pedestal/RMS files from dat to txt...
-rw-r----- 1 idlab idlab 17044537 Oct  5 05:32 peds/ped_hslb_s17a.ped.txt
-rw-r----- 1 idlab idlab 10069140 Oct  5 05:32 peds/ped_hslb_s17a.RMS.txt
generating pedestal/RMS png files...

run these commands on the appropriate machine:
root -l -b -q '../../fe/FEpedsSummary.C+("peds/ped_hslb_s17a")'
eog peds/ped_hslb_s17a*.png

-rw-r----- 1 idlab idlab 17072128 Oct  5 05:32 peds/ped_hslb_s17a.dat
-rw-r----- 1 idlab idlab  8536064 Oct  5 05:32 peds/ped_hslb_s17a.ped.dat
-rw-r----- 1 idlab idlab  8536064 Oct  5 05:32 peds/ped_hslb_s17a.RMS.dat
-rw-r----- 1 idlab idlab 17044537 Oct  5 05:32 peds/ped_hslb_s17a.ped.txt
-rw-r----- 1 idlab idlab 10069140 Oct  5 05:32 peds/ped_hslb_s17a.RMS.txt

[optional] Then to plot summaries of the pedestal data (frequently useful for diagnosing problems):
idlab@balrog017:~/build/uh-svn-repo/trunk/software/b2l/scripts_dev$ root -l -b -q '../../fe/FEpedsSummary.C+("peds/ped_hslb_s17a")'
root [0] 
Processing ../../fe/FEpedsSummary.C+("peds/ped_hslb_s17a")...
ch =   0   ped =  1792   RMS =   94
ch =   8   ped =  1163   RMS =   46
ch =  16   ped =  1128   RMS =   39
ch =  24   ped =  1086   RMS =   34
ch =  32   ped =   310   RMS =    6
ch =  40   ped =   356   RMS =    8
ch =  48   ped =   322   RMS =    6
ch =  56   ped =   280   RMS =    3
ch =  64   ped =  1075   RMS =   34
ch =  72   ped =  1096   RMS =   73
ch =  80   ped =  1138   RMS =   45
ch =  88   ped =  1052   RMS =   36
ch =  96   ped =   320   RMS =    7
ch = 104   ped =   329   RMS =    9
ch = 112   ped =   388   RMS =    9
ch = 120   ped =   325   RMS =    7
processed 4194304 entries

Info in <TCanvas::Print>: png file peds/ped_hslb_s17a.PedSummary.png has been created
Info in <TCanvas::Print>: png file peds/ped_hslb_s17a.PedSummary_Logy.png has been created
Info in <TCanvas::Print>: png file peds/ped_hslb_s17a.PedVsSample.png has been created
Info in <TCanvas::Print>: png file peds/ped_hslb_s17a.PedVsChannel.png has been created
 FCN=2.10161e+06 FROM MIGRAD    STATUS=CONVERGED     155 CALLS         156 TOTAL
                     EDM=2.30771e-08    STRATEGY= 1  ERROR MATRIX UNCERTAINTY   1.3 per cent
  EXT PARAMETER                                   STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  Constant     2.49118e+05   2.95976e+02  -1.60874e-01   1.32447e-06
   2  Mean         3.09614e+01   5.25673e-03  -1.14622e-06  -1.04896e-02
   3  Sigma        4.73722e+00   4.23697e-03  -6.36022e-08   2.33082e+00
Info in <TCanvas::Print>: png file peds/ped_hslb_s17a.RMS_Summary.png has been created
Info in <TCanvas::Print>: png file peds/ped_hslb_s17a.RMS_Summary_Logy.png has been created
Info in <TCanvas::Print>: png file peds/ped_hslb_s17a.PedRMSvsChannel.png has been created
Info in <TCanvas::Print>: png file peds/ped_hslb_s17a.PedRMSvsSample.png has been created
Info in <TCanvas::Print>: png file peds/ped_hslb_s17a.PedRMSvsReadOutPos.png has been created
Info in <TCanvas::Print>: png file peds/ped_hslb_s17a.RMS_ped_depend.png has been created

Note:  If you get a lot of messages like "ERROR:  wrong virtual channel number in data (packet1); DEBUG3:  01 00 00 00" during pedestal readout, it will try again a few times and as long as the script says "Correctly read out 8192.0 packets" before quitting, then all is okay.  It is unknown why this virtual channel problem occurs (it's a bug but I don't know where).

[optional] To view the pedestal summary plots:
eog peds/ped_hslb_s17a*.png

[optional] If you want to save the pedestals for future reference (because they mark the first or last time a particular situation is being exercised):
idlab@balrog017:~/build/uh-svn-repo/trunk/software/b2l/scripts_dev$ ./push_peds.sh 2019-10-04.these-look-nice.c0c2only
2019-10-05+05:32     10069140 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only/ped_hslb_s17a.RMS.txt
2019-10-05+05:32     17044537 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only/ped_hslb_s17a.ped.txt
2019-10-05+05:32     17072128 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only/ped_hslb_s17a.dat
2019-10-05+05:32      8536064 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only/ped_hslb_s17a.ped.dat
2019-10-05+05:32      8536064 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only/ped_hslb_s17a.RMS.dat
2019-10-05+05:35        16009 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only/ped_hslb_s17a.PedSummary.png
2019-10-05+05:35        16983 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only/ped_hslb_s17a.PedSummary_Logy.png
2019-10-05+05:35        19455 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only/ped_hslb_s17a.RMS_Summary_Logy.png
2019-10-05+05:35        21818 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only/ped_hslb_s17a.RMS_Summary.png
2019-10-05+05:35        25792 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only/ped_hslb_s17a.RMS_ped_depend.png
2019-10-05+05:35        31859 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only/ped_hslb_s17a.PedRMSvsChannel.png
2019-10-05+05:35        33339 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only/ped_hslb_s17a.PedRMSvsSample.png
2019-10-05+05:35        34725 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only/ped_hslb_s17a.PedVsChannel.png
2019-10-05+05:35        45609 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only/ped_hslb_s17a.PedRMSvsReadOutPos.png
2019-10-05+05:35        59214 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only/ped_hslb_s17a.PedVsSample.png
2019-10-05+05:37         4096 peds/2019-10-05.2019-10-04.these-look-nice.c0c2only

Note:  If you don't run push_peds.sh to archive the pedestal data and summary plots, the next pedestal acquisition will overwrite them.  Usually they are not needed, as pedestal subtraction is done online before data comes out.

[optional]  To check again on the boardstack temperatures and raw voltages:
idlab@balrog017:~/build/uh-svn-repo/trunk/software/b2l/scripts_dev$ ./get_status.py 0
Writing output from ./get_status.py to logfile: logs/2019-10-05.054118.s17a.SCROD004.get_status.log
SCROD #4 RawVoltages: 1.800 V 3.475 V 4.623 V
 WARNING: RAW2 voltage unnecessarily high (by 0.376 V)
         FPGA_ver ARM_ver  trigMask DieTemp WallTemp -----other------ ARM_stat
   SCROD 00010095 0000006e 00000000  58.0 C  38.8 C  34.5 C   9.4 %RH Running
carrier0 00000062 00000021 00000000  73.2 C  59.5 C  51.8 C  58.5 C   Running
carrier1 00000062 00000021 00000000  73.3 C  60.5 C  53.0 C  59.0 C   Running
carrier2 00000062 00000021 00000000  78.8 C  65.8 C  61.2 C  67.0 C   Running
carrier3 00000062 00000021 00000000  72.9 C  56.8 C  52.0 C  56.2 C   Running
readoutBitSlip (IRSX config?) = [3, 3, 3, 3]
readoutWindows (prep done?)   = [1, 1, 1, 1]
Feature extraction mode       = 2 Passthru
SCROD_AxiCommon_asicTimeoutMask: 0
ProcessPacketProblemCounter = 0
nSamplesWrongCounter = 0
SCROD_PS_EXTENDED_STATUS_ADDR = 0x1
SCROD_PS_pendingWaves = 0
SCROD_PS_procEventCnt = 0
SCROD_PS_totalWaves = 0
SCROD_AxiCommon_eventCnt = 54784
SCROD_AxiCommon_pendingEventCount = 255
SCROD_AxiCommon_maxPendingEventCount = 255
SCROD_PS_AXI_FAULT_STATUS_ADDR = 0x0
SCROD_PS_AXI_FAULT_ADDRESS_ADDR = 0x0
SCROD_PS_OFFENDING_ADDRESS0_ADDR = 0x0
SCROD_PS_OFFENDING_ADDRESS1_ADDR = 0x0

Note:  After configuration, the warnings about raw voltages being too *low* should be heeded (requires a tunnel access with a slotted screwdriver to fix).
  23   Thu Oct 17 08:06:01 2019 M. Andrewdocumentationwhat was brought to KEK (2019-09)

photographic record of equipment delivered to KEK in September

Attachment 1: nim-bin.joestrummer-rafferty-raspberry-pi.jpeg
nim-bin.joestrummer-rafferty-raspberry-pi.jpeg
Attachment 2: boardstack-preamps-sensor-adjustable-slit.jpeg
boardstack-preamps-sensor-adjustable-slit.jpeg
Attachment 3: keithley-connections.jpeg
keithley-connections.jpeg
Attachment 4: entire-setup.jpeg
entire-setup.jpeg
  Draft   Thu Oct 17 09:28:32 2019 M. Andrewdocumentation what was installed for HER (2019-09)
  25   Tue Oct 29 09:27:14 2019 M. Andrewdocumentationinstructions on taking a full revolution of waveforms
This may be useful when steering the sensor into x-ray beam for instance.

First, ensure the boardstack is powered, programmed and configured.

Then, make sure the ".config" file in ~/build/uh-svn-repo/trunk/software/b2l/scripts_dev/ has a line declaring the xrm_mode is "sweep" and plot_continuous is set to 1 and xrm_run_continuous is set to 1:

xrm_run_continuous=1
plot_continuous=1
be_verbose_when_collecting_data=1
xrm_mode="sweep"

After that, to acquire data, simply run ./xrm.py from ~/build/uh-svn-repo/trunk/software/b2l/scripts_dev/ (see attachment for example output).
Attachment 1: 2019-10-30.062954.s17a.SCROD004.xrm.log
Writing output from ./xrm.py to logfile: logs/2019-10-30.062954.s17a.SCROD004.xrm.log

datafile name: data/2019-10-30.062954.datafile
Taking pedestals...
remaining triggers = 6273
remaining triggers = 5441
remaining triggers = 4577
remaining triggers = 3745
remaining triggers = 2881
remaining triggers = 2049
remaining triggers = 1185
remaining triggers = 353
remaining triggers = 0
   ERROR:  Ped calc generic fail 8
   SCROD:acquiring/calculating pedestals...
   SCROD:  DEBUG:maxwin=428
   SCROD:  DEBUG:waiting for data from the software trigger we just sent (n=0)...
   SCROD:  DEBUG:waiting for data from the software trigger we just sent (n=0)...
   SCROD:  DEBUG:waiting for data from the software trigger we just sent (n=0)...
   SCROD:  DEBUG:waiting for data from the software trigger we just sent (n=0)...
   SCROD:  DEBUG:carrier 1 asic 0 received 0 triggers (out of 109568)
   SCROD:  DEBUG:carrier 1 asic 1 received 0 triggers (out of 109568)
   SCROD:  DEBUG:carrier 1 asic 2 received 0 triggers (out of 109568)
   SCROD:  DEBUG:carrier 1 asic 3 received 0 triggers (out of 109568)
   SCROD:  DEBUG:carrier 3 asic 0 received 0 triggers (out of 109568)
   SCROD:  DEBUG:carrier 3 asic 1 received 0 triggers (out of 109568)
   SCROD:  DEBUG:carrier 3 asic 2 received 0 triggers (out of 109568)
   SCROD:  DEBUG:carrier 3 asic 3 received 0 triggers (out of 109568)
   SCROD:pedestal acquisition took 9.595 seconds
   SCROD:  ERROR:ProcessPacketProblemCounter=540992
   SCROD:finished acquiring/calculating pedestals; returnval = 00000008
setting bunch_marker_a to RF_bucket # 4
setting bunch_marker_a to RF_bucket # 16
setting bunch_marker_a to RF_bucket # 28
setting bunch_marker_a to RF_bucket # 40
setting bunch_marker_a to RF_bucket # 52
setting bunch_marker_a to RF_bucket # 64
setting bunch_marker_a to RF_bucket # 76
setting bunch_marker_a to RF_bucket # 88
setting bunch_marker_a to RF_bucket # 100
setting bunch_marker_a to RF_bucket # 112
setting bunch_marker_a to RF_bucket # 124
setting bunch_marker_a to RF_bucket # 136
setting bunch_marker_a to RF_bucket # 148
setting bunch_marker_a to RF_bucket # 160
setting bunch_marker_a to RF_bucket # 172
setting bunch_marker_a to RF_bucket # 184
setting bunch_marker_a to RF_bucket # 196
setting bunch_marker_a to RF_bucket # 208
setting bunch_marker_a to RF_bucket # 220
setting bunch_marker_a to RF_bucket # 232
setting bunch_marker_a to RF_bucket # 244
setting bunch_marker_a to RF_bucket # 256
setting bunch_marker_a to RF_bucket # 268
setting bunch_marker_a to RF_bucket # 280
setting bunch_marker_a to RF_bucket # 292
setting bunch_marker_a to RF_bucket # 304
setting bunch_marker_a to RF_bucket # 316
setting bunch_marker_a to RF_bucket # 328
setting bunch_marker_a to RF_bucket # 340
setting bunch_marker_a to RF_bucket # 352
setting bunch_marker_a to RF_bucket # 364
setting bunch_marker_a to RF_bucket # 376
setting bunch_marker_a to RF_bucket # 388
setting bunch_marker_a to RF_bucket # 400
setting bunch_marker_a to RF_bucket # 412
setting bunch_marker_a to RF_bucket # 424
setting bunch_marker_a to RF_bucket # 436
setting bunch_marker_a to RF_bucket # 448
setting bunch_marker_a to RF_bucket # 460
setting bunch_marker_a to RF_bucket # 472
setting bunch_marker_a to RF_bucket # 484
setting bunch_marker_a to RF_bucket # 496
setting bunch_marker_a to RF_bucket # 508
setting bunch_marker_a to RF_bucket # 520
setting bunch_marker_a to RF_bucket # 532
setting bunch_marker_a to RF_bucket # 544
setting bunch_marker_a to RF_bucket # 556
setting bunch_marker_a to RF_bucket # 568
setting bunch_marker_a to RF_bucket # 580
setting bunch_marker_a to RF_bucket # 592
setting bunch_marker_a to RF_bucket # 604
setting bunch_marker_a to RF_bucket # 616
setting bunch_marker_a to RF_bucket # 628
setting bunch_marker_a to RF_bucket # 640
setting bunch_marker_a to RF_bucket # 652
setting bunch_marker_a to RF_bucket # 664
setting bunch_marker_a to RF_bucket # 676
setting bunch_marker_a to RF_bucket # 688
setting bunch_marker_a to RF_bucket # 700
setting bunch_marker_a to RF_bucket # 712
setting bunch_marker_a to RF_bucket # 724
setting bunch_marker_a to RF_bucket # 736
setting bunch_marker_a to RF_bucket # 748
setting bunch_marker_a to RF_bucket # 760
setting bunch_marker_a to RF_bucket # 772
setting bunch_marker_a to RF_bucket # 784
setting bunch_marker_a to RF_bucket # 796
setting bunch_marker_a to RF_bucket # 808
setting bunch_marker_a to RF_bucket # 820
setting bunch_marker_a to RF_bucket # 832
setting bunch_marker_a to RF_bucket # 844
setting bunch_marker_a to RF_bucket # 856
setting bunch_marker_a to RF_bucket # 868
setting bunch_marker_a to RF_bucket # 880
setting bunch_marker_a to RF_bucket # 892
setting bunch_marker_a to RF_bucket # 904
setting bunch_marker_a to RF_bucket # 916
setting bunch_marker_a to RF_bucket # 928
setting bunch_marker_a to RF_bucket # 940
setting bunch_marker_a to RF_bucket # 952
setting bunch_marker_a to RF_bucket # 964
setting bunch_marker_a to RF_bucket # 976
setting bunch_marker_a to RF_bucket # 988
setting bunch_marker_a to RF_bucket # 1000
setting bunch_marker_a to RF_bucket # 1012
setting bunch_marker_a to RF_bucket # 1024
setting bunch_marker_a to RF_bucket # 1036
setting bunch_marker_a to RF_bucket # 1048
setting bunch_marker_a to RF_bucket # 1060
setting bunch_marker_a to RF_bucket # 1072
setting bunch_marker_a to RF_bucket # 1084
setting bunch_marker_a to RF_bucket # 1096
setting bunch_marker_a to RF_bucket # 1108
setting bunch_marker_a to RF_bucket # 1120
setting bunch_marker_a to RF_bucket # 1132
setting bunch_marker_a to RF_bucket # 1144
setting bunch_marker_a to RF_bucket # 1156
setting bunch_marker_a to RF_bucket # 1168
setting bunch_marker_a to RF_bucket # 1180
setting bunch_marker_a to RF_bucket # 1192
setting bunch_marker_a to RF_bucket # 1204
setting bunch_marker_a to RF_bucket # 1216
setting bunch_marker_a to RF_bucket # 1228
setting bunch_marker_a to RF_bucket # 1240
setting bunch_marker_a to RF_bucket # 1252
setting bunch_marker_a to RF_bucket # 1264
setting bunch_marker_a to RF_bucket # 1276
setting bunch_marker_a to RF_bucket # 1288
setting bunch_marker_a to RF_bucket # 1300
setting bunch_marker_a to RF_bucket # 1312
setting bunch_marker_a to RF_bucket # 1324
setting bunch_marker_a to RF_bucket # 1336
setting bunch_marker_a to RF_bucket # 1348
setting bunch_marker_a to RF_bucket # 1360
setting bunch_marker_a to RF_bucket # 1372
setting bunch_marker_a to RF_bucket # 1384
setting bunch_marker_a to RF_bucket # 1396
setting bunch_marker_a to RF_bucket # 1408
setting bunch_marker_a to RF_bucket # 1420
setting bunch_marker_a to RF_bucket # 1432
setting bunch_marker_a to RF_bucket # 1444
setting bunch_marker_a to RF_bucket # 1456
setting bunch_marker_a to RF_bucket # 1468
setting bunch_marker_a to RF_bucket # 1480
setting bunch_marker_a to RF_bucket # 1492
setting bunch_marker_a to RF_bucket # 1504
setting bunch_marker_a to RF_bucket # 1516
setting bunch_marker_a to RF_bucket # 1528
setting bunch_marker_a to RF_bucket # 1540
setting bunch_marker_a to RF_bucket # 1552
setting bunch_marker_a to RF_bucket # 1564
setting bunch_marker_a to RF_bucket # 1576
setting bunch_marker_a to RF_bucket # 1588
setting bunch_marker_a to RF_bucket # 1600
setting bunch_marker_a to RF_bucket # 1612
setting bunch_marker_a to RF_bucket # 1624
setting bunch_marker_a to RF_bucket # 1636
setting bunch_marker_a to RF_bucket # 1648
setting bunch_marker_a to RF_bucket # 1660
setting bunch_marker_a to RF_bucket # 1672
setting bunch_marker_a to RF_bucket # 1684
setting bunch_marker_a to RF_bucket # 1696
setting bunch_marker_a to RF_bucket # 1708
setting bunch_marker_a to RF_bucket # 1720
setting bunch_marker_a to RF_bucket # 1732
setting bunch_marker_a to RF_bucket # 1744
setting bunch_marker_a to RF_bucket # 1756
setting bunch_marker_a to RF_bucket # 1768
setting bunch_marker_a to RF_bucket # 1780
setting bunch_marker_a to RF_bucket # 1792
setting bunch_marker_a to RF_bucket # 1804
setting bunch_marker_a to RF_bucket # 1816
setting bunch_marker_a to RF_bucket # 1828
setting bunch_marker_a to RF_bucket # 1840
setting bunch_marker_a to RF_bucket # 1852
setting bunch_marker_a to RF_bucket # 1864
setting bunch_marker_a to RF_bucket # 1876
setting bunch_marker_a to RF_bucket # 1888
setting bunch_marker_a to RF_bucket # 1900
setting bunch_marker_a to RF_bucket # 1912
setting bunch_marker_a to RF_bucket # 1924
setting bunch_marker_a to RF_bucket # 1936
setting bunch_marker_a to RF_bucket # 1948
setting bunch_marker_a to RF_bucket # 1960
setting bunch_marker_a to RF_bucket # 1972
setting bunch_marker_a to RF_bucket # 1984
setting bunch_marker_a to RF_bucket # 1996
setting bunch_marker_a to RF_bucket # 2008
setting bunch_marker_a to RF_bucket # 2020
setting bunch_marker_a to RF_bucket # 2032
setting bunch_marker_a to RF_bucket # 2044
setting bunch_marker_a to RF_bucket # 2056
setting bunch_marker_a to RF_bucket # 2068
setting bunch_marker_a to RF_bucket # 2080
setting bunch_marker_a to RF_bucket # 2092
setting bunch_marker_a to RF_bucket # 2104
setting bunch_marker_a to RF_bucket # 2116
setting bunch_marker_a to RF_bucket # 2128
setting bunch_marker_a to RF_bucket # 2140
setting bunch_marker_a to RF_bucket # 2152
setting bunch_marker_a to RF_bucket # 2164
setting bunch_marker_a to RF_bucket # 2176
setting bunch_marker_a to RF_bucket # 2188
setting bunch_marker_a to RF_bucket # 2200
setting bunch_marker_a to RF_bucket # 2212
setting bunch_marker_a to RF_bucket # 2224
setting bunch_marker_a to RF_bucket # 2236
setting bunch_marker_a to RF_bucket # 2248
setting bunch_marker_a to RF_bucket # 2260
setting bunch_marker_a to RF_bucket # 2272
setting bunch_marker_a to RF_bucket # 2284
setting bunch_marker_a to RF_bucket # 2296
setting bunch_marker_a to RF_bucket # 2308
setting bunch_marker_a to RF_bucket # 2320
setting bunch_marker_a to RF_bucket # 2332
setting bunch_marker_a to RF_bucket # 2344
setting bunch_marker_a to RF_bucket # 2356
setting bunch_marker_a to RF_bucket # 2368
setting bunch_marker_a to RF_bucket # 2380
setting bunch_marker_a to RF_bucket # 2392
setting bunch_marker_a to RF_bucket # 2404
setting bunch_marker_a to RF_bucket # 2416
setting bunch_marker_a to RF_bucket # 2428
setting bunch_marker_a to RF_bucket # 2440
setting bunch_marker_a to RF_bucket # 2452
setting bunch_marker_a to RF_bucket # 2464
setting bunch_marker_a to RF_bucket # 2476
setting bunch_marker_a to RF_bucket # 2488
setting bunch_marker_a to RF_bucket # 2500
setting bunch_marker_a to RF_bucket # 2512
setting bunch_marker_a to RF_bucket # 2524
setting bunch_marker_a to RF_bucket # 2536
setting bunch_marker_a to RF_bucket # 2548
setting bunch_marker_a to RF_bucket # 2560
setting bunch_marker_a to RF_bucket # 2572
setting bunch_marker_a to RF_bucket # 2584
setting bunch_marker_a to RF_bucket # 2596
setting bunch_marker_a to RF_bucket # 2608
setting bunch_marker_a to RF_bucket # 2620
setting bunch_marker_a to RF_bucket # 2632
setting bunch_marker_a to RF_bucket # 2644
setting bunch_marker_a to RF_bucket # 2656
setting bunch_marker_a to RF_bucket # 2668
setting bunch_marker_a to RF_bucket # 2680
setting bunch_marker_a to RF_bucket # 2692
setting bunch_marker_a to RF_bucket # 2704
setting bunch_marker_a to RF_bucket # 2716
setting bunch_marker_a to RF_bucket # 2728
setting bunch_marker_a to RF_bucket # 2740
setting bunch_marker_a to RF_bucket # 2752
setting bunch_marker_a to RF_bucket # 2764
setting bunch_marker_a to RF_bucket # 2776
setting bunch_marker_a to RF_bucket # 2788
setting bunch_marker_a to RF_bucket # 2800
setting bunch_marker_a to RF_bucket # 2812
setting bunch_marker_a to RF_bucket # 2824
setting bunch_marker_a to RF_bucket # 2836
setting bunch_marker_a to RF_bucket # 2848
setting bunch_marker_a to RF_bucket # 2860
setting bunch_marker_a to RF_bucket # 2872
setting bunch_marker_a to RF_bucket # 2884
setting bunch_marker_a to RF_bucket # 2896
setting bunch_marker_a to RF_bucket # 2908
setting bunch_marker_a to RF_bucket # 2920
setting bunch_marker_a to RF_bucket # 2932
setting bunch_marker_a to RF_bucket # 2944
setting bunch_marker_a to RF_bucket # 2956
setting bunch_marker_a to RF_bucket # 2968
setting bunch_marker_a to RF_bucket # 2980
setting bunch_marker_a to RF_bucket # 2992
setting bunch_marker_a to RF_bucket # 3004
setting bunch_marker_a to RF_bucket # 3016
setting bunch_marker_a to RF_bucket # 3028
setting bunch_marker_a to RF_bucket # 3040
setting bunch_marker_a to RF_bucket # 3052
setting bunch_marker_a to RF_bucket # 3064
setting bunch_marker_a to RF_bucket # 3076
setting bunch_marker_a to RF_bucket # 3088
setting bunch_marker_a to RF_bucket # 3100
setting bunch_marker_a to RF_bucket # 3112
setting bunch_marker_a to RF_bucket # 3124
setting bunch_marker_a to RF_bucket # 3136
setting bunch_marker_a to RF_bucket # 3148
[0] 0/0
[0] 0/1
[0] 0/2
[0] 0/3
[0] 0/4
[0] 0/5
... 6778 more lines ...
Attachment 2: 2019-10-30.063506.waveforms.425events.png
2019-10-30.063506.waveforms.425events.png
  26   Wed Oct 30 15:23:57 2019 M. Andrewdocumentationsample waveform files
A sample waveform file from the reference boardstack at UH and the boardstack in the HER at KEK are attached (in tar bzip2 file).

The format of the files is as in the attached spreadsheet (start from cell C29 for the waveform data).

A parser for the data (raw datafiles as well as waveform files) is committed to the UH svn repo (in scripts_dev/) and also attached here.  See the functions events_from_waveformfile() and waveforms_from_waveformfile() for details.
Attachment 1: data_format_v2_6.with-raw-waveform-details.ods
Attachment 2: 2019-11-04.140943.waveforms.422events.png
2019-11-04.140943.waveforms.422events.png
Attachment 3: 2019-11-04.140943.datafile.bz2
Attachment 4: 2019-11-04.140943.waveforms.bz2
Attachment 5: 2019-11-05.064104.waveforms.424events.png
2019-11-05.064104.waveforms.424events.png
Attachment 6: 2019-11-05.064104.datafile.bz2
Attachment 7: 2019-11-05.064104.waveforms.bz2
Attachment 8: xrm.py
#!/bin/env python

# written 2019-01-28 by mza
# last updated 2019-11-04 by mza

import threading # Thread()
from B2L_common import *
from B2L_defs import *
from get_status import get_status
import ethudp
from DebugInfoWarningError24 import debug, info, warning, error, debug2, debug3, set_verbosity
import time # sleep()

BS = 0
set_verbosity(3)
frame_mask_shift = 16
frame_mask_all = 0b111111111 << frame_mask_shift
bunch_marker_first_valid = 4
initial_bunch_marker_of_interest = 1701
bunch_marker_last_valid = 5120 - 1
#number_of_64_sample_windows_per_beam_orbit = 427

def set_trigger_mask(s, c0, c1, c2, c3):
	write_register(SCROD_AxiCommon_trigMask, s, BS)
	write_register(CARRIER_AxiCommon_trigMask, c0, BS, 0)
	write_register(CARRIER_AxiCommon_trigMask, c1, BS, 1)
	write_register(CARRIER_AxiCommon_trigMask, c2, BS, 2)
	write_register(CARRIER_AxiCommon_trigMask, c3, BS, 3)

def mask_triggers(s=0xf, c0=0xf, c1=0xf, c2=0xf, c3=0xf):
	set_trigger_mask(s, c0, c1, c2, c3)

def unmask_triggers(s=0, c0=0, c1=0, c2=0, c3=0):
	set_trigger_mask(s, c0, c1, c2, c3)

def set_trig_prescale_N_log2(N_log2):
	write_register(SCROD_AxiCommon_trig_prescale_N_log2, N_log2, BS)

def get_xrm_trigger_enable_status():
	return read_register(SCROD_AxiCommon_xrm_trigger_enabled, BS)

def enable_xrm_triggers():
	write_register(SCROD_AxiCommon_xrm_trigger_enabled, 1, BS)

def disable_xrm_triggers():
	write_register(SCROD_AxiCommon_xrm_trigger_enabled, 0, BS)

def allow_xrm_triggers_for_a_while(duration=1.0):
	if be_verbose_when_collecting_data:
		info("allowing xrm triggers for " + str(int(1000.0*duration)/1000.0) + " seconds...")
	a = get_SCROD_eventCnt()
	enable_xrm_triggers()
	time.sleep(duration)
	disable_xrm_triggers()
	b = get_SCROD_eventCnt()
	diff = b - a
	return diff

def trigger_and_wait_for_xrm_triggers(duration=1.0):
#	if be_verbose_when_collecting_data:
#		info("allowing xrm triggers for " + str(int(1000.0*duration)/1000.0) + " seconds...")
	a = get_SCROD_eventCnt()
	if should_software_trigger:
		software_trigger(BS)
	else:
		write_register_without_readback_verification(SCROD_AxiCommon_clear_count_of_triggers_for_bunch_markers, 0xf, BS)
	wait_at_least_until_next_frame9()
	time.sleep(duration)
	b = get_SCROD_eventCnt()
	diff = b - a
	return diff

expected_trigger_rate = { 0:11150.0, 1:5560.0, 2:2780.0, 3:1390.0, 4:690.0, 5:350.0, 6:170.0, 7:90.0, 8:40.0, 9:20.0, 10:10.0, 11:5.0, 12:2.0, 13:1.0, 14:1.0, 15:1.0, 16:1.0, 17:1.0, 18:1.0 }
def generate_histogram_of_trigger_rate_versus_prescale_N_log2(start, end):
	global expected_trigger_rate
	old_desired_trigger_quantities = set_desired_trigger_quantities(0, 0, 0, 0)
	mask_triggers()
	#max_rate = 151000.0
	for i in range(start, end+1):
		set_trig_prescale_N_log2(i)
		#duration = 40.0 * (2.0**i) / max_rate
		duration = 0.1
		#info(duration)
		if i > 10:
			duration = 1.0
		diff = allow_xrm_triggers_for_a_while(duration)
		#info(str(diff))
		rate = diff / duration
		expected_trigger_rate[i] = rate
		info("[" + str(i) + "]: " + str(rate))
	set_desired_trigger_quantities(old_desired_trigger_quantities[0], old_desired_trigger_quantities[1], old_desired_trigger_quantities[2], old_desired_trigger_quantities[3])

def get_SCROD_eventCnt(should_show_it=0):
	SCROD_eventCnt = read_register(SCROD_AxiCommon_eventCnt, BS)
	if should_show_it:
		info("SCROD_eventCnt: " + str(SCROD_eventCnt))
	return SCROD_eventCnt

def get_carrier_eventCnts(should_show_them=0):
	if 5==number_of_carriers[BS] or 0==number_of_carriers[BS]:
		return
	eventCnt = []
	if 1 <= number_of_carriers[BS]:
		carrier0_eventCnt = read_register(CARRIER_AxiCommon_eventCnt, BS, 0)
		eventCnt.append(carrier0_eventCnt)
		if should_show_them:
			info("carrier0_eventCnt: " + str(carrier0_eventCnt))
	if 2 <= number_of_carriers[BS]:
		carrier1_eventCnt = read_register(CARRIER_AxiCommon_eventCnt, BS, 1)
		eventCnt.append(carrier1_eventCnt)
		if should_show_them:
			info("carrier1_eventCnt: " + str(carrier1_eventCnt))
	if 3 <= number_of_carriers[BS]:
		carrier2_eventCnt = read_register(CARRIER_AxiCommon_eventCnt, BS, 2)
		eventCnt.append(carrier2_eventCnt)
		if should_show_them:
			info("carrier2_eventCnt: " + str(carrier2_eventCnt))
	if 4 <= number_of_carriers[BS]:
		carrier3_eventCnt = read_register(CARRIER_AxiCommon_eventCnt, BS, 3)
		eventCnt.append(carrier3_eventCnt)
		if should_show_them:
			info("carrier3_eventCnt: " + str(carrier3_eventCnt))
	return eventCnt

def set_readout_window_to_match_bunch(bunch):
	write_register_for_each_asic(CARRIER_IRSX_readoutLookback, int(bunch/RF_buckets_per_read_window), BS)

def set_bunch_marker(bunch_marker_number, frame_mask, value):
	set_readout_window_to_match_bunch(value)
	value &= ~frame_mask_all
	value |= frame_mask << frame_mask_shift
	#info(hex(value))
	if 0==bunch_marker_number:
		write_register(SCROD_AxiCommon_bunch_marker_a, value, BS)
	if 1==bunch_marker_number:
		write_register(SCROD_AxiCommon_bunch_marker_b, value, BS)
	if 2==bunch_marker_number:
		write_register(SCROD_AxiCommon_bunch_marker_c, value, BS)
	if 3==bunch_marker_number:
		write_register(SCROD_AxiCommon_bunch_marker_d, value, BS)

#def set_bunch_markers(a, b, c, d):
#	a |= frame_mask_all
#	b |= frame_mask_all
#	c |= frame_mask_all
#	d |= frame_mask_all
#	#a &= ~frame_mask_all
#	#b &= ~frame_mask_all
#	#c &= ~frame_mask_all
#	#d &= ~frame_mask_all
#	#a |= (1<<0)<<frame_mask_shift
#	#b |= (1<<5)<<frame_mask_shift
#	#c |= (1<<6)<<frame_mask_shift
#	#d |= (1<<7)<<frame_mask_shift
#	write_register(SCROD_AxiCommon_bunch_marker_a, a, BS)
#	write_register(SCROD_AxiCommon_bunch_marker_b, b, BS)
#	write_register(SCROD_AxiCommon_bunch_marker_c, c, BS)
#	write_register(SCROD_AxiCommon_bunch_marker_d, d, BS)
#
#def set_quadbunch_markers(a, b, c, d):
#	set_bunch_markers(4*a, 4*b, 4*c, 4*d)
#
#def set_asic_write_window_bunch_markers(a, b, c, d):
#	#calculate_parameters(4)
#	#calculate_parameters(6)
#	#calculate_parameters(8)
#	#set_bunch_markers(16*a, 16*b, 16*c, 16*d)
#	set_bunch_markers(24*a, 24*b, 24*c, 24*d)
#	#set_bunch_markers(32*a, 32*b, 32*c, 32*d)

def set_desired_trigger_quantities(a, b, c, d):
	old_a = read_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_a, BS)
	old_b = read_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_b, BS)
	old_c = read_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_c, BS)
	old_d = read_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_d, BS)
	write_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_a, a, BS)
	write_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_b, b, BS)
	write_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_c, c, BS)
	write_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_d, d, BS)
	return old_a, old_b, old_c, old_d

def calculate_parameters(SST_clock_divide_ratio=6, should_print_info=0):
	# 5120 / 4 = 1280 FTSW clocks per frame
	# 5120 buckets / 508.8875 MHz = 10.0611628307 us per frame
	#
	# 127.221875 MHz / 6 = 21.203645833 MHz
	# 128 samples per write window * 21.203645833 MHz SST = 2714.066666 MHz sampling rate
	# 1/21.203645833 MHz = 47.1617007689 ns per write window
	# 10.0611628307 us / 47.1617007689 ns = 213.333333 write windows per revolution
	# 5120 / 213.333333 = 24.0 bunches per window
	# 6.0 FTSW bunches per window
	#
	# 127.221875 MHz / 8 = 15.902734375 MHz
	# 128 samples per write window * 15.902734375 MHz SST = 2035.55 MHz sampling rate
	# 1/15.902734375 MHz = 62.882268 ns per write window
	# 10.0611628307 us / 62.882268 ns = 160 write windows per revolution
	# 5120 / 160 = 32.0 bunches per window
	# 8.0 FTSW bunches per window
	global RF_clock_Hz
	RF_clock_Hz = 508.8875e6
	global period_of_RF_clock_ns
	period_of_RF_clock_ns = 1.0e9 / RF_clock_Hz
	global RF_buckets
	RF_buckets = 5120
	global asic_samples_per_write_window
	asic_samples_per_write_window = 128
	global FTSW_clock_divide_ratio
	FTSW_clock_divide_ratio = 4
	global revolution_duration_s
	revolution_duration_s = RF_buckets / RF_clock_Hz
	global SST_clock_Hz
	SST_clock_Hz = RF_clock_Hz / FTSW_clock_divide_ratio / SST_clock_divide_ratio
	global sampling_rate_Hz
	sampling_rate_Hz = SST_clock_Hz * asic_samples_per_write_window
	global write_window_duration_s
	write_window_duration_s = 1.0 / SST_clock_Hz
	global read_window_duration_s
	read_window_duration_s = write_window_duration_s / 2.0
	global write_windows_per_revolution
	write_windows_per_revolution = revolution_duration_s / write_window_duration_s
	global read_windows_per_revolution
	read_windows_per_revolution = revolution_duration_s / read_window_duration_s
	global RF_buckets_per_write_window
	RF_buckets_per_write_window = RF_buckets / write_windows_per_revolution
	global RF_buckets_per_read_window
	RF_buckets_per_read_window = RF_buckets / read_windows_per_revolution
	global FTSW_clocks_per_write_window
	FTSW_clocks_per_write_window = RF_buckets_per_write_window / FTSW_clock_divide_ratio
	global FTSW_clocks_per_read_window
	FTSW_clocks_per_read_window = RF_buckets_per_read_window / FTSW_clock_divide_ratio
	if should_print_info:
		info("revolution_duration_us: " + str(revolution_duration_s*1.0e6))
		info("SST_clock_MHz: " + str(SST_clock_Hz/1.0e6))
		info("sampling_rate_GHz: " + str(sampling_rate_Hz/1.0e9))
		info("write_window_duration_ns : " + str(write_window_duration_s*1.0e9))
		info("read_window_duration_ns : " + str(read_window_duration_s*1.0e9))
		info("write_windows_per_revolution: " + str(write_windows_per_revolution))
		info("read_windows_per_revolution: " + str(read_windows_per_revolution))
		info("RF_buckets_per_write_window: " + str(RF_buckets_per_write_window))
		info("RF_buckets_per_read_window: " + str(RF_buckets_per_read_window))
		info("FTSW_clocks_per_write_window: " + str(FTSW_clocks_per_write_window))
		info("FTSW_clocks_per_read_window: " + str(FTSW_clocks_per_read_window))

def decode_frame_mask(frame_mask):
	frame_mask &= frame_mask_all
	frame_mask >>= frame_mask_shift
	list = []
	if frame_mask & 0x100:
		list.append(0)
	if frame_mask & 0x080:
		list.append(1)
	if frame_mask & 0x040:
		list.append(2)
	if frame_mask & 0x020:
		list.append(3)
	if frame_mask & 0x010:
		list.append(4)
	if frame_mask & 0x008:
		list.append(5)
	if frame_mask & 0x004:
		list.append(6)
	if frame_mask & 0x002:
		list.append(7)
	if frame_mask & 0x001:
		list.append(8)
	return list

def show_frame_masks():
	a = read_register(SCROD_AxiCommon_bunch_marker_a, BS)
	af = decode_frame_mask(a)
	a &= ~frame_mask_all
	info("a: " + str(af) + " " + str(a))
	b = read_register(SCROD_AxiCommon_bunch_marker_b, BS)
	bf = decode_frame_mask(b)
	b &= ~frame_mask_all
	info("b: " + str(bf) + " " + str(b))
	c = read_register(SCROD_AxiCommon_bunch_marker_c, BS)
	cf = decode_frame_mask(c)
	c &= ~frame_mask_all
	info("c: " + str(cf) + " " + str(c))
	d = read_register(SCROD_AxiCommon_bunch_marker_d, BS)
	df = decode_frame_mask(d)
	d &= ~frame_mask_all
	info("d: " + str(df) + " " + str(d))
	info("total frame masks active: " + str(count_frame_masks()))

def count_frame_masks():
	a = read_register(SCROD_AxiCommon_bunch_marker_a, BS)
	ac = len(decode_frame_mask(a))
	b = read_register(SCROD_AxiCommon_bunch_marker_b, BS)
	bc = len(decode_frame_mask(b))
	c = read_register(SCROD_AxiCommon_bunch_marker_c, BS)
	cc = len(decode_frame_mask(c))
	d = read_register(SCROD_AxiCommon_bunch_marker_d, BS)
	dc = len(decode_frame_mask(d))
	total = ac + bc + cc + dc
	return total

def show_xrm_trigger_enable_status():
	en = read_register(SCROD_AxiCommon_xrm_trigger_enabled, BS)
... 1246 more lines ...
  27   Tue Nov 5 11:47:36 2019 M. Andrewdocumentationinstructions on taking data around a desired RF bucket
This mode of operation is useful when you've located your RF bucket of interest and want to focus on taking data at that position.

First, ensure the boardstack is powered, programmed and configured.

Then, make sure the ".config" file in ~/build/uh-svn-repo/trunk/software/b2l/scripts_dev/ has a line declaring the xrm_mode is "acquire" and plot_continuous is set to 1 and xrm_run_continuous is set to 1:

xrm_run_continuous=1
plot_continuous=1
xrm_mode="acquire"

Choose your bunch marker like so (in the same .config file):

desired_RF_bucket=762
RF_bucket_sample_offset=-1

After that, to acquire data, simply run ./xrm.py from ~/build/uh-svn-repo/trunk/software/b2l/scripts_dev/ (see attachment for example output).
Attachment 1: 2019-11-05.121045.waveforms.0099.png
2019-11-05.121045.waveforms.0099.png
  28   Mon Nov 18 13:30:44 2019 M. Andrewdocumentationfirst light!
A video of a time series of waveforms for first light (recorded 2019-11-15) is posted here:

https://www.youtube.com/watch?v=IVVIYGwrBqI
  29   Mon Nov 18 14:06:31 2019 M. Andrewdocumentationconfig file
Below is a list of all possible config file options that are interpreted/used by the xrm.py code.  The filename is ".config" and it must be located in "${HOME}/build/uh-svn-repo/trunk/software/b2l/scripts_dev/"

For svn checkouts where (re)parsing & (re)plotting data is going to be the only valid operation, be sure to set fake_it="yes" and xrm_mode="parse" among other things (see below).  Please note that the config file parser can't handle spaces between the variable name and the equals sign (also between the equals sign and the value or beginning quote (for strings), so xrm_mode = "parse" won't work but xrm_mode="parse" will.

mode="eth"
local_IP=""
fake_it="yes"
remote_IP="192.168.10.16"
remote_port="8192"
ethernet_device="blah"

# for threshScan1boardstack.py:
maximum_iterations=2000
step_initial_when_reading_from_file=1
step_initial_when_from_seed_value=1
number_of_channels_to_get_before_quitting_threshold_scan=64

# for xrm.py:
xrm_run_continuous=0
plot_continuous=1
show_plot=0
datafilesize=20000000
be_verbose_when_collecting_data=0
use_pedestal_subtraction_mode=1
retake_pedestals_at_every_filechange=0
desired_pause_between_acquisitions=0
should_cycle_slowly_through_bunch_markers=0
desired_RF_bucket=4270
RF_bucket_sample_offset=0
multicast_cal_signal=1
enable_cal_signal=0
should_plot_beam_current=1

sweep_start_bucket=4
#sweep_start_bucket=772 # 64 windows
#sweep_start_bucket=2308

#sweep_end_bucket=772 # 64 windows
#sweep_end_bucket=1540 # 128 windows
#sweep_end_bucket=2308 # 192 windows
#sweep_end_bucket=3076 # 256 windows
#sweep_end_bucket=3844 # 320 windows
#sweep_end_bucket=4612 # 384 windows
sweep_end_bucket=5116 # 426 windows

#xrm_mode="sweep"
#xrm_mode="acquire"
xrm_mode="parse"
  30   Wed Nov 6 13:35:45 2024 M. Andrewdocumentationsample waveform files
Attached is a sample datafile (in raw, root and waveforms formats) showing self-pulser data taken in April 2024, along with the most recent version of the xrm.py script.
Attachment 1: 2024-04-17.135507.zip
Attachment 2: 2024-04-17.135507.waveforms.32windows.png
2024-04-17.135507.waveforms.32windows.png
Attachment 3: xrm.py
#!/bin/env python3

# written 2019-01-28 by mza
# last updated 2023-09-26 by mza

import threading # Thread()
from math import *
from B2L_common import *
from B2L_defs import *
from get_status import get_status
import ethudp
from DebugInfoWarningError import debug, info, warning, error, debug2, debug3, set_verbosity
import time # sleep()
import struct # unpack_from
import pytz # pytz - sudo apt install -y python-pip; sudo pip2 install pytz
#import datetime
import matplotlib.dates as mdates # sudo pip2 install matplotlib
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from math import ceil
# sudo apt install -y python-pip python3-pip python-tk
# python -m pip install --user -U pip
# python -m pip install --user -U matplotlib
# python -m pip install --user -U scipy
import matplotlib.pyplot as plt # sudo apt install -y python-cairocffi
import matplotlib.gridspec as gridspec
#import matplotlib.image as mpl_img
from matplotlib.ticker import (MultipleLocator, FormatStrFormatter, AutoMinorLocator)
import numpy
import tkinter # sudo apt install -y python3-tk
from PIL import Image, ImageTk # sudo apt-get install -y python3-pil.imagetk

def print_ROOT_usage():
	print("ROOT environment not setup yet")
	HOME = os.environ['HOME']
	potential_locations = [ "/usr/local/bin", HOME + "/build/root/bin" ]
	filename = "thisroot.sh"
	for location in potential_locations:
		potential_filename = location + "/" + filename
		if os.path.isfile(potential_filename):
			#print(". " + HOME + "/build/root/bin/thisroot.sh; " + str(sys.argv))
			print(". " + potential_filename)
	#info(sys.argv[0] + sys.argv[1:])
	#info(" ".join(sys.argv[0:]))
	sys.exit(1)

try:
	import ROOT # TH1F
	info("using ROOT")
	should_use_ROOT = True
except:
	should_use_ROOT = False
	info("not using ROOT")
	#print_ROOT_usage()
#ROOT.gROOT.SetBatch(True)

BS = 0
frame_mask_shift = 16
frame_mask_all = 0b111111111 << frame_mask_shift
bunch_marker_first_valid = 4
initial_bunch_marker_of_interest = 1701
desired_RF_bucket = initial_bunch_marker_of_interest
RF_buckets = 5120
bunch_marker_last_valid = RF_buckets - 1
#number_of_64_sample_windows_per_beam_orbit = 427

pedestal_subtraction_amount = 1000
stagger_amount = 50
ch_adc_min = 0 - 300
ch_adc_max = 128 * stagger_amount + 300
maximum_absolute_value_before_issuing_warning = 1000
slice_lower_limit = -250
slice_upper_limit = 300

should_plot_slice = 0
#should_plot_sweep = 1
#should_plot_zoomed_waveforms = 1
#number_of_zoomed_waveforms_to_plot = 4
should_generate_png = 1
should_generate_pdf = 0

gui_update_period_ms = 200

linewidth = 0.3
dpi = 100.0

duration_in_ns_of_64_sample_waveform = 23.58
desired_x_axis = "time"
desired_physical_window_numbers = [ w for w in range(425) ]
starting_physical_window_number = 0
ending_physical_window_number = starting_physical_window_number + 425

revolution_marker_offset_in_RF_buckets = 4370.5
bunch_current_offset = -260.0
bunch_current_scale = 350.0

current_gridstep = 200.0 # in mA
nbunches_gridstep = 400

def set_trigger_mask(s, c0, c1, c2, c3):
	write_register(SCROD_AxiCommon_trigMask, s, BS)
	write_register(CARRIER_AxiCommon_trigMask, c0, BS, 0)
	write_register(CARRIER_AxiCommon_trigMask, c1, BS, 1)
	write_register(CARRIER_AxiCommon_trigMask, c2, BS, 2)
	write_register(CARRIER_AxiCommon_trigMask, c3, BS, 3)

def mask_triggers(s=0xf, c0=0xf, c1=0xf, c2=0xf, c3=0xf):
	set_trigger_mask(s, c0, c1, c2, c3)

def unmask_triggers(s=0, c0=0, c1=0, c2=0, c3=0):
	set_trigger_mask(s, c0, c1, c2, c3)

def set_trig_prescale_N_log2(N_log2):
	write_register(SCROD_AxiCommon_trig_prescale_N_log2, N_log2, BS)

def get_xrm_trigger_enable_status():
	return read_register(SCROD_AxiCommon_xrm_trigger_enabled, BS)

def enable_xrm_triggers():
	write_register(SCROD_AxiCommon_xrm_trigger_enabled, 1, BS)

def disable_xrm_triggers():
	write_register(SCROD_AxiCommon_xrm_trigger_enabled, 0, BS)

def allow_xrm_triggers_for_a_while(duration=1.0):
	if be_verbose_when_collecting_data:
		info("allowing xrm triggers for " + str(int(1000.0*duration)/1000.0) + " seconds...")
	a = get_SCROD_eventCnt()
	enable_xrm_triggers()
	time.sleep(duration)
	disable_xrm_triggers()
	b = get_SCROD_eventCnt()
	diff = b - a
	info("eventCnt difference: " + str(diff))
	return diff

def trigger_and_wait_for_xrm_triggers(duration=1.0):
#	if be_verbose_when_collecting_data:
#		info("allowing xrm triggers for " + str(int(1000.0*duration)/1000.0) + " seconds...")
	a = get_SCROD_eventCnt()
	if should_software_trigger:
		software_trigger(BS)
	else:
		write_register_without_readback_verification(SCROD_AxiCommon_clear_count_of_triggers_for_bunch_markers, 0xf, BS)
	wait_at_least_until_next_frame9()
	time.sleep(duration)
	b = get_SCROD_eventCnt()
	diff = b - a
	info("eventCnt difference: " + str(diff))
	return diff

expected_trigger_rate = { 0:11150.0, 1:5560.0, 2:2780.0, 3:1390.0, 4:690.0, 5:350.0, 6:170.0, 7:90.0, 8:40.0, 9:20.0, 10:10.0, 11:5.0, 12:2.0, 13:1.0, 14:1.0, 15:1.0, 16:1.0, 17:1.0, 18:1.0 }
def generate_histogram_of_trigger_rate_versus_prescale_N_log2(start, end):
	global expected_trigger_rate
	old_desired_trigger_quantities = set_desired_trigger_quantities(0, 0, 0, 0)
	mask_triggers()
	#max_rate = 151000.0
	for i in range(start, end+1):
		set_trig_prescale_N_log2(i)
		#duration = 40.0 * (2.0**i) / max_rate
		duration = 0.1
		#info(duration)
		if i > 10:
			duration = 1.0
		diff = allow_xrm_triggers_for_a_while(duration)
		#info(str(diff))
		rate = diff / duration
		expected_trigger_rate[i] = rate
		info("[" + str(i) + "]: " + str(rate))
	set_desired_trigger_quantities(old_desired_trigger_quantities[0], old_desired_trigger_quantities[1], old_desired_trigger_quantities[2], old_desired_trigger_quantities[3])

def get_SCROD_eventCnt(should_show_it=0):
	SCROD_eventCnt = read_register(SCROD_AxiCommon_eventCnt, BS)
	if should_show_it:
		info("SCROD_eventCnt: " + str(SCROD_eventCnt))
	return SCROD_eventCnt

def get_carrier_eventCnts(should_show_them=0):
	if 5==number_of_carriers[BS] or 0==number_of_carriers[BS]:
		return
	eventCnt = []
	if 1 <= number_of_carriers[BS]:
		carrier0_eventCnt = read_register(CARRIER_AxiCommon_eventCnt, BS, 0)
		eventCnt.append(carrier0_eventCnt)
		if should_show_them:
			info("carrier0_eventCnt: " + str(carrier0_eventCnt))
	if 2 <= number_of_carriers[BS]:
		carrier1_eventCnt = read_register(CARRIER_AxiCommon_eventCnt, BS, 1)
		eventCnt.append(carrier1_eventCnt)
		if should_show_them:
			info("carrier1_eventCnt: " + str(carrier1_eventCnt))
	if 3 <= number_of_carriers[BS]:
		carrier2_eventCnt = read_register(CARRIER_AxiCommon_eventCnt, BS, 2)
		eventCnt.append(carrier2_eventCnt)
		if should_show_them:
			info("carrier2_eventCnt: " + str(carrier2_eventCnt))
	if 4 <= number_of_carriers[BS]:
		carrier3_eventCnt = read_register(CARRIER_AxiCommon_eventCnt, BS, 3)
		eventCnt.append(carrier3_eventCnt)
		if should_show_them:
			info("carrier3_eventCnt: " + str(carrier3_eventCnt))
	return eventCnt

def set_desired_trigger_quantities(a, b, c, d):
	old_a = read_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_a, BS)
	old_b = read_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_b, BS)
	old_c = read_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_c, BS)
	old_d = read_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_d, BS)
	write_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_a, a, BS)
	write_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_b, b, BS)
	write_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_c, c, BS)
	write_register(SCROD_AxiCommon_desired_trigger_quantity_for_bunch_marker_d, d, BS)
	return old_a, old_b, old_c, old_d

def calculate_parameters(SST_clock_divide_ratio=6, should_print_info=0):
	# 5120 / 4 = 1280 FTSW clocks per frame
	# 5120 buckets / 508.8875 MHz = 10.0611628307 us per frame
	#
	# 127.221875 MHz / 6 = 21.203645833 MHz
	# 128 samples per write window * 21.203645833 MHz SST = 2714.066666 MHz sampling rate
	# 1/21.203645833 MHz = 47.1617007689 ns per write window
	# 10.0611628307 us / 47.1617007689 ns = 213.333333 write windows per revolution
	# 5120 / 213.333333 = 24.0 bunches per window
	# 6.0 FTSW bunches per window
	#
	# 127.221875 MHz / 8 = 15.902734375 MHz
	# 128 samples per write window * 15.902734375 MHz SST = 2035.55 MHz sampling rate
	# 1/15.902734375 MHz = 62.882268 ns per write window
	# 10.0611628307 us / 62.882268 ns = 160 write windows per revolution
	# 5120 / 160 = 32.0 bunches per window
	# 8.0 FTSW bunches per window
	global RF_clock_Hz
	RF_clock_Hz = 508.8875e6
	global period_of_RF_clock_ns
	period_of_RF_clock_ns = 1.0e9 / RF_clock_Hz
	global asic_samples_per_write_window
	asic_samples_per_write_window = 128
	global asic_samples_per_read_window
	asic_samples_per_read_window = asic_samples_per_write_window // 2
	global FTSW_clock_divide_ratio
	FTSW_clock_divide_ratio = 4
	global revolution_duration_s
	revolution_duration_s = RF_buckets / RF_clock_Hz
	global SST_clock_Hz
	SST_clock_Hz = RF_clock_Hz / FTSW_clock_divide_ratio / SST_clock_divide_ratio
	global sampling_rate_Hz
	sampling_rate_Hz = SST_clock_Hz * asic_samples_per_write_window
	global write_window_duration_s
	write_window_duration_s = 1.0 / SST_clock_Hz
	global read_window_duration_s
	read_window_duration_s = write_window_duration_s / 2.0
	global write_windows_per_revolution
	write_windows_per_revolution = revolution_duration_s / write_window_duration_s
	global read_windows_per_revolution
	read_windows_per_revolution = revolution_duration_s / read_window_duration_s
	global RF_buckets_per_write_window
	RF_buckets_per_write_window = RF_buckets // write_windows_per_revolution
	global RF_buckets_per_read_window
	RF_buckets_per_read_window = RF_buckets // read_windows_per_revolution
	global FTSW_clocks_per_write_window
	FTSW_clocks_per_write_window = RF_buckets_per_write_window // FTSW_clock_divide_ratio
	global FTSW_clocks_per_read_window
	FTSW_clocks_per_read_window = RF_buckets_per_read_window // FTSW_clock_divide_ratio
	global asic_samples_per_RF_bucket
	asic_samples_per_RF_bucket = asic_samples_per_read_window // RF_buckets_per_read_window
	global total_number_of_physical_windows
	total_number_of_physical_windows = 512
	if should_print_info:
		info("revolution_duration_us: " + str(revolution_duration_s*1.0e6))
		info("SST_clock_MHz: " + str(SST_clock_Hz/1.0e6))
		info("sampling_rate_GHz: " + str(sampling_rate_Hz/1.0e9))
		info("write_window_duration_ns : " + str(write_window_duration_s*1.0e9))
		info("read_window_duration_ns : " + str(read_window_duration_s*1.0e9))
		info("write_windows_per_revolution: " + str(write_windows_per_revolution))
		info("read_windows_per_revolution: " + str(read_windows_per_revolution))
		info("RF_buckets_per_write_window: " + str(RF_buckets_per_write_window))
		info("RF_buckets_per_read_window: " + str(RF_buckets_per_read_window))
		info("FTSW_clocks_per_write_window: " + str(FTSW_clocks_per_write_window))
		info("FTSW_clocks_per_read_window: " + str(FTSW_clocks_per_read_window))

def show_xrm_trigger_enable_status():
	en = read_register(SCROD_AxiCommon_xrm_trigger_enabled, BS)
	info("xrm trigger enabled: " + str(en))

def show_relevant_registers():
	#get_SCROD_eventCnt(1)
	#get_carrier_eventCnts(1)
	show_frame_masks()
	nlog2 = read_register(SCROD_AxiCommon_trig_prescale_N_log2, BS)
	info("N_log2 prescale: " + str(nlog2))
	show_xrm_trigger_enable_status()
	show_asic_timeouts(BS)
	show_SEM_status(BS)

def show_some_info():
	info("")
	show_current_time()
	show_asic_timeouts(BS)
	get_SCROD_eventCnt(1)
	get_carrier_eventCnts(1)
	show_relevant_registers()
... 3541 more lines ...
  31   Mon Feb 3 08:22:06 2025 M. Andrewdocumentationconfig file
Attached is the updated .config file for 2025.
Attachment 1: .config
mode="eth"
local_IP=""
fake_it="no"
remote_port="8192"
#ethernet_device="eth0"
ethernet_device="enp4s0"

# good:
#remote_IP="192.168.10.4" # installed in HER
#remote_IP="192.168.10.108"
#remote_IP="192.168.10.49" # on bench in HI
#remote_IP="192.168.10.9" # revB
remote_IP="192.168.10.33" # inside laser dark box
#remote_IP="192.168.10.86"
#remote_IP="192.168.10.89"
#remote_IP="192.168.10.101"

# revB + hookup2:
#remote_IP="192.168.10.6" # scrod revB + hookup2

#remote_IP="192.168.10.27" # frankenstack

# 2023 newly minted TOP boardstacks:
#remote_IP="192.168.10.73" # 
#remote_IP="192.168.10.23" # former s16b (bad DDR)
#remote_IP="192.168.10.87" # 
#remote_IP="192.168.10.102" # 
#remote_IP="192.168.10.73" # 
#remote_IP="192.168.10.35" # 
#remote_IP="192.168.10.87" # 

# bad DDR:
#remote_IP="192.168.10.30"
#remote_IP="192.168.10.58"
#remote_IP="192.168.10.93"

# for threshScan1boardstack.py:
maximum_iterations=2000
step_initial_when_reading_from_file=2
step_initial_when_from_seed_value=2
#number_of_channels_to_get_before_quitting_threshold_scan=64
number_of_channels_to_get_before_quitting_threshold_scan=128

# for xrm.py:
xrm_run_continuous=0
plot_continuous=1
show_plot=0
datafilesize=20000000
be_verbose_when_collecting_data=0
use_pedestal_subtraction_mode=1
retake_pedestals_at_every_filechange=0
desired_pause_between_acquisitions=0
should_cycle_slowly_through_bunch_markers=0
multicast_cal_signal=1
enable_cal_signal=1
should_plot_beam_current=0
should_write_root_tree=1

oserdes_always_value=0b00000000
oserdes_triggered_value=0b11100000

carriers_to_use="0123"
#plot_width=1800
#plot_height=800
plot_width=1920
plot_height=1080

desired_RF_bucket=214
RF_bucket_sample_offset=0

sweep_start_bucket=4
#sweep_start_bucket=772 # 64 windows
#sweep_start_bucket=2308

#sweep_end_bucket=196 # 16 windows
#sweep_end_bucket=292 # 24 windows
#sweep_end_bucket=388 # 32 windows
#sweep_end_bucket=772 # 64 windows
#sweep_end_bucket=1540 # 128 windows
#sweep_end_bucket=2308 # 192 windows
#sweep_end_bucket=3076 # 256 windows
#sweep_end_bucket=3844 # 320 windows
#sweep_end_bucket=4612 # 384 windows
sweep_end_bucket=5116 # 426 windows

xrm_mode="sweep"
#xrm_mode="acquire"
#xrm_mode="parse"
#xrm_mode="reconfig"
#xrm_mode="pedestal"

ELOG V3.1.5-3a5f2f0