Contents:

BiasMap.txt      Prototype mapping between bias distribution modules and wedges
LVMap.txt        Prototype mapping between LV	distribution modules and wedges
Note: These maps are for testing purposes only and do not yet correspond to the actual wiring

FVTXBiasE11.tcl  tcl/tk bias module controller gui
FVTXLVE16.tcl    tcl/tk LV module controller gui

FTP_LV           directory containing the LV ethernet controller software
 Notes on LV and Bias distribution systems:

There are two VME crates of LV distribution, one for FVTX north and one for south. There is one crate of Bias 
distribution. Each crate has an ethernet controller and 10 distribution cards. The ethernet interfaces each 
must have a unique IP address. In addition, all cards have a DIP switch that sets there local address, which 
must be unique within that crate. See DIPswitches.pdf for instructions on setting these switches. See 
FVTX_LV_9.ppt for a presentation of the various components that make up the distribution systems. 

Software is written in tcl for the C callable routines and tcl/tk for the GUIs. The ethernet controller software 
is written in C++ and makes extensive use of the Netburner runtime libraries. The GUIs have an expert mode that
allows complete control of each distribution channel, and a non-expert mode that only allows turning the global
power on or off and downloading all of the switches with their normal settings. The C callable versions have no 
graphics and use a single command line argument as follows:
"0"  Turns Global power off
"1"  Turns Global power on
"2"  Downloads switches
no argument returns the Global power status.

Communication with the crates is done via FTP uploads and downloads. All uploads are error checked for the 
correct number of bytes transferred, correct data formatting and an acknowledge from each addressed module. 
The upload files consist of a series of text lines in the form:
  address data
  address data
  .
  .
  .
  address data
where the address and data are 8 bit unsigned integers. For example, the command sequence required to turn 
on the global bias enable has the following operations:
  first set the controller address with AEN off
  then set AEN and OE, and request response from controller
  cycle AEN off, clocking controller Output Enable F/F
  set OE off
  clear the address
for a total of 5 lines and 45 bytes, each line containing two integers and text formatting.

The 8 bit integers are used to drive the corresponding lines on the VME backplane. Bit assignments for 
busses are:
  address bus: add0-4 (1-30), for module addressing
  data bus dat0-4 (0-31), for switch data
Control bits and polarities are:
  OE (output enable) add7 active low, controls global power
  AEN (address enable) add6 active low, for module addressing
  LE  (latch enable) dat6 active falling edge, latches switch settings
  SCK (shift clock) dat5 active falling edge, shifts switch data into 
    switch registers
  RESP (response request) add5 active high, for checking module response
  ACK (response received) dat7 active low, module acknowledge

So, the upload files are basically the bit patterns necessary to address and communicate with all of the cards 
in the crate. The download file returns the global power status and number of bytes transferred, unless an error 
has occurred. In that case, the type of error is returned.

The two map files contain the correspondence between each wedge and distribution channel / module. These are 
currently in text form, but will eventually migrate to the counting house database. These files also contain
the ethernet and controller addresses for each crate. The GUIs and callable software have an internal array 
that converts channel number to the switch bit number.

To program the ethernet interface (Netburner Mod5270), a windows machine is required with the Netburner Eclipse
development environment installed. This computer must be on the same local area subnet as the interface. The 
interface can be reprogrammed over the network from Eclipse. Its IP setup can also be changed over the network.

Linux / Windows differences - The GUI color patterns are good in Linux, but hard to read in Windows. The software
detects which OS is running and takes care of file formatting differences automatically.

Each module type has diagnostic LEDs on the front panel. See below for details. Front panels will eventually
be added with labels for LEDs. Only +5 V is used from the VME crates, less than 1A per module. 

		Controller		LV distribution		Bias distribution

 Top Left	O D1*	O +5V		O EN	O SCK		O EN	O SCK
 		O D2*	O D0*		O +Ain	O LATCH		O +5V	O LATCH
 		O SCK	O D3*		O +Bin	O +Ein
 		O LE	O D4*		O +Cin	O +Din
 		O A4*	O OE
 		O A3*	O AEN
 		O A0*	O A2*
 Lower Left	O +5V	O A1*     

where * = complement,  D = data, A = address, +in = wedge LV input

Power on behavior - The crate controllers are designed to have the Global power OFF at startup. Likewise, the
software will not turn the Global power on at startup. The state of the switches is not guaranteed at startup,
but they have been observed to normally be OFF. They should always be programmed before turning the Global 
power ON.