![]() |
VMEDAQ User Documentation |
IUCF VME Data Acquisition System User Information
N. R. Yoder (Modified for KSU by Kevin Carnes)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A shorter VMEDAQ Primer is
available, and this document is available in Postscript or Microsoft Word 95 formats. Also available is an introductory PowerPoint seminar and several notes and reference items | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Since 1984, Indiana University Cyclotron Facility has used data-acquisition systems based on Unibus or Qbus VAX computers connected to Micro-programmable Branch Drivers (MBD) manufactured by BiRa Corporation. Newer, high-performance VAX workstations do not have the traditional Unibus or Qbus required by the MBD. Also, the MBD does not lend itself to easy programming by experimenters. There were several goals for replacement of the MBD; it should permit more flexible programming, be faster, allow greater distance between the CAMAC system and host analysis computer, and eliminate dependence on the host computer's bus hardware or general architecture and operating system. The VME-based data acquisition system described here provides a straightforward transition from the MBD systems, and continues to use the XSYS analysis software on the host computer, but is not limited to any particular host computer, operating system, or analysis software. The major components of the VME-based data-acquisition system are: (1) CAMAC subsystem; (2) VME frontend; (3) backend host computer. The basic VME frontend consists of a VME crate with one Motorola MVME167 68040 cpu module and one CES CBD-8210 CAMAC branch driver module. A second cpu module may be added for dedicated readout processing, and up to eight branch drivers may coexist on the VME bus, with each branch having up to seven CAMAC crates. VME data-acquisition modules may be used with no special interface; other subsystems such as FASTBUS or VICbus data modules may be used in addition to or instead of CAMAC if the appropriate driver modules are included in the VME crate. The MVME167 has serial, parallel, ethernet, and SCSI interfaces. One serial port is used for setting ethernet parameters and occasional debugging; all other communication with the host computer is by ethernet. Event data may be recorded on a 4- or 8-mm tape drive attached to the local SCSI interface, or on a tape or disk drive attached to the backend host computer. The backend host computer may be a VAXstation with XSYS software, or a UNIX system with software capable of processing event buffers from the VME frontend. An example of a VME data-acquisition system is illustrated in Figure 1. A basic VME system consists of only one cpu and one CAMAC branch driver, and an ethernet connection. The backend host is responsible for taping.
A real-time kernel, pSOS+, manufactured by Integrated Systems, Inc., is the foundation for the data-acquisition application program in the 68040 microprocessor(s). The components utilized for this application are: The kernel provides multi-tasking and inter-task communication services. A separate program in the host computer, XRAY+, works with pROBE+ for interactive debugging through the network. (Not available at KSU.) Any host computer with a TCP/IP socket library may be used to communicate through pNA+ to the application. The data-acquisition application is organized for master and slave cpus, each with a set of tasks. The master cpu is responsible for run control, data buffer formatting and routing, and network communication. The slave cpu reads data modules (CAMAC) and builds event records. Master cpu:
Slave cpu:
In a single-cpu system, the master and slave ROOT processes are combined into one process. ROOT suspends itself after completing its function. Scheduling priorities of the data-handling processes are set so that EVTS is lowest, followed by BFMT and then BROU/BSnn/BTAP; LISN and RCnn have higher priority than data-handling processes. Continuous beam and pulsed beam operations dictate different approaches for optimal throughput. The design permits the processes to fully overlap, but for pulsed beam it is better to let the event-data queue fill during beam on while suspending the formatting and sending processes until the beam is off. For example, a 1 MB event queue will accommodate a 1 second burst at the maximum branch highway rate of 900 kB/s, or a longer burst at a slower data rate. User-settable parameters control queue thresholds. Run control is implemented by one or more processes which provide interfaces between the frontend VME computer and a backend host for purposes of setting and displaying data-acquisition parameters and initiating actions which affect the run state and CAMAC devices. A VME run-control process RCnn is created by the LISN process whenever a request string beginning with "RC" is received after a TCP/IP connection is accepted. Several RCnn processes may be active at one time, up to a fixed limit, presently 6.
vrctl executes on a VMS or UNIX host to provide bi-directional half-duplex communication between a terminal attached to the host and a VME run-control process. The default internet address ipaddr is obtained from the environment variable FRONTEND, if defined; the default port is 6800. The default request string reqstr is "RCTL EOT", which causes an <EOT> character (^D) to be appended to the final output line of each VME command. The <EOT> switches direction of communication and is not printed. If a command option is supplied, the command string is sent to the run-control process and input is not read from stdin; otherwise a prompt "rctl>" is supplied by vrctl; and input is read from stdin. The program is terminated when an exit or quit command is entered, or if the connection is broken, as by the shutdown command. A ^Z from a VMS host also terminates the program. $ FRONTEND=="129.79.151.161" ! VMS
Standard telnet may be used to connect to a run-control process; port must be 6800 and the request string "RC" must be entered within 5 seconds after a connection is established. The <EOT> option is not used because telnet provides a full duplex connection. The RCnn process issues the rctl> prompt. $ telnet 129.79.153.164 6800 A user-written function may issue run-control commands from a backend host by using a TCP/IP socket library to open a connection to the VME IP address at port number 6800. If the user function intends to operate in half-duplex mode, it should immediately send "RCTL EOT", and terminate each command line with a new-line character. Output lines will be separated by new-line characters and an <EOT> character following all output for each command. For full duplex mode, the function should send an initial "RC". The frontend is always in one of the following run states:
In addition to the run-state variable, there is a run-active flag variable which is true only in the On and Test states. Event data are read only when the run-active flag is on. Run status may be displayed by the show status command. A run-control process accepts commands one line at a time. The command interpreter is sensitive to case, so enter commands as shown. Abbreviations are permitted for most keywords. Some commands may produce multiple output lines. The output for a single command is limited to the size of a fixed output buffer. For example, it is not possible to print the entire list of integer parameters with a single command. Commands which affect the event-readout process are synchronized with the event-control ECTL and event-readout EVTS processes so that the command is always executed between processing events. Synchronized commands include bcnaf, begin, cnaf, halt, init, init branch, init config, resume, show branch, suspend. Some commands cannot be accepted when a run is active. This command should not normally be used. It may be used to abort a test-mode run and return the run-state to off. When used with a normal run, it will clear the internal run active flag. Use of this command is not reccommended except in test modes. Execute a CAMAC command on the specified branch b, crate c, slot n, subaddress a, function f, with data d. Numerical values may be specified in hexadecimal using a prefix of 0x, or octal using a prefix of 0. Response includes X, Q, and data for read commands. A nonexistent branch or off-line crate will cause an error message. Synchronized with event readout. Rapid execution of bcnaf concurrently with event-data readout is not recommended, and may lead to bus errors. rctl>bcnaf 0 5 21 15 1 Begin a run. If no run number n is supplied, the previous number is incremented by one. Begin will fail if the run state is not off and if there are no buffer-send BSnn processes. The option fill allows begin to fill the memory queues when there are no buffer-send processes or when there is already data in the queues. Begin performs a series of checks including verifying required on-line crates and trigger module configuration (default is BiRa 2206); the optional user-supplied begin code is executed. If successful, the run state is changed from off to on; otherwise it is set to disabled. See initialize. rctl>begin 21 Clear VME run counters and scalers. This is automatically done by begin. Execute a CAMAC command on branch 0. See bcnaf. Dump VME memory in longword, word, or byte format, beginning at address a through n bytes. Longword is the default. The default radix is hexadecimal, and the default number of bytes depends on the format. An error message is printed if the address range is invalid. See also patch and probe. rctl>dump w 180000 Exit from the run-control process and close the connection. This has no effect on the run state or other connections. Halt a run in progress. The run state is changed from on or held to off. Optional user code is executed and a scaler read is signalled. The default scaler read generates an event record with id number 50. rctl>halt A brief list of commands is printed. A question-mark (?) is an alias for help, and any command verb followed by a space and question mark prints additional syntax information. rctl>help Initialize with no options initializes all branches and crates, verifies required on-line crates and executes optional user init code; if successful the run state is changed from disabled or off to off; if unsuccessful, the run state is set to disabled. Initialize branch issues a BZ to all branches or to branch b. Initialize config restores configuration parameters by re-executing user configuration code. Initialize queue clears data from the buffer queue if there are no buffer-send connections. The run state must be disabled or off before any initialize is accepted. Patch the longword, word, or byte at address a with the value v. Longword is the default. Patch must be used with caution as incorrect use may corrupt or crash pSOS+ and the data-acquisition program. See dump and probe. Probe, i.e. read, the longword, word, or byte at address a. Longword is the default. Note that reading a non-memory device register may alter the state of that device. An error message is printed if the address is invalid. See dump and patch. Terminate the run-control process; equivalent to exit. Restart pSOS+ and all processes. Restart cold triggers a download. Resume a run after suspend. The run state is changed from held to on. Required on-line crates and trigger configuration are verified as for begin, and optional user resume code is executed. Set the battery-backed clock from the pSOS+ operating clock. The battery-backed clock maintains time when pSOS+ is not running and when VME power is off. The battery-backed clock may be switched off to save battery power before the cpu module is removed from service for an extended period. Set the required on-line crate numbers c... for the specified branch b. This overrides configuration data in the user configuration code. If only the branch number is specified, then no crates are required to be online for that branch. rctl>set branch 0 1 2 Set the buffer size in bytes for the buffer formatting process. This determines the maximum buffer size sent to the backend host. The default is 32256 bytes; buffers should be from 1024 to 65012 bytes. Set the pSOS+ operating clock from the battery-backed clock. Set the operating clock date and time. Time-of-day is not changed if unspecified. Set the operating clock date and time. This command uses VMS date format. Only the date is set if the time field is omitted. Set the event queue accumulation threshhold to n bytes or n k-bytes; in fill mode, the event queue is allowed to fill until the threshhold is reached before the buffer formatting task is signalled. Set the maximum event size to n bytes; the maximum event size must not be exceeded by the user readout code. The size parameter is usually supplied by user configuration code or by system default. Set float parameter array element n to value v. User readout code has access to the float parameter array. The show configuration command prints the size of the float parameter array. All parameters are zero after program load or restart; user configuration code may preset values. Float parameters may be changed when a run is active. rctl>set float 1 59.75 Set integer parameter array element n to value v. User readout code has access to the integer parameter array. The show configuration command prints the size of the integer parameter array. All parameters are zero after program load or restart; user configuration code may preset values. Integer parameters may be changed when a run is active.
rctl>set int 3 450 Set the run number to n. Begin will increment this number. Set acquisition mode. Normal is the default; acqisr means that the event-data is to be read from within the interrupt service routine (ISR), which may be slightly faster in a one-cpu system. The test modes circumvent normal run control so that the data is actually read by the BSnn task. The mode options control the type of data; buffers are filled and sent with artificial data for test buffer; event records are filled by executing camac reads of the trigger-module id for test camac; the user-supplied readout is executed for test user. The auto option may be used with test user for auto (software) triggering; the debug option causes debugging output on the console serial port for test buffer. Set or clear VME bus error handling. A bus error is commonly caused when an offline crate is accessed by user code. Certain other operations on the CBD-8210 occassionally cause bus errors. When bus error handling is disabled, a bus error causes the application to terminate and control is returned to the pROBE debugger. Bus error handling is always on for version 0.4 or later. Enter an internet gateway address gw for network address nw in the routing table. Addresses must be in the form aaa.bbb.ccc.ddd. A minus causes the gateway to be deleted from the routing table. This information is not usually required except in cases where a gateway is part of the route. rctl>set route 0.0.0.0 132.166.51.254 Set the interval timer for automatic scaler reads to s.xx seconds. Optional user scaler code performs the CAMAC reads. The minimum allowed scaler interval is 0.10 s. This command is equivalent to set timer 0 s.xx. rctl>set scaler timer 10 Set parameters for testing buffer send. Set the operating clock date and time. Date is not changed if unspecified. rcl>set time 1993.09.01 19:30:00 Set the operating clock date and time. This command uses VMS time format. To set the VME clock from a VMS host clock: $ vrctl -c "set time ''f$time()'" Set interval timer n for repeating at s.xx second intervals. Optional user code may be executed for each timer signal. The granularity is 0.01 second. Timer 0 is used for scaler read events; timer 1 generates a data event record; timers 2 and 3 execute user code without producing event records. rctl>set timer 1 15 Set run title to the text string which follows the command. Quote marks are not necessary and if present will be retained; case is preserved. The title may be up to 80 characters in length. The default title is the system version string. The title is included in the run-control data buffers sent to the host. rctl>set title E777 Detector test Set the trigger configuration. This information overrides parameters in user configuration code. The mask parameter is a longword with bits corresponding to enabled channels in a BiRa 2206 trigger module. Bits in the mask may also be set and cleared(-) using one or more chan parameters. rctl>set trigger br 0 cr 5 sl 21 ch 4 ch 6 ch 10 Show the time from the battery-backed clock. rctl>show BBclock Show branches and on-line crates by probing branch hardware. All attached branches are shown unless branch b is specified. rctl>show branch Show CES CBD-8210 CAMAC branch driver registers. Only one register is printed if f is specified. This information is for diagnostic purposes. rctl>show CBD 0 4 Show configuration parameters. User configuration code provides these data, which may be superceded by set commands. rctl>show configuration Show TCP/IP connections and corresponding server process names. Disconnected connections are also printed if the command includes an asterisk. rctl>show connection Show operating date and time. Show event counters by event-id number for the specified index range. All non-zero event counters are printed if no range is specified. The final event counter array is sent after a halt event. Show error log of CBD-8210 induced VME bus errors.
Show the status of buffer and event memory queues. A summary line for each packet in the buffer queue is also printed if the asterisk is present. rctl>show fifos Show float parameters for the specified index range. With no index range specified, all non-zero values are printed. The final float array is included in the buffer containing a halt event. rctl>show float 1 Show integer parameters for the specified index range. With no index range specified, all non-zero values are printed. The final integer array is included in the buffer containing a halt event. rctl>show int 3 Show scaler accumulations for the specified index range. All non-zero scalers are printed if no range is specified. The buffer formatting process accumulates scalar totals as it copies scaler event data to buffers. The final scaler accumulation array is included in the buffer containing a halt event. Show the current data-event signal longword. Signal bits correspond to LAM and timer signals as well as internal synchronization signals. Bit assignments are defined by the union event_signal in daqdef.h rctl>show signals Show run status. rctl>show status Show operating time. VME boot times are also shown for the plural command. rctl>show time Show run title string. See set title. rctl>show title Show program version. Both the system version and the user version are shown, with compilation dates and times. rctl>show versions Set or clear one or more signals. Used for program testing and diagnosis. The CBD option affects the CBD-8210 interrupt status register. Shutdown pSOS+ and all processes. Use this command to return control to pROBE+ before reloading software. This is not synchronized with events and will interrupt a run in progress and break all network connections. Application code is not erased from memory and may be restarted using a remote debugger program. Suspend a run. The run state is changed from on to held. Optional user suspend code is executed and a scaler read is signalled. See resume and halt.
A cross compiler executes on a UNIX computer to generate 68040 machine code from ANSI C source files. The compiler output must be processed by the assembler. A cross assembler executes on the UNIX computer to translate 68040 assembly source code to binary object files. Assembly source files use Motorola 680x0 syntax. A linker executes on the UNIX computer to combine binary object files to produce a single loadable object file. Usually the load file is in Motorola hexadecimal format. A make utility controls compiling, assembling, and linking as necessary. A standard make file is provided for building user code but may be modified if for instance, the user has additional code modules to be compiled and linked. See the system administrator for more details. The userevts.c file contains the following include files. Files beginning with "user" contain user supplied code to perform a specified function. Normally the userevts.c file itself is not modified, but only the user include files. However, if userevts.c or any of its include files are found in the user code directory, they will be processed by the make utility in place of the standard files. The following include files should never be modified: #include "daqlib.h" The following include files contain user-specified code for run control and data acquisition. If any of these files is not found in the user code directory, a standard dummy file will be provided by the make procedure. # include "userconfig.h" Contains information on which CAMAC crate slots will generate LAMS, how often to read scalers, etc. Always required. Executed as part of initialize. CAMAC branches and crates are initialized before this user code executes. Configuration parameters should not be changed in initialize code. Executed as part of a begin run. The trigger module is initialized before user code executes, if a BiRa 2206 is used. Executed as part of a halt run. Executed as part of a resume run Executed as part of a suspend run. Executed when an event LAM occurs. If a BiRa 2206 trigger module is used, the code in userevts.c reads the trigger data and stores a number in trigchan. The user code uses a switch statement to select the event type. Executed when a scaler timer signal occurs and when halt or suspend is done. An event record is generated with longword byte-swapping and scaler-buffer attributes. Executed when slave software timer 1 signal occurs. Timer signals are repetitive. An event record is generated. Executed when slave software timer 2 signal occurs. Timer signals are repetitive. No event record is generated. Executed when slave software timer 3 signal occurs. Timer signals are repitative. No event record is generated. Executed when external trigger IT2 on the CBD-8210 receives a pulse. An event record is generated.
/***********************************************************************/ /* This file is included in the standard user configuration function. */ /* It is executed once after the frontend processor is started, and */ /* whenever an "init config" command is issued. */ /* This code is executed before any crates are initialized. */ /* The purpose is to specify which crates are required and the */ /* location of the trigger module. */ /* No camac operations should be performed here. */ /* Configuration may be aborted by executing "return -1;" */ /* Initialization will be done after successful configuration. */ /***********************************************************************/ /* Static user parameters */ /* User configuration code (userconfig.h) should set these as follows: */ /* udb.usrverstr_p = "version";* user program version string */ /* udb.usrtitstr_p = "title"; * user initial run title string */ /* udb.maxevtsiz = size; * if event size is > default(bytes) */ /* udb.btbmasks[b] |= (1<<c); * for each required online crate */ /* udb.lamcrmask |= (1<<c); * c is LAM trigger crate (always 1)*/ /* udb.lamslmask |= (1<<m); * m is LAM trigger slot# -1 */ /* udb.trigbranch = b; * specify branch for lam trigger */ /* udb.trigcrate = c; * specify crate for lam trigger */ /* udb.trigslot = n; * specify slot for trigger module */ /* udb.triglamn = n; * specify slot for trigger lam */ /* udb.trigmask |= (1<<m); * for each BiRa trig channel */ /* udb.st0tik = n; * ticks for scaler timer (10msec units)*/ /* udb.st1tik = n; * ticks for slave timer 1 */ /* udb.st2tik = n; * ticks for slave timer 2 */ /* For BiRa2206, set trigbranch, trigcrate, trigslot, trigmask. */ /* If LAM is jumpered to different slot, set triglamn = LAM slot. */ /* For other trigger module, set trigmask=0; such trigger module must */ /* return Q=? for A(0)F(8), and clear lam for A(0)F(10). */ /* For no trigger module, set trigslot=trigmask=0 */ /* Only one BiRa2206 is supported by built-in code; for multiple LAM */ /* sources, follow the directions for general LAMs below. */ /* A BiRa2206 and other LAMs may be simultaneously configured. */ /* */ /* For general LAM triggers from modules in multiple slots and crates, */ /* set lamcrmask and lamslmask to indicate which crates and slots may */ /* produce LAM interrupts. This is the standard KSU configuration. */ /* If lamcrmask=0 and a BiRa2206 is not configured, then the default */ /* crate mask is btbmasks and branch demand will be enabled for */ /* those crates specified by btbmasks[trigbranch]. */ /* All LAM triggers must be confined to a single branch. */ /***********************************************************************/ /* Set parameters for example user configuration */ udb.usrverstr_p = "<Version 1>"; udb.usrtitstr_p = "<2D PSD Phillips ADC>"; udb.maxevtsiz = 0; /* uses default if 0 */ udb.btbmasks[0] = (1<<1); udb.lamcrmask = (1<<1); udb.lamslmask = (1<<19) | (1<<20); /*allows for two different LAMs, */ /*here in slots 20 & 21 (slot#-1) */ udb.trigbranch = 0; /* udb.trig* parameters only for BiRa2206 useage */ udb.trigcrate = 0; udb.trigslot = 0; udb.triglamn = 0; udb.trigmask = 0; udb.st0tik = 500; /* in 10msec ticks, e.g. 500 = 5 sec*/ /* This is the time interval for */ /* automatic scaler reads */ udb.st1tik = 0; udb.st2tik = 0; udb.st3tik = 0; /* */ /***********************************************************************/ /* Get event data record. */ /* Reads data from CAMAC and fills event record with id and data. */ /* event id is preset to trigchan if using BiRa2206. */ /* BiRa2206 is handled outside of this code. */ /* Without BiRa2206, event id must be set manually. */ /***********************************************************************/ int eventid; if(tlamregs & (1<<19)) /* Check to see if LAM is from slot 20 */ { eventid = 3; /* Set event number for EVENT in *.evl */ READW(0, 1, 20, 4, 0); /* Read 7164 */ READW(0, 1, 20, 5, 0); /* Read 7164 */ READW(0, 1, 20, 6, 0); /* Read 7164 */ READW(0, 1, 20, 7, 0); /* Read 7164 */ CNAFX(1, 20, 3, 11); /* Clear data and hit register on 7164 */ } else if (tlamregs & (1<<20)) /* Check to see if LAM is from slot 21 */ { CNAFX (1,21, 0, 10); /* Clear Down Counter */ eventid = 4; /* Set event number for EVENT in *.evl */ HALTRUN; /* Halt the run. */ } ev_p->hdr.evtid += eventid; /* Actually set EVENT number. */ /*****************************************************************/ /* User initialization of modules at beginning of run. */ /* This is called before data flow is enabled. */ /* A BiRa2206 is automatically initialized before this code. */ /* To abort begin run, execute "return -1;" here. */ /*****************************************************************/ CNAFX (1, 10, 0, 9); /* clear counter channel */ CNAFX (1, 10, 1, 9); /* clear counter channel */ CNAFX (1, 10, 2, 9); /* clear counter channel */ CNAFX (1, 10, 3, 9); /* clear counter channel */ CNAFX (1, 20, 3, 11); /* clear Phillips 7164 ADC */ CNAFX (1, 20, 0, 26); /* set enable LAM for 7164 ADC*/ CNAFX (1, 21, 0, 26); /* set enable LAM for Bi-Ra 2204 DPR Counter*/ CNAFX (1, 30, 9, 24); /* disable dataway inhibit */
In the following commands:
b=branch address (always 0 at KSU)
|
A shorter VMEDAQ Primer is
available, and this document is available in Postscript or Microsoft Word 95 formats. Also available is an introductory PowerPoint seminar and several notes and reference items |
Last updated on Friday, 17-Feb-2006. |