Sync Box

From MCEWiki
Revision as of 16:40, 7 November 2016 by Dvw (talk | contribs) (Front panel LEDs)
Related topics:
A 5VDC-in Sync Box with six of eight transmitters installed
A rack-mount AC-in Sync Box - Back
A rack-mount AC-in Sync Box - Front

The Sync Box generates a data-valid pulse along with a sequential 32-bit number to synchronize the data-acquisition operation of up-to 8 MCE subracks and other housekeeping equipment. The 32-bit number can be used to stamp all collected data points. The Sync Box has 8 fibre outputs to connect to the MCE subracks and few TTL/RS485 outputs to be used by other housekeeping equipment. User commands are input to the Sync Box via RS-232. The CPLD generates a serial bit stream which is Manchester encoded with a 25MHz clock, and contains information for occurrences of address_zero, data_valid, and also a frame sequence number.

Specifications

Power consumption

Excluding the fibre transmitters, the sync box consumes 1.35W. Each fibre transmitter (Avago HFBR-1119TZ) consumes 185mA x 5V = 0.925W, so a sync box with all eight tranmitters populated consumes 8.75W. To minimise power consumption, only the required number of transmitters should be populated

Input power
  • The AC-in sync box takes 47–440Hz, 85–265VAC mains power over a 3-pin HP-style power connector.
  • The 24V DC-in Sync Box takes power on an Amphenol PTC-2A-14-5P. Positive voltage is on pins B and C. Return is on pins D and E.
Small mcc power.png
  • The 5V DC-in Sync box takes power on an AMP 206486-1 with 66506-3 pins.

Approximate dimensions

9cm x 21cm x 48cm (rack-mount AC-in enclosure)
5cm x 20cm x 25cm (small DC-in enclosure)
Weight: A rack-mount AC-in Sync box unit weighs 1.9kg.

I/O connectors

The external connectors differ between the AC-in and DC-in sync boxes.

IO for rack-mount AC-in Sync Box Sync Box AC-In Rack Mount.JPG
IO for small DC-in Sync Box
Pin Translation table between Rack-mount and DC-in versions of Sync Box

Schematics

Here is a box diagram of the DC-in sync box. The AC-in sync box is similar but has different external connections.
Sync box schematic.jpg

Front panel LEDs

  • Power (green): The power LED is on whenever the sync box is powered on. Note: because the power for this LED is teed off of the power wiring harness (see schematic above), in cases where P1 has become disconnected, with external power applied, this lamp will be lit without the sync box actually being powered.
  • Free run (yellow): The free-run LED is on whenever the sync box is in free-run mode.
  • DV error (red): The DV error LED is turned on whenever more than one RTS DV pulse is received between successive address-reutrns-to-zero (ARZs); see below. It is turned off at the next ARZ. This cannot occur in free-run mode.

Documents

Firmware

See: Sync Box Firmware

The sync box program comes in two parts: a program that runs on the Atmel microcontroller, and another that runs on the CPLD. For information on how to obtain the firmware, how to reprogram your sync box, and access to the source code, see Sync Box Firmware.

RS-232 communication and commanding

Commands are sent to the Sync Box over a 9600 baud RS-232 link, with no hardware or software flow control, connected to an Atmel AT89C5131A-M, an 8-bit, 80C51-compatible single-chip microcontroller. Input command variables are checked by the command processor and loaded one byte at a tyime into the sync generator CPLD over programmed I/O connections with eith bits for data and an eight-bit address.

More than one command may be put on a single input command line, up to a maximum of 12 tokens (commands + arguments), and 80 characters.

Command summary

The sync box responds to the following commands over the RS-232 link:

Command Description Default
h Help: print a list of commands.
? Shows the current sync box parameters and status.
rl n Set row_len to n where 1 ≤ n ≤ 4094

NB: Because the sync box clock is 25MHz, this value should be half the value of the corresponding MCE row_len. For example, to have a row_len of 100 on the Clock card, set this value to 50. Also, row_len × num_rows must be ≥ 250.

  • 64 (FW version 1f and earlier)
  • 53 (FW versions 20 and 21)
  • 50 (FW version 22 and later)
nr n Set num_rows to n where 1 ≤ n ≤ 63

Note: row_len × num_rows must be ≥ 250.

  • 41 (FW version 1f and earlier)
  • 33 (FW version 20 and later)
rt Enable RTS mode (turn off free-run mode).
  • RTS mode off (all versions)
  • n=47 (FW version 1f and earlier)
  • n=120 (FW versions 20 and 21)
  • n=38 (FW version 22 and later)
fr [n] Enable free-run mode (turn off RTS mode) and set data_rate to n where 1 ≤ n ≤ 4095. If n is omitted, the previously commanded value for data_rate is re-used.
go Enable Manchester and DV outputs.
  • Outputs on
st Disable Manchester and DV outputs.
re Reset sync box to default state.
dpa Disable all power outputs.
  • All outputs on
dpu n Disable power output n where 0 ≤ n ≤ 7
epu n Enable power output n where 0 ≤ n ≤ 7
pof Get ACDCU on/off control byte
ps Get ACDCU status byte

RTS mode vs Free-run mode

The sync box operates either in free-run mode (the default) or else RTS mode. When in free-run mode, the sync box gerates it own data valid (DV) by down-counting occurrences of address-return-to-zero (ARZ), which occur at a rate of 25MHz × row_len × num_rows. The data_rate parameter to fr indicates how many ARZ occurrences occur between successive DVs. When in RTS mode, data_rate is ignored, and DVs are triggered externally over the RTS input line.

These days, almost everyone uses free-run mode.

Status output

The ? command produces output similar to this:

Synco> ?
Mancho_Enable = ON
DV_Mode = FreeRun_DV
FRUN_COUNT = 47
Row_len = 64
Num_Row = 41
ACDCU_onoff = 0X00

Command error messages

Some example error messages:

Synco> xx       WHAT? "xx"      // Unrecognised command
Synco> rl 9999  TOO BIG "9999"  // Parameter too large
Synco> rl 0     TOO SMALL "0"   // Parameter too small
Synco> rl xx    WHAT? "xx"      // Parameter could not be parsed

Using minicom in Linux

To issue commands to a Sync Box over an RS-232 line, you can use a Linux program called minicom. To install this application, do:

sudo apt-get install minicom

To start MiniCom:

sudo minicom

Minicom needs the following options changed for it to work properly:

<ctrl-a>, <z>, <a>
<ctrl-a>, <z>, <o>, <Serial port setup> <Serial Device> = /dev/ttyS0
<ctrl-a>, <z>, <o>, <Serial port setup> <Bps/Par/Bits> = 9600 8N1
<ctrl-a>, <z>, <o>, <Serial port setup> <Hardware Flow Control> = No
<ctrl-a>, <z>, <o>, <Serial port setup> <Software Flow Control> = No
<ctrl-a>, <z>, <o>, <Modem and dialing> <Modem has DCD line> = No

After you modify these settings, remember to save, exit, and restart Minicom.

Sync box I/O

The Manchester output stream

By default, the Manchester output bit-stream encodes simply the 25MHz clock as a series of (Manchester-encoded) one bits. Exceptions to this are:

  • Address-Return-to-Zero (ARZ): Occurrences of ARZ are encoded into the Manchester bit-stream as a single binary zero. ARZ occurs at a rate of 25MHz × row_len × num_rows, regardless of operating mode (free-run or RTS).
  • Data Valid sync word: This is a 40-bit sequence which is output on certain ARZ occurrences. In free-run mode, the data_rate parameter indicates the number of ARZs between successive DV sync word output. In RTS mode, it can be output on every ARZ, but only if a RTS DV pulse has arrived since the last ARZ. On ARZs where the DV sync word is not output, only the ARZ bit will be zero (all other bits will be 1).
The 40-bit DV sync word looks like this; bit zero is sent first:


 zd-fe--- Nnnnnnnn nnnnnnnn nnnnnnnn nnnnnnnn
 0        0        1        2        3
 0        8        6        4        2
where:
  • z is the address zero bit (always zero)
  • d is the data valid bit (always zero)
  • - are reserved (unused) sync-word status bits.
  • f is one if in free-run mode or zero if in RTS mode
  • e is the dv_error bit. It is one if in RTS mode and more than one RTS DV pulse was received since the last ARZ. Zero otherwise
  • Nnn... is the 32-bit frame sequence number. The most significant bit (N) is sent first.

Sync box DV outputs

  • Fibre outputs: There are up to eight fibre-optic outputs (some which may not be populated to reduce power consumption). These outputs are connected to MCE Clock Card sync in connection. The fibre-optic outputs are divided into two groups of four each, which allow the possibility for dual-rate operation.
  • DV_RTS and DV_POL: These are buffered versions of the DV sync word. They are approimately 1μs wide, active low, and is delayed to occur at the next ARZ, when the next DV sync word is output. Both outputs have a RS485 and TTL output.
  • DV_spare: There are two spare RS485-only outputs which are used for a 5MHz NRZ and clock version of the DV sync word. DV_spare1 has the 5MHz clock and DV_spare2 has the NRZ sync word. Note: the 5Mhz output contains only the DV sync word, not the single-zero-bit ARZ occurrences between DVs.
  • TTL_out: This provides a NRZ version of the DV output.

Sync box inputs

  • RS-232: This is the command I/O port. See above.
  • DV_RTS: This is a RS485 RTS DV input port. It is used in RTS mode only. Any falling edge will be taken as a RTS DV signal.
  • TTL_in: This input is unused.
  • USB-in: The on-board USB-B connector is used to reprogram the Atmel microcontroller. See Sync box firmware. This connector is not wired out to the sync box enclosure: to access it, remove the sync box cover plate.
  • Reset: Pressing the reset momentary switch restarts the sync box control program and resets all parameters to their default values.

General-purpose digital I/O

Note: in most DC-in sync boxes, the corresponding external connector (CP4) is not populated.

  • Digital input The sync box has eight general-purpose optocoupled digital inputs, originally used to monitor the ACDCUs powering the attached MCEs. The ps command will read these lines and report them as a hex-encoded byte:
Synco> ps
       ACDCU_Status = 0X7B
  • Digital output The sync box has eight general-purpose open-collector digital outputs, originally used to switch the ACDCUs powering the attached MCEs. The dpu, dpa, epa, and pof commands can be used to control these outputs.

Enabling sync box use in the MCE

To check that the sync box is connected correctly to the MCE, issue the command

wb cc select_clk 1

and then read back the value:

rb cc select_clk
Line   0 : ok : 1

Setting select_clk to 1 tells the MCE to sync its internal clock with the clock signal encoded from the sync box. If the MCE does not see the sync box, the parameter will revert to zero (internal clock) in about one second.

To accept sync triggers and serial numbers from the sync box, two more commands are needed:

wb cc use_sync 2
wb cc use_dv 2

These registers are configured automatically by the config system if the parameters hardware_sync=1 and config_sync=1 in experiment.cfg. If you change the values in $MAS_DATA/experiment.cfg instead of $MAS_CONFIG/experiment.cfg, remember to run mce_make_config before re-running the config script.

Also be sure that you have the correct mce.cfg file. A quick way to check that sync numbers are getting into the MCE frame data is to take some frames and check the data using the eat_packets tool:

$ mce_status -s | grep fw_rev

mce@mce-act-b1$  mce_run sync_test 400 s
RUNFILE_NAME=/data/cryo/current_data//sync_test.run
FRAME_BASENAME=/data/cryo/current_data//sync_test

$ eat_packets -n 5424 -f $MAS_DATA/mce_run10
Forced     frame_size=1356 (5424)
offset     frm_idx   frame#
0000000000        0        0  surprise sync_dv 4168076, after sequence [0,0)
EOF, exiting after 10000 frames + 0 bytes

If the mce_run does not terminate quickly, the sync box may not be properly connected to the MCE. If eat_packets complains only about the first frame (offset 00000000), then the sync numbers are intact and incrementing contiguously. If eat_packets complains about pretty much every frame, the sync numbers are not being inserted into the frame data.

Legacy documents

  • The original "Sync Box User's Guide" is available here:
http://www.phas.ubc.ca/~mce/mcedocs/hardware/tech_description/SyncBox_UserGuide_S589_502.pdf
Please note: it is rather out of date (being last updated in 2007), and known to be wrong in places. All relevant information from the guide should be available on this wiki.