Difference between revisions of "Sync Box"

From MCEWiki
Line 1: Line 1:
 
{{Related|Sync Box}}
 
{{Related|Sync Box}}
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.
 
 
[[Image:Sync_Box_DC-In_Chassis.JPG|thumb| A DC-in Sync Box with six of eight transmitters installed]]  
 
[[Image:Sync_Box_DC-In_Chassis.JPG|thumb| A DC-in Sync Box with six of eight transmitters installed]]  
[[Image:Sync_Box_AC-In_Rack_Mount.JPG|thumb|A rack-mount AC-in Sync Box - Back]]
+
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 <tt>address_zero</tt>, <tt>data_valid</tt>, and also a frame sequence number.
[[Image:Sync_Box_AC-In_Rack_Mount_Front.JPG|thumb|A rack-mount AC-in Sync Box - Front]]
+
 
== Specification ==
+
== Specifications ==
;Power consumption
+
=== Power consumption ===
:A Sync box equipped with all 8 Fibre transmitters consumes '''8.75W'''.  
+
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
:Each Fibre transmitter (HFBR1119) consumes 185mA x 5V = 0.925W. To lower consumption, the unused transmitters can be removed.
+
 
 +
;Input power:
 +
* The AC-in sync box takes 47&ndash;440Hz, 85&ndash;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.
 +
:[[File:small_mcc_power.png]]
 +
* The 5V DC-in Sync box takes power on an AMP 206486-1 with 66506-3 pins.
  
;Dimensions (approximate)
+
=== Approximate dimensions ===
  
 
: 9cm x 21cm x 48cm (rack-mount AC-in enclosure)
 
: 9cm x 21cm x 48cm (rack-mount AC-in enclosure)
 
: 5cm x 20cm x 25cm (small DC-in enclosure)
 
: 5cm x 20cm x 25cm (small DC-in enclosure)
;Weight
+
: Weight: A rack-mount AC-in Sync box unit weighs 1.9kg.
: A rack-mount AC-in Sync box unit weighs 1.9kg.
+
 
;Inputs/Outputs
+
=== I/O connectors ===
 +
The external connectors differ between the AC-in and DC-in sync boxes.
 
: [[Sync_Box_AC-in_Rack_Mount_io |IO for rack-mount AC-in Sync Box]] [[Image:Sync_Box_AC-In_Rack_Mount.JPG|20px]]  
 
: [[Sync_Box_AC-in_Rack_Mount_io |IO for rack-mount AC-in Sync Box]] [[Image:Sync_Box_AC-In_Rack_Mount.JPG|20px]]  
 
: [[Sync_Box_DC-in io| IO for small DC-in Sync Box]]  
 
: [[Sync_Box_DC-in io| IO for small DC-in Sync Box]]  
 
: [[Pin Translation table between Rack-mount and DC-in versions of Sync Box]]
 
: [[Pin Translation table between Rack-mount and DC-in versions of Sync Box]]
; Power connector
 
: for 24V DC-in Sync Box: Amphenol PT02A14-5P
 
: for 5V DC-in Sync Box: Amp 206486-1 with 66506-3 pins
 
== User's Guide ==
 
The functional description of Sync Box is available [http://www.phas.ubc.ca/~mce/mcedocs/hardware/tech_description/SyncBox_UserGuide_S589_502.pdf here].
 
  
''Note that the user's guide describes the original Rack-mount AC-in enclosure and the document is not yet up to date for the DC-in enclosure.''
+
== Schematics ==
 +
Here is a box diagram of the DC-in sync box.  The AC-in sync box is similar but has [[Pin Translation table between Rack-mount and DC-in versions of Sync Box|different external connections]].
 +
[[File:Sync box schematic.jpg]]
  
 +
=== Front panel LEDs ===
 +
* '''Power (green)''': The power LED is on whenever the sync box is powered on.
 +
* '''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 on RTS DV pulse is received between successive address-reutrns-to-zero (ARZs); see [[#The Manchester output stream|below. It is turned off at the next ARZ.  This cannot occur in free-run mode.
  
 
+
=== Documents ===
== Schematics ==
+
[[Image:Sync_Box_AC-In_Rack_Mount.JPG|thumb|A rack-mount AC-in Sync Box - Back]]
 +
[[Image:Sync_Box_AC-In_Rack_Mount_Front.JPG|thumb|A rack-mount AC-in Sync Box - Front]]
 
* [http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/SyncBox/SC2-ELE-S589-101_RevA2_SyncGen_Schematics.pdf Sync Board Schematics (S589-101)]
 
* [http://www.phas.ubc.ca/%7Emce/mcedocs/hardware/schematics/SyncBox/SC2-ELE-S589-101_RevA2_SyncGen_Schematics.pdf Sync Board Schematics (S589-101)]
 
* Block Diagram:  
 
* Block Diagram:  
Line 47: Line 54:
 
  > h
 
  > h
  
= Setting up the MCE to use the Sync Box =
+
== 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:
 +
{| class="wikitable"
 +
|-
 +
! Command
 +
! Description
 +
! Default
 +
|-
 +
! <tt>h</tt>
 +
| Help: print a list of commands.
 +
| rowspan="2" | &mdash;== Front panel LEDs ==
 +
* '''Power (green)''': The power LED is on whenever the sync box is powered on.
 +
* '''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 on RTS DV pulse is received between successive ARZs.  It is turned off at the next ARZ.  (This cannot occur in free-run mode.)
 +
 
 +
|-
 +
! <tt>?</tt>
 +
| Shows the [[#Status output|current sync box parameters and status]].
 +
|-
 +
! <tt>rl</tt> ''n''
 +
| Set <tt>row_len</tt> to ''n'' where 1 &le; ''n'' &le; 4094<br/>
 +
'''''NB:'''''  Because the sync box clock is 25MHz, this value should be ''half'' the value of the corresponding MCE {{param|cc|row_len}}. For example, to have a {{param|cc|row_len}} of 100 on the [[Clock card]], set this value to 50.  Also, <tt>row_len</tt> &times; <tt>num_rows</tt> must be &ge; 250.
 +
 
 +
|
 +
* 64 ([[Sync Box Firmware|FW]] version 1f and earlier)
 +
* 53 (FW versions 20 and 21)
 +
* 50 (FW version 22 and later)
 +
|-
 +
! <tt>nr</tt> ''n''
 +
| Set {{param|cc|num_rows}} to ''n'' where 1 &le; ''n'' &le; 63<br/>
 +
Note: <tt>row_len</tt> &times; <tt>num_rows</tt> must be &ge; 250.
 +
|
 +
* 41 ([[Sync Box Firmware|FW]] version 1f and earlier)
 +
* 33 (FW version 20 and later)
 +
|-
 +
! <tt>rt</tt>
 +
| Enable RTS mode (turn off free-run mode).
 +
| rowspan="2" |
 +
* RTS mode off (all versions)
 +
* ''n''=47 ([[Sync Box Firmware|FW]] version 1f and earlier)
 +
* ''n''=120 (FW versions 20 and 21)
 +
* ''n''=38 (FW version 22 and later)
 +
|-
 +
! <tt>fr</tt> [''n'']
 +
| Enable free-run mode (turn off RTS mode) and set {{param|cc|data_rate}} to ''n'' where 1 &le; ''n'' &le; 4095.  If ''n'' is omitted, the previously commanded value for <tt>data_rate</tt> is re-used.
 +
|-
 +
! <tt>go</tt>
 +
| Enable Manchester and DV outputs.
 +
| rowspan="2" |
 +
* Outputs on
 +
|-
 +
! <tt>st</tt>
 +
| Disable Manchester and DV outputs.
 +
|-
 +
! <tt>re</tt>
 +
| Reset sync box to default state.
 +
| &mdash;
 +
|-
 +
! <tt>dpa</tt>
 +
| Disable all power outputs.
 +
| rowspan="3" |
 +
* All outputs on
 +
|-
 +
! <tt>dpu</tt> ''n''
 +
| Disable power output ''n'' where 0 &le; ''n'' &le; 7
 +
|-
 +
! <tt>epu</tt> ''n''
 +
| Enable power output ''n'' where 0 &le; ''n'' &le; 7
 +
|-
 +
! <tt>pof</tt>
 +
| Get ACDCU on/off control byte
 +
| rowspan="2" | &mdash;
 +
|-
 +
! <tt>ps</tt>
 +
| 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 &times; <tt>row_len</tt> &times; <tt>num_rows</tt>.  The <tt>data_rate</tt> parameter to '''<tt>fr</tt>''' indicates how many ARZ occurrences occur between successive DVs.  When in RTS mode, <tt>data_rate</tt> is ignored, and DVs are triggered externally over the RTS input line.
 +
 
 +
These days, '''almost everyone uses free-run mode'''.
 +
 
 +
=== Status output ===
 +
The '''<tt>?</tt>''' 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 <tt>minicom</tt>.  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 &times <tt>row_len</tt> &times; <tt>num_rows</tt>, 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 <tt>data_rate</tt> 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 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:
 +
 
 +
:* '''<tt>z</tt>''' is the address zero bit (always zero)
 +
:* '''<tt>d</tt>''' is the data valid bit (always zero)
 +
:* '''<tt>-</tt>''' are reserved (unused) sync-word bits.
 +
:* '''<tt>f</tt>''' is one if in free-run mode or zero if in RTS mode
 +
:* '''<tt>e</tt>''' is the <tt>dv_error</tt> bit.  It is one if in RTS mode and more than one RTS DV pulse was received since the last ARZ.  Zero otherwise
 +
:* '''<tt>Nnn...</tt>''' 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.  <tt>DV_spare1</tt> has the 5MHz clock and <tt>DV_spare2</tt> 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 [[#RS-232 communication and commanding|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.
 +
* '''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 ===
 +
* '''Digital input''' The sync box has eight general-purpose optocoupled digital inputs, originally used to monitor the [[ACDCU]]s powering the attached MCEs.  The '''<tt>ps</tt>''' 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 [[ACDCU]]s powering the attached MCEs.  The '''<tt>dpu</tt>''', '''<tt>dpa</tt>''', '''<tt>epa</tt>''', and '''<tt>pof</tt>''' 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
 
To check that the sync box is connected correctly to the MCE, issue the command
 
  wb cc {{param|cc|select_clk}} 1
 
  wb cc {{param|cc|select_clk}} 1
Line 54: Line 221:
 
  Line  0 : ok : 1
 
  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 0 in about 1 second.
+
Setting {{param|cc|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:
 
To accept sync triggers and serial numbers from the sync box, two more commands are needed:
Line 60: Line 227:
 
  wb cc {{param|cc|use_dv}} 2
 
  wb cc {{param|cc|use_dv}} 2
  
These registers are configured automatically by the config system if the parameters "hardware_sync" and "config_sync" are both 1 in experiment.cfg.  If you change the values in $MAS_DATA/experiment.cfg instead of $MAS_TEMPLATE/experiment.cfg, remember to "mce_make_config" before re-running the config script.
+
These registers are configured automatically by the config system if the parameters <tt>hardware_sync=1</tt> and <tt>config_sync=1</tt> in [[experiment.cfg]].  If you change the values in <tt>$MAS_DATA/experiment.cfg</tt> instead of <tt>$MAS_CONFIG/experiment.cfg</tt>, remember to run <tt>[[mce_make_config]]</tt> 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 [[ MCE:_Helper_programs |  eat_packets ]] tool:
 
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 [[ MCE:_Helper_programs |  eat_packets ]] tool:
 
   
 
   
  mce@mce-ubc-2:~$ mce_status -s | grep {{param||fw_rev}}
+
  $ mce_status -s | grep {{param||fw_rev}}
 
   
 
   
 
  mce@mce-act-b1$  mce_run sync_test 400 s
 
  mce@mce-act-b1$  mce_run sync_test 400 s
Line 70: Line 237:
 
  FRAME_BASENAME=/data/cryo/current_data//sync_test
 
  FRAME_BASENAME=/data/cryo/current_data//sync_test
 
   
 
   
  mce@mce-ubc-2:~/mce_script/script$ eat_packets -n 5424 -f $MAS_DATA/mce_run10
+
  $ eat_packets -n 5424 -f $MAS_DATA/mce_run10
 
  Forced    frame_size=1356 (5424)
 
  Forced    frame_size=1356 (5424)
 
  offset    frm_idx  frame#
 
  offset    frm_idx  frame#
Line 76: Line 243:
 
  EOF, exiting after 10000 frames + 0 bytes
 
  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 getting into the frame data.
+
If the <tt>[[mce_run]]</tt> does not terminate quickly, the sync box may not be properly connected to the MCE.  If <tt>eat_packets</tt> complains only about the first frame (offset 00000000), then the sync numbers are intact and incrementing contiguously.  If <tt>eat_packets</tt> complains about pretty much every frame, the sync numbers are not being inserted into the frame data.
  
== minicom Setup ==
+
== Legacy documents ==
To issue commands to a Sync Box over an RS-232 line, you can use a Linux program called <tt>minicom</tt>.  To install this application, do:
+
* The original "Sync Box User's Guide" is available here:
sudo apt-get install minicom
+
:http://www.phas.ubc.ca/~mce/mcedocs/hardware/tech_description/SyncBox_UserGuide_S589_502.pdf
To start MiniCom:
+
:'''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.
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.
 
  
 
[[Category:Sync Box| ]]
 
[[Category:Sync Box| ]]

Revision as of 14:53, 7 November 2016

Related topics:
A DC-in Sync Box with six of eight transmitters installed

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.
  • 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 on RTS DV pulse is received between successive address-reutrns-to-zero (ARZs); see [[#The Manchester output stream|below. It is turned off at the next ARZ. This cannot occur in free-run mode.

Documents

A rack-mount AC-in Sync Box - Back
A rack-mount AC-in Sync Box - Front

Firmware

For instructions and downloads see: Sync Box Firmware

Setting up the Sync Box

You can use an rs232 terminal emulator (e.g., minicom on a linux PC, see below) to issue commands to the Sync Box, a list of all the commands available is given by typing

> h

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. —== Front panel LEDs ==
  • Power (green): The power LED is on whenever the sync box is powered on.
  • 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 on RTS DV pulse is received between successive ARZs. It is turned off at the next ARZ. (This cannot occur in free-run mode.)
? 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 &times 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 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 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.
  • 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

  • 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.