CSM-0 MiniDAQ3.0.0 Operations & Diagnostics Guide
Contents
1 Introduction to the CSM MiniDAQ and Installation
2 Installation and Starting the CSM MiniDAQ
3
JTAG Programming
4
Acquisition Runs
5 Diagnostic Tools
6 Useful Information
Installation and Build Option:
To install the CSM MiniDAQ3.0.0, first get the file CSMMiniDAQ3.0.0.zip from directory
http://atlas.physics.lsa.umich.edu/docushare/dsweb/Get/Document-2074/
. Expand the zip file into a directory on your machine and run setup.exe. The user is able to modify the program path during installation.
A file <constant.h> is included in the 3.0.0 distributions of CSM MiniDAQ. This file contains build options and parameters that can be changed to reflect hardware upgrades. The main build options are
FIREWIRE
,
PDT_ONLY
, and
ENVIRO_CHECK
. If a FIREWIRE (IEEE 1394) VME interface is used, the diagnostic menu does not print the VME FIFO correctly unless the line
#define FIREWIRE
is uncommented.
PDT_ONLY
tells the CSM MiniDAQ to use only programmed IO instead of block transfers when collecting data (note: this does not affect the diagnostics panel which uses block transfers). To use block transfers, comment out the line
#define PDT_ONLY
. Finally,
ENVIRO_CHECK
includes support for using an ADC card to take measurements of temperature, pressure, and humidity and also to use these as a feedback control on the chamber. The calibration is specific to the University of Michigan cosmic ray test, but the code can be easily modified to use different ADC and DAC cards. To enable the environment checking software, comment out the line
#define ENVIRO_CHECK
.
Starting the CSM MiniDAQ:
Figure 1. The CSM MiniDAQ main window
If the MiniDAQ is compiled with
DEBUG
mode, the DAQ speed will be reduced significantly. It is always good to build
Release Executable
for normal DAQ.
Before running the CSM MiniDAQ program, make sure that the VME hardware has been initialized with the NI Resource Manager and that all CSM0 Modules are include in the device list. CSM0 Cards responds to A32 address space when the address agrees with the address range set by the dipswitches on the CSM0 Card.
The CSM MiniDAQ program is started with the file csm0.exe, which brings up the main CSM MiniDAQ window. The program will automatically scan for CSM0 cards in the VME crate. If only one CSM0 card is found, the card will be used. Otherwise the user will be asked to provide additional information (normally BASE address). When the user quits the program, several parameters (BASE, run #, # used mezzanine cards, BCID/EVID preset value and BCID rollover) are recorded in the file <DAQpara.txt> which is used by the CSM MiniDAQ program. If default settings are saved by user, the default settings will be loaded.
For normal data acquisition with AMT mezzanine cards, DAQ initialization could be performed by simply hitting the
button at first. All of the necessary commands to modify the AMT mezzanine card settings are in the JTAG pull-down menu, along with the JTAG diagnostic panel. The mezzanine card setups can be saved and recalled from the File menu. Once JTAG programming is finished, standard data acquisition commands are all located on the main window. Diagnostic tools are located in the BoardTest pull-down menu for CSM0 board functionality tests, in the JTAG pull-down menu of “Diagnostics” for JTAG tests and in the Execute pull-down menu of “Diagnostic Run” for data acquisition diagnostics.
Use the Help pull-down menu to obtain online help for command buttons and menu items. After selection of the menu item Help on Buttons, click on any wanted command button or menu item and a brief description of the item functionality will be popped up for view.
3 JTAG Programming
3.1 Connecting the hardware
JTAG protocol requires all devices on the JTAG chain be in series to work properly. There are two kinds of adapter boards used with the AMT-1 cards which are called mezzanine lite cards. Refer to earlier versions of this guide for information on these early adapters. MiniDaq3.0.0 is designed for Octal mezzanine cards containing AMT-2/3 and is mostly used with the CSM motherboard and the Boston University built MiniAdapter. There are two JTAG ports on the CSM0 Module, JTAG IN and JTAG OUT. The MiniAdapter also has a JTAG IN and JTAG OUT. Note that the CSM0 JTAG OUT is cabled to the MiniAdapter JTAG IN and the MiniAdapter JTAG OUT is cabled to the CSM0 JTAG IN.
Each cable connected from a mezzanine card to the CSM motherboard signals to the MiniAdapter that the mezzanine card exists and should be placed in the JTAG chain. The corresponding communication cable from the MiniAdapter to the CSM0 should also be installed in this case since data should be collected if the mezzanine card is in the JTAG chain and initialized. Without this data cable, no data would be received from a mezzanine card considered to be in operation. One can actually disable the mezzanine card so that no errors will be generated by the missing card but this is usually done only for diagnostic purposes. If a mezzanine card to motherboard cable is removed along with its communication cable and the card is disabled, the system will run without the 24 channels of the card. In fact, mezzanine card cables and communication cables can be moved to different paths through the motherboard and MiniAdapter but this is not recommended since it changes the channel maps between tubes and electronics channels and will confuse the reconstruction programs.
Be sure the power is applied before starting JTAG programming.
3.2 JTAG Menu
The AMT mezzanine cards are programmed through their JTAG port connections by using the JTAG pull-down menu as shown in the right picture. Also, a diagnostic tool has been provided that will be discussed later. An individual mezzanine card (Setup Individual) is to be loaded only after all mezzanine cards have been initialized with common settings.
·
Mezz. Connection Map provides a way for user to map the mezzanine card connections to CSM0 electronic channels (TDCs) automatically or manually. The mezzanine card ID is assigned using the following rules: 1) If a mezzanine card connection map is provided, the TDC’s number will be assigned the mezzanine card ID. 2) If the number of enabled TDCs is same as the number of mezzanine cards, the first mezzanine card in JTAG serial chain has the same ID as the first enabled TDC’s number and second mezzanine card in JTAG serial chain takes the second enabled TDC’s number as its ID and so on. 3) If neither above two cases is true, it is assumed that first mezzanine card in JTAG serial chain is connected to CSM0 Channel 0, second mezzanine card in JTAG serial chain is connected to CSM0 Channel 1 and so on, making the corresponding TDC’s number the same as the mezzanine card ID. Therefore it is implicitly important to connect the JTAG cables in the same order as they are plugged into the RJ45 jacks of CSM0 board if no mezzanine card connection map is provided. Figure 2 shows the generated mezzanine card connection map obtained using Mezz. Connection Map, where the mezzanine card number is the sequential number starting from 0 in the JTAG serial chain. Pushing
button will restart mapping the mezzanine card connection between mezzanine cards and CSM0 input channels. A valid map is indicated by
shown in Figure 2, where the first mezzanine card is connected to CSM0 channel 17 (TDC 17) and second mezzanine card is connected to CSM0 channel 4 (TDC 4).
Figure 2. The CSM Channel and Mezzanine Card Connection Map Window
Pay Attention:
If mezzanine card connections are manually mapped or the connection map has been changed, it is the user’s responsibility to make sure that individual mezzanine card settings are right and to program mezzanine cards correctly.
·
Setup All (Ctrl-A) will call mezzanine card setup panel where user is allowed to modify the settings before they are downloaded to mezzanine cards. All mezzanine cards are programmed to the same settings.
·
Setup Individual will let user to select individual mezzanine card to be programmed.
·
Setup Send (Ctrl-S) will program mezzanine cards without any modification of the settings. First all mezzanine cards are downloaded with common settings, then each individual mezzanine card is downloaded with its own settings if it has been programmed individually.
·
Change # Mezz. Cards allows user to change number of mezzanine cards in JTAG chain. Setup send will be called after the change.
·
Diagnostics provides tools to view mezzanine card settings and to test JTAG connections of mezzanine card.
·
Set JTAG Clock Rate sets the TCK JTAG clock rate. Each increase in the value of the clock rate setting is an additional factor of two slower than the base clock rate of 20MHz (JTAG clock rate = 0) if 40MHz clock is used by CSM0. If the JTAG clock rate divisor is smaller than default value of 3, the JTAG may not work properly.
3.3 Program AMT Mezzanine Cards Using JTAG Menu
It is important for the user to give correct number of AMT mezzanine cards in the JTAG chain in order to program them correctly. The AMT mezzanine cards settings can be programmed via JTAG menu, where JTAG
ŕ
Setup All sets common settings to all mezzanine cards and JTAG
ŕ
Setup Individual operates on as single mezzanine card.
Applying individual setting to mezzanine card:
Applying individual setting to mezzanine card:
Once a common setup has been applied to the attached mezzanine cards, any given AMT card can be individualized. To program an individual mezzanine card, select JTAG
ŕ
Setup Individual
ŕ
Mezzanine N, where N is the assigned mezzanine card ID. The individual setup panel is virtually identical to the common setup panel
Figure 3. The Mezzanine Card Setup Window
If a profile was loaded with individualized settings for a card, the panel corresponding to that card will hold the saved values. If there are any individualized mezzanine card settings, it is necessary to download the individualized settings by issuing a Setup Send after the Setup All is applied.
The JTAG
ŕ
Setup All and JTAG
ŕ
Setup Individual will bring up an AMT mezzanine card setup window shown in Figure 3 (from JTAG
ŕ
Setup All), which contains switches, selection boxes and command buttons. The AMT Error Control Window (Figure 4) is invoked by clicking
.
Figure 4. The AMT Error Control Window
Each mezzanine card contains 24 channels which can be individually turned on/off by clicking on desired channel button. Also each mezzanine card has three ASD chips which are independently programmable. The buttons of
,
and
access the corresponding ASD setup window as shown in Figure 5 (example is for ASD1).
Figure 5. The ASD Control Window for Mezzanine Card
Each ASD controls 8 calibration channels which can be turned on/off individually. In normal DAQ runs, ASD channel mode should be turned to Active mode. For detailed ASD programmable parameters, please see reference [5].
saves the current mezzanine card settings to a text file.
recalls the mezzanine card default settings and
closes the setup windows and reverts to previous settings. The mezzanine card settings are applied after the
button on the Mezzanine Card Setup Window is selected.
If mezzanine card settings are individualized, it is recommended to issue JTAG
ŕ
Setup send after mezzanine card settings have been programmed, which ensures the proper programming parameters for each mezzanine card.
All the mezzanine card settings are read back via JTAG and are compared with original setup array. If any error is detected, programming information Panel will be popped out automatically where the failed mezzanine cards will be shown. Also the mezzanine card setup status is shown in the CSM MiniDAQ Main Window. All of the AMT and ASD settings are explained in Appendix C, for more detailed information please refer to the AMT manual [2] and ASD manual [5], [4]. For most applications, the default values should be sufficient. The values that will need the most tweaking are Trigger Offset, the Mask Window, Search and Match Windows in Mezzanine Card Setup Panel, Main Threshold and Chip Mode in ASD Control Panel.
3.4 Profile: Save and Download Setups
The JTAG settings can be saved into a profile for future usage. This is done by using File pull-down menu. Select File
ŕ
Save Profile to save current settings into a profile. A file open dialog will open and display files with file extension .prf (profile). A that point the user could provide a new file name or pick one of the existing profiles to overwrite, After file name selection, the current JTAG settings will be saved into the selected file. Similarly to load a saved profile, select File
ŕ
Load Profile (Ctrl-L). This will bring up a file open dialog and display files with file extension .prf (profile). After a profile is selected and loaded, the user will be asked whether to download the mezzanine cards with the loaded settings if number of mezzanine cards in the saved profile is not zero. A YES confirmation will enable the JTAG and download the mezzanine card settings to the hardware. An answer of NO implies that user will download mezzanine card settings later.
A file <default.prf> which contains standard settings is included with the CSM MiniDAQ distribution, but these settings will need to be modified for the particular hardware. To save the mezzanine card settings for reuse, select File
ŕ
Save Profile described above. A saved profile contains both the common and the individual mezzanine card settings.
Also a default profile could be saved by using “File
ŕ
Save Profile as Default”, where the current JTAG settings are saved into a file <default.prf> and the file <default.prf> would become the default JTAG settings in the future. To clear a default profile, it is better to use “File
ŕ
Clear Default Profile”.
3.5 Copy Mezzanine Card Settings
There is a command button
in the mezzanine card setup window as shown in Figure 2. This button brings up the copy mezzanine card setup window as shown in Figure 6 and allows the user to copy one mezzanine card’s settings to other mezzanine cards.
is disabled if there is only one or no mezzanine cards in the system for obvious reason.
Figure 6. The Copy Mezzanine Card Setup Window
The mezzanine card whose data is to be copied is selected from box
From
,
and the destinations are a group of toggle buttons. Copying of the main threshold, AMT channel mask, and ASD channel mask are separately controlled, so that the user can decided whether to copy them. If the mezzanine card settings are copied, it is assumed that those mezzanine cards settings is individualized. To start the copy process, click on the
button and click on
to exit from the copy mezzanine card setup window.
4 Acquisition Runs
To collect data, the correct PROM in the CSM0 daughter card should be installed, where the XILINX and TTCEM version number is 0x5005 (Hexadecimal) or higher. The first step in a data acquisition run involves downloading mezzanine card settings using the JTAG menu.
Data acquisition is handled from the main CSM MiniDAQ panel by taking the following actions:
1. Select the desired CSM0 inputs (mezzanine cards) if not already done.
2. Modify run setups as user wishes, such as Auto Run Setup, Get BCID Preset Value, Data Monitor Controls and Storage Selection;
3. Initialize DAQ if necessary;
4. Begin the run and accumulate data;
5. End the run if automatically stopping run is not enabled.
4.1 CSM Input Channel Control (TDC Enable and Control)
To select wanted CSM0 input channels, click
on the main CSM MiniDAQ panel brings up the TDC Enable and Control panel as shown in Figure 7.
Figure 7. The TDC Enable and Control Window
To enable or disable an individual CSM0 input channel, click on TDC button where TDC number is the CSM0 input channel number. A green TDC button
indicates that the CSM0 input channel is selected and a red TDC button
indicates that the CSM0 input channel is disabled. If mezzanine card connection mapping has been done, click on button
which will enable all CSM0 input channels which are connected to mezzanine cards according to the mapping.
If a connected CSM0 input channel is not enabled, the CSM0 will not expect to receive data from that input channel and will ignore any data from that CSM0 input channel. The TDC enable and Control panel is used to turn on or off an entire TDC, therefore an unselected TDC will result in no data from the CSM0 for that TDC. To turn individual channels within a 24 channel TDC off, one must use the JTAG menu as discussed in Section 3 JTAG Programming. If unconnected CSM0 input channels (TDCs) are enabled, MiniDaq will hang while the CSM0 waits for data from an unconnected card. The user also is able to change trigger FIFO and WC FIFO limits which specify the maximum number of allowed events. For normal operations, it is sufficient to enable the desired TDCs and then push
button. The TDC Enable Mask,
, on the CSM0 MiniDAQ Main Window displays the current CSM0 input channel selections, where 1/0 indicates on/off for the corresponding CSM0 input channel (TDC).
4.2 Run Settings
Before starting a new run, the user has to decide whether to change the run settings for data acquisition, such as data storage, auto run setup and whether to monitor data etc. This section will discuss this in detail.
Storage Selection:
Figure 8. Storage section of the CSM Main Window
To select data storage, use the Storage pull-down menu as shown in Figure 8. There are two main choices, either discard acquired data (select None) or store data into a disk file (select Disk). If Disk is selected, data will be stored in the file indicated by
.
There are two options for save data into a disk file:
1. Disk (Auto Generated Filename) will automatically generate file name as run########_yyyymmdd.dat, where ######## is run number, yyyy is year, mm is month and dd is date, this option is recommended.
2. Disk (User Defined Filename) will let user to give a file name. The storage file can either be selected using the BROWSE button (which will bring up a standard windows file selection window) or the file name can be edited directly in the
window. The file will be checked to see if it is already on the disk to avoid overwriting existing file after start the run.
The run number will be automatically incremented by one for a new run if Disk option be selected, otherwise the run number will stay the same. If “auto restart run” has been set, it is recommended to use Disk (Auto Generated Filename) if the user wishes to save data into a disk file. Select Disk (User Defined Filename) in the “auto restart run” mode will overwrite any existing data file of the same name.
Auto Run Setup:
To bring up the auto run setup panel as shown in Figure 9, use Execute
ŕ
Auto Run Setup on the CSM main panel. Users can turn on/off each setting by clicking on corresponding ON
/OFF
toggle button. Also if an individual setting number is modified, it is assumed that the user wants to turn on that setting. Each setting is explained following:
Figure 9. Auto Run Setup Window
·
Stop at Event (Default = 4294967295):
Stop the run after accumulating the specified number of events.
·
Restart at Event (Default = 100000):
Start a new run after the collection of a specified number of events.
·
Restart After xx Seconds (Default = 4294967295):
Start a new run after a specified DAQ time.
·
Restart After DAQ Hang(s) (Default 30):
Start a new run after a timeout of the specified DAQ hang time (s = seconds, number is time, therefore default is 30 seconds). This avoids a hang of the DAQ should a mezzanine card stop sending data.
·
ResetDAQ at Event Error (Default 100):
Reset DAQ after observed specified number of event errors.
·
Save Registers after DAQ Hang:
If enabled, read and save all CSM0 registers into a file after DAQ hang. The file name is <***_register.log>, where *** is the data file name without “.dat”. This is useful to trace the causes of DAQ hang.
·
Stop after # of Errors (Default 1):
Stop the run after the specified number of event errors.
·
Select Automatic Run Control File:
Select control files for automatic runs. For more information about automatic run control file see Section 6.3 “Automatic Run Control File”.
After finishing the auto run setup, just click the
button.
Get BCID Preset Value:
The CSM0 can compare the BCID of each event as read from the mezzanine cards to the BCID it keeps from the trigger time. To insure that this comparison is exact, an offset is defined as a BCID preset value. To get the appropriate BCID preset value for this comparison, use Execute
ŕ
Get BCID Preset Value in CSM Main Window. This will automatically calculate the CSM0 BCID preset value to insure an exact match. If a valid BCID preset value is obtained, user is asked whether to enable CSM0 BCID match testing. Enable CSM0 BCID match testing may result in DAQ hang or data abortion in CSM0 if the BCID fails to match because of some fault. User is encouraged to use Execute
ŕ
Get BCID Preset Value to obtain the CSM0 BCID preset value without enabling CSM0 BCID match testing. In this case the BCID will be monitored by online data analysis and reported but without a halt to data taking. This will provide additional validation of AMT mezzanine card performance. To disable BCID online monitoring, first enable the BCID match testing at CSM, then use Execute
ŕ
Disable BCID Match.
Data Monitor Controls
Figure 10. Data Monitor Controls on the CSM Main Window
It is always good to take data with online data monitor which is also a useful diagnostic tool. There are two toggle buttons to control data monitor as shown in Figure 10, one for DAQ information, such as DAQ rate, event size and data flow rate as shown in Figure 11,
Figure 11. DAQ Information Window
and another provides data quality checks. Both DAQ information and data analysis are enabled by default. The user can turn them on or off at any time, even during data taking by just clicking on the corresponding button. If DAQ rate is more than 4KHz, enableing the DAQ monitor has a significant impact on the maximum DAQ rate possible.
The DAQ rate, event size and data flow rate are numerically and graphically displayed in the DAQ information window. The DAQ time is also shown. By default, the DAQ plots for the entire run are displayed, the most recent 15 minute DAQ plots can be displayed by clicking on the
button. The background color has the following meaning (not for DAQ plots): green
indicates OK, red
indicates error, yellow
indicates a warning or run in pause, and magenta
indicates old values.
Figure 12. Data Monitor Error Report Window
If data analysis is enabled, the data will be monitored and checked. If any error is found, data monitor error report window will be automatically popped out as in Figure 12. It is assumed that the user wishes to close the data monitor error report window for rest of the run if the
button is selected. User can bring up the data monitor error report window again by using Execute
ŕ
Data Error Report at any time. The background color has following meaning: green
= OK, red
= error, yellow
= warning and black = not checked.
·
# Event With Error:
the number of events with error(s);
·
# Word Counter Error:
the number of word counter errors where the number of expected data words (from WC/BCID register) does not agree with number of received data words;
·
# CSM BCID Error:
the number of BCID mismatchs in CSM headers;
·
CSM WordCount Error:
the number of word counter errors in CSM trailers;
·
# BCID Mismatch:
the total number of BCID mismatchs;
·
# EVID Mismatch:
the total number of EVID mismatchs;
·
# Empty Event:
the number of events with zero data words;
·
# WC EVID Mismatch:
the total number of EVID/WC mismatchs (expected EVID is previous event number + 1
modulo 4096
);
·
# Extra Words:
the number of events with unexpected data words;
·
# CSMhdr EVID Error:
the number of EVID mismatchs in CSM headers;
·
# CSMtrl EVID Error:
the number of EVID mismatchs in CSM trailers;
·
# CSMabr EVID Error:
the number of EVID mismatchs in CSM abort words;
·
# CSM Error:
the number of CSM error words;
·
# CSM Abort:
the number of CSM abort words;
·
Missing CSM Header:
the number of events without CSM headers;
·
Extra CSM Header:
the number of events with more than 1 CSM header;
·
Missing CSM Trailer:
the number of events without CSM trailers;
·
Extra CSM Trailer:
the number of events with more than 1 CSM trailer;
·
# TDC Error:
the number of TDC error words;
·
# Empty TDC Error:
the number of empty TDC error words;
·
# Empty TDC Mask:
the number of empty TDC mask words;
·
# TDChdr EVID Error:
the number of EVID mismatch in TDC header;
·
# TDCtrl EVID Error:
the number of EVID mismatch in TDC trailer;
·
# TDC BCID Error:
the number of events with BCID mismatch between TDC headers;
·
# Missing TDC Header:
the number of events with missing TDC headers;
·
# Extra TDC Header:
the number of events with extra TDC headers;
·
# Missing TDC Trailer:
the number of events missing TDC trailers;
·
# Extra TDC Trailer:
the number of events with extra TDC trailers;
·
# TDCID ErrIn THD:
the number of TDC ID errors (unexpected ID) in header;
·
# TDCID ErrIn TTR:
the number of TDC ID errors (unexpected ID) in trailer;
·
# Parity Error Word:
the number of CSM parity error words.
·
TDC HD After its Data:
the number of TDC headers following data;
·
TDC TR AheadItsData:
the number of TDC trailers ahead of data.
·
TDC WC Mismatch:
the number of TDC word counter mismatches;
·
Cont. Same Edge
: the number of TDC data words which continue with same edge (leading or trailing edge) for leading and trailing edge mode data within an event.
·
Unexpected TDC Data
: the number of unexpected TDC data words, where an unexpected data word is defined as wrong data type than expected. For instance, a leading/trailing edge data word should not be present at pair mode.
·
# Warning Events
: the number of events with warnings.
·
Wrong TDCtime Order
: the number of TDC data words where the digitization time is not in ascending order.
·
# TDC Edge Error:
the number of errors reported in TDC leading/trailing words;
·
EdgeErr.
Width<20bin:
the number of errors reported in TDC leading/trailing words where the measured width is smaller than 20 counts.
·
Evt No TDC Hits:
the number of events without any TDC hits.
·
Evt Only TDC Hd&Trls:
the number of events with only TDC headers and trailers.
·
# TDC MaskWord:
the number of TDC mask words.
·
# TDC Debug Word:
the number of TDC debug words.
·
# DAQ Reset:
the number of applied DAQ resets during the run.
·
# Error-Forced Reset:
the number of DAQ resets due to DAQ errors.
4.3 Starting a run and Collecting Data
After the selection of the
button to do a DAQ initialization, a run can be started by just clicking the button
. Few things will be checked at this point, such as event offset (another name EVID Preset Value), BCID Rollover, and whether disk file will be overwritten if storage selected as Disk. If any problem is detected, the user will be informed and will be asked to make decisions.
The basic DAQ information is displayed in the CSM MiniDAQ main window as shown in Figure 1. The
Run No
shows the current run number and the
Evt No
status box gives the number of accumulated events. To allow for faster data acquisition, multiple events are written into a single buffer that is transferred to disk when full. The
Buffers
status box shows number of these buffers. Also, DAQ time and current DAQ rate are shown. If data analysis is enabled, number of events with one or more errors is displayed in status box of
# Error
.
During the run,
and
on the CSM MiniDAQ main window allow the user to suspend and resume data acquisition. Once enough events have been accumulated, click on command button
to start the run termination process. MiniDAQ will inhibit any new triggers, read the rest buffered events, and flush the last storage buffer into the disk. A run log is saved on the disk with a file name <***.log>, a hit summary is written into a file with name <***.sum>, an error summary is written in a disk file with name <***.err>, and if the data monitoring is enabled, a file with name <***> is written with monitoring information.
5 Diagnostic Tools
CSM MiniDAQ provides tools for diagnosing the CSM0 hardware, JTAG programming, and data acquisition. CSM0 hardware diagnostic tools including the Board Test pull-down menu and Execute
ŕ
Diagnostics Run. JTAG programming has a diagnostic panel that can be used when JTAG serial is enabled through JTAG
ŕ
Diagnostics. The tools for data acquisition can be accessed with Execute
ŕ
Diagnostics. A few useful tools are accessible via Execute pull-down menu.
5.1 Using the Board Test Menu
Board Test pull-down menu provides an easy and quick way to check the functionality of CSM0 VME board and daughter board, which including following tools:
·
Test CSM/Mezz. Board: It will bring up the panel as shown in Figure 13 to test CSM0 VME board and CSM0 Mezzanine Board (another name CSM0 Daughter Board).
Figure 13. Test CSM/Mezzanine Board Window
The program first checks whether the CSM0 VME board is functional by looking at its
Board ID
and if the
Board ID
is correct, enables all CSM0 register tests. Code also verifies the CSM0 daughter board and enables all CSM0 mezzanine register tests if verification is passed. The user should click on a desired register test toggle button to enable or disable a particular register test. It is also possible to enable/disable register tests by groups as shown in Figure 13. A green register item
indicates that register test is on and a red register item
indicates that register test is off. If the register passes the test, the corresponding LED indicator will turn to green
, otherwise it stays on red
(register test not passed or not selected). After all the tests have been performed, a test summary will be reported in the
Message
box.
It is worth noting at this point that the test
checks whether master reset is functional as expected. A test data word is written to all the CSM0 mezzanine card registers including VME address 96 for JTAG, a master reset is issued, and then all active registers are checked against their expected default value. Most of them should be zero. The test is repeated 1000 times. To perform a
test which checks whether the CSM0 receives trigger and flags the event ready bit correctly, external trigger must be connected with a trigger rate at least 100Hz.
·
Look Mezz. Card Signals: User is required to check the CSM0 mezzanine card signal period by using scope and to compare it with expected period, where the diagnostic PROM is involved. After the signal has been checked, the user needs to click on the corresponding
Period Status
toggle button and if the observed period is the same as expected or on the corresponding
Check Status
toggle button if the observed period is not same as expected. Figure 14 shows an example for CSM0 mezzanine card read address 9 to 13 signals. User will be warned if some signals are not checked.
Figure 14. Look Read Address(9:13) Signal Window
·
Measure Received Rate(TDCs off): This button brings up the CSM0 Received Trigger Rate window as shown in Figure 15 and measures the CSM0 received trigger rate twice in 30 seconds and 60 seconds respectively, where all TDCs are off. During the rate measurement the time progress bar will be filled seconds by seconds with a green
color as measurement proceeding. Because the rate is measured by using computer CPU, any activities of the computer could has significant impact on the measurement, therefore it is better do not touch the computer during the rate measurement.
Figure 15. Measure CSM Received Trigger Rate Window
· Loop on Register: This button allows the user to read/write any VME address with any wanted data and it is also allows a comparison of the read data to expected values, where the corresponding LED will indicate the comparison results (green = OK, red = Error). The loop on register panel is shown in Figure 16.
·
Loop on Register: This button allows the user to read/write any VME address with any wanted data and it is also allows a comparison of the read data to expected values, where the corresponding LED will indicate the comparison results (green
= OK, red
= Error). The loop on register panel is shown in Figure 16.
Figure 16. Loop on Register Window
There are three ways to select desired register, by its name, address or specified by the user. To choose a method, click on corresponding button and select the register or VME address. The other methods will automatically be set to idle. Push to start the loop and to stop the loop. The loop time will be displayed. Exit the loop on register panel by hitting button.
There are three ways to select desired register, by its name, address or specified by the user. To choose a method, click on corresponding button and select the register or VME address. The other methods will automatically be set to idle. Push
to start the loop and
to stop the loop. The loop time will be displayed. Exit the loop on register panel by hitting
button.
·
Check TDC On/Off Status: It scans through all the CSM0 input channels to see which CSM0 channel could receive data, and the scan results are compared with enabled TDCs, where the software trigger is used. An example is shown in Figure 17 where TDC 4 and TDC 17 are detected to be on. During a scan, the scanned TDC number is displayed in the
Checking TDC
box. Command
button allows the user to rescan all the CSM0 input channels, and
exits the test.
Figure 17. TDC On/Off Status Window
5.2
Using the JTAG Diagnostics Panel
The JTAG Diagnostics panel is brought up by click JTAG
ŕ
Diagnostics, which is useful for checking if the CSM0 JTAG port is functional and if the AMT mezzanine boards are configured correctly. Figure 18 is the JTAG diagnostics panel, where the following tools are provided:
·
selects mezzanine cards ID;
·
reads the AMT ID code and compares it to the expected AMT ID code;
·
performs a global reset to all connected mezzanine cards using the control register of the AMT mezzanine card;
·
reads the status registers of the selected mezzanine card, where the AMT mezzanine card ID follows the ID in
;
Figure 18. JTAG Diagnostics Window
·
shows the selected mezzanine card settings;
·
shows the mezzanine card common settings used by Setup All (see Section 3.2 and 3.3);
·
checks the settings of selected AMT mezzanine cards, where the settings are read back and compared with original one. The read back settings are displayed in programming information panel as shown in Figure 19.
Figure 19. Programming Information Window
The number of mismatched bits of the setup array and the number of failed mezzanine cards are indicated in the Programming Information panel. The mezzanine card failure flags and the individualized mezzanine cards are displayed also.
·
checks the mezzanine card common settings used by Setup All;
·
performs a loop test on all mezzanine cards at the same time with “random” setup array. Figure 20 illustrates the window of loop test on JTAG setup. CSM0 JTAG could be verified well by performing that test.
Figure 20. Loop Test on JTAG Setup Window
The setup loop tests are done as follows: 1) Zero all setup bits, set only 1 bit to one, and go through all setup bits (walk one test); 2) Put all setup bits to 1, set only 1 bit to zero, and go through all setup bits (walk zero test); 3) With certain fixed setup pattern (fixed pattern test); 4) Using random number generator to get “random” setup array. All loop test results are displayed in the loop test on JTAG setup window, and the failed mezzanine cards are indicated as well. Zooming on the error display plots is allowed and the JTAG rate divisor can be changed at any time. If JTAG rate divisor is less than 3, the JTAG loop tests will most likely fail.
·
performs a loop test on the selected mezzanine cards with “random” setup array, the test sequence is same as
;
·
performs loop test on all mezzanine cards one by one with “random” setup array, the test sequence is same as
;
·
provides a way to perform CSM0 JTAG test without AMT mezzanine cards. A straight RJ45 cable is used to connect CSM0 JTAG IN and JTAG OUT directly, where the fixed data patterns are used in the test.
5.3 Using the CSM0 Diagnostic Panel
Execute
ŕ
Diagnostics Run controls the CSM0 diagnostic panel as shown in Figure 21. Due to the fact that user is able to write and read many CSM0 registers by using Global Controls, TTCem Controls and CSM0 Controls menus, and
button, this panel provides a powerful and robust tool for CSM0 board diagnostics. A few examples will be illustrated below. The panel can also be used to debug data acquisition problems and will be discussed in more details later.
Figure 21. CSM0 Diagnostic Window
Click on
button, to examine the content of the selected register indicated by the Readback Register. The repeat count,
, controls how many times the next operation will be done. This count is reset back to 1 after the operation is performed. For instance, if the Repeat is set as 16 as shown in Figure 21, and the
button is pushed, with the Board ID in Readback Register, the register will be read 16 times.
Examples for CSM0 Board Diagnostics
Examples for CSM0 Board Diagnostics
Example 1: Check read-only register
Choose a desired register to be read in the Readback Register box, for example Board ID, which should be 0x2332E31. Read that register repeatedly or read it after various operations are performed such as Master Reset and activity on other read/write registers. The value obtained should be always be 0x2332E31..
Example 2: Check a register that can be written and read
First write a data word to a selected register, a good example is TTCem Controls
ŕ
Set Pipeline, then read that register by selecting it in the Readback Register box. The read back value should agree with the written data word, otherwise something is wrong.
Example 3: Check master reset functionality
The Global Controls
ŕ
Master Reset performs a master reset that zeroes most of CSM0 registers. User also can write to various registers, set DAQ active, and enable serial and diagnostic controls before applying a master reset to the system. After application of a master reset to the system, read back CSM0 registers and check if their value as expected. The master reset will turn control buttons of Set/Clear DAQ Active, Set/Clear Ext Trigger Enable and Enable/Disable Serials to RED
.
For more information on CSM0 registers and pull-down menu of CSM0 diagnostic panel, please see the references [6] and [1].
DAQ Diagnostics
DAQ Diagnostics
Taking data with the diagnostic panel requires that the attached mezzanine cards have been properly programmed using JTAG. Once the system is ready, follow these steps:
1. (Optional) Turn on/off desired TDCs using Trigger Controls
ŕ
Enable TDCs or Ctrl^E.
2.
Click on
for event read preparation. This button will reset the CSM0 and attached mezzanine cards, set important CSM0 registers and enable selected TDCs, where the default, EVID match testing at CSM0 is enabled and BCID matching test is disabled. It will set DAQ active if any TDC has been selected.
3. (Optional) Set registers. As an example, disable EVID match testing at CSM0 by using CSM0 Controls
ŕ
Disable EVID Match to get data even the EVID of TDC data received by CSM0 does not match its internal EVID (if EVID match testing is enabled, unmatched event will be discarded by CSM0).
4.
Select trigger by clicking on toggle button of Set/Clear Ext Trigger Enable, if user selects
, an external trigger will be used. The button
selects the software trigger, where user has to issue software trigger by selecting Trigger Controls
ŕ
Software Trigger in Trigger Controls pull-down menu. No more than 16 software triggers can be issued at same time (the repeat counter should be no more than 16), otherwise a data overrun error will occur.
5. Read events: Before reading events, user should decide whether to include the decipher of the hex words read from the CSM0 VME FIFO to provide a more readable form. Use the switch control Expand FIFO Print, which is Yes at default, to provide this dechpher output. Several methods are available for reading the VME FIFO, and user can choose any one to read the VME FIFO. In most cases, the block transfer is used to read VME FIFO if programmed I/O is not explicitly selected.
Trigger Controls
ŕ
Read FIFO All
ŕ
Print will read the EVID/WC register of the CSM0 and grab the indicated number of words for output to the standard output. If the EVID/WC register is empty, the CSM0 has either did no received a trigger, or is waiting for a missing header or trailer from enabled input cards.
Trigger Controls
ŕ
Read FIFO All
ŕ
No Print has same reading sequence as previous one. Only the content of EVID/WC will be printed and no VME data will be written to the standard output.
Trigger Controls
ŕ
BlkRd VME FIFO will ask user to give number of data words to be read from VME FIFO, and grab them and write them to the standard output.
Trigger Controls
ŕ
Mty VME FIFO (print) dumps the contents of the CSM0 VME FIFO to the standard output without checking the EVID/WC register. There will probably be an extra zero between events. The word is there to counteract a problem with the VME chip used by the CSM0 where the chip grabs an extra word. This zero word is discarded in data acquisition runs.
Trigger Controls
ŕ
Mty VME FIFO (no print) empties the VME FIFO without printing. Only total number of dumped data words will be printed at end.
Trigger Controls ŕ Read VME FIFO will ask the user to give number of data words to be read from VME FIFO, and will read VME FIFO word by word, i.e., block transfer is not used. The data words are written to standard output.
Trigger Controls
ŕ
Read VME FIFO will ask the user to give number of data words to be read from VME FIFO, and will read VME FIFO word by word, i.e., block transfer is not used. The data words are written to standard output.
If software trigger is used, a combined command button
for steps 4 and 5 is provided to read events where issuing software triggers is not required. Warning: Repeat counter should be no more than trigger limits, otherwise it may result in a data overrun error. If an external trigger is in use, a similar button with name
can be used to read event directly. Here the event is read by using same way as Trigger Controls
ŕ
Read FIFO All
ŕ
Print.
The most useful registers for general diagnostics of data acquisition are TDC stop bits in the FIFO Threshold, the Stop & Full Flags, the received headers and received trailers registers which are selected by the Readback Register box and read by clicking on
button. The received headers and trailers registers can also be read with Trigger Controls -> Received Hdrs and Trigger Controls -> Received Trls. These are 3 byte registers where each byte is on if the header or trailer for that CSM0 input channel has been received. When a full set of headers and trailers have been received these registers reset back to all zeroes until the next trigger.
Save all CSM0 registers
There is a useful tool for understanding any DAQ hang problem, where all the CSM0 registers are read and saved into a file. This action is performed by using Execute
ŕ
Read & Save Registers in the main CSM MiniDAQ window. The saved register log file has a file name is <***_register.log>, where *** is the data file name without “.dat” in File Name text box. It is useful for the CSM0 board and data acquisition diagnostics. Also this could be used for CSM0 board diagnostics.
Using Multiple CSMs
It is worth to point out that the command button
will let the user turn on/off the option to reset other CSMs during data taking if there are at least 2 CSM0 boards in the VME crate. This is used to demonstrate that the multiple CSM0 boards in same VME crate function normally.
5.4 Run DAQ with Software Trigger
One is permitted to take data with software trigger where the number of issued software triggers before reading data is known, thereby providing a controlled way for the user to debug data acquisition system. This method is generally used to study noise problems in the readout since the software trigger has no time relationship with respect to the data signals (= random trigger). To enable the software trigger for a run, use Global Controls
ŕ
Use Software Trigger for DAQ in CSM0 Diagnostic window. Since the trigger FIFO limit is not used to constrain the software trigger and its length is 16, the maximum allowed number of software triggers in a row without reading out the data is 16. To avoid CSM0 EVID (incremented by the trigger) mismatch errors when compared to the EVID from mezzanine cards (incremented by the AMT chips), this limit must be respected.
If the software trigger is enabled for the data taking, user will be asked to confirm it for every run in cases where the run is not started automatically since the software trigger should not be used for normal data taking. For this reason there is no easy mechanism to enable software triggers from the run control window (main CSM window), but is instead controlled through the CSM0 diagnostic window. After the software trigger is enabled from the CSM0 diagnostic window, the DAQ could be started from the main CSM window for normal data taking and should not retain the software enable.
6 Useful Information
6.1 Various Panels and Controls
CSM Register Setup Panel
The CSM register setup window (Figure 22) can be brought up by clicking on
button in the main CSM MiniDAQ window, where CSM0 register contents can be modified and will be used for data taking. Not all CSM0 register settings will be valid for data acquisition (for instance ID codes should never be changed), therefore caution is absolutely necessary in changing CSM0 register settings. If the PROM version is 0x21020 or higher, the event prescale factor could be chosen for DAQ up to 100KHz level.
Figure 22. CSM Register Setup Window
CSM0 Base:
The CSM0 base (switch settings) can be modified by the command box
in the main CSM MiniDAQ window and by the command box CSM0 Base Address of CSM0 diagnostic window, which allows the user to use different CSM0 or change CSM0 switch settings for base address.
·
Cold Start:
Execute
ŕ
CSM Board Cold Start performs a power up sequence for the CSM0 board and issues a global reset where the TDC enable mask will be kept. If the data acquisition is hung, this command could be used to reset the DAQ system and ensure the continuation of the data acqusition.
·
Set Run Number for Next Run:
This button allows setting of the run number for next run, otherwise the run number is automatically increased by one for new runs when Disk option is selected.
·
Save error summary:
Execute
ŕ
Save Data Error Report saves the error summary report to a file.
·
Save error summary:
Execute
ŕ
Data Error Report brings up the data error report window.
6.2 DAQ Parameter File
Basic DAQ parameters are written into file <DAQpara.txt> for future usage. The saved DAQ parameters are listed below:
Default Profile Saved : 0
CSM0 Base : 0x02000000
Run Number : 10000
# Used Mezz. Cards : 0
EVID Preset Value : 0
BCID Preset Value : 4018
BCID Rollover : 4095
Block Transfer in DAQ : 0
Direct VMEMap Warning: 0
Only Save Logfiles : 0
// Save CSM0 Clock (40MHz) counters 0 = Do Not Save
// 1 = Save to ASCI file
// 2 = Save to Binary file
Save Clock25 Counters : 0
// Collect data till VME FIFO full if enabled.
waitTill VMEFIFO Full : 0
// DAQ infor precision (# decimal points) is used for average event size and data flow
// rate. Allowed value is from 0 to 4, only the number is allowd to be changed.
DAQ Infor Precision : 2
Normally it is not necessary for the user to change any DAQ parameters. A few options may be useful. Only log files will be written to the disk if one turns on Normally it is not necessary for the user to change any DAQ parameters. A few options may be useful. Only log files will be written to the disk if one turns on
“Only Save Logfiles”
.
For PROMs with version numbers 0x21020 or higher, the absolute trigger time could be obtained by reading out clock 25 counter. Also,
one is allowed to change the decimal precision of average event size and data flow rate for the DAQ display window through the line of
“
DAQ Infor Precision : 2”
, where the allowed values are 0 to 4 for the number of decimal places.
6.3 Automatic Run Control File
MiniDAQ3.0.0 provides a flexible way to make automatic runs at different DAQ settings. The automatic run control file has a file extension of “.ctrl”, and the format of the control file is user friendly and easy to use. A simple automatic run control file <example.ctrl> is included in the distribution, it is recommended to refer to <example.ctrl> to make an automatic run control file.
Comments:
Any line starts with //, /* or *. Please note,
commends must be preceded by //, /* or *, otherwise undesired effect or DAQ problem may occur.
Commands:
A command contains two parts “Key Words” and “Command Parameter”, where the “Command Parameter” is separated from “Key words” by “:” or blank space. A command line looks as following:
Key Words : Command Parameter
Following automatic run control commands are available:
·
Run Number :
Run number (unsigned int)
·
Number of Event :
Number required events for the run (unsigned int)
·
DAQ Time (s) :
Required DAQ time in seconds (unsigned int)
·
TDC Enable Mask (HEX) :
TDC selection mask (Hexdecimal)
·
Trigger Limit :
CSM0 trigger limit 0 to 14
·
Event Prescaled Factor :
Event prescaled factor 1, 101, 1009 and 10007 only valid for PROM with version number 0x21020 or higher
·
Storage Selection :
Data output selection 0 and 1
0 = No Storage
1 = Auto Generated Filename
·
Data Analysis :
Data monitor enable/disable (1/0 == on/off)
·
DAQ Infor :
DAQ INFOR enable/disable (1/0 == on/off)
·
Profile :
Profile name
·