AMC13Tool2 is a command-line utility designed to exercise all functions of the AMC13. The tool can be run
in either interactive or scripted mode.
Usage:
AMC13Tool2.exe [-p ] [-X ] [-i ] ... [-c ] ... [--] [--version] [-h]
Argument |
Type |
Notes |
-p, --path |
path |
path to address table files (if not using connection file) |
-X, --script |
string |
name of script file to execute |
-c, --connect |
file name or ip address |
connection file name or ip address (may be repeated for multiple AMC13) |
-i, --id |
string |
connection file ID prefix (requires connection file too) |
Startup
The tool make be started with no command-line options, in which case it will immediately enter
interactive mode without establishing communication with any AMC13. Typically the first interactive
command would then be "connect" to attach an AMC13.
Specifying AMC13 Modules
Use the
-c argument to specify AMC13 modules to communicate with.
IP Address
The argument after
-c may be a numeric I/P address, in the standard form e.g.
192.168.1.120
.
To specify the control hub protocol, append
/c e.g.
192.168.1.120/c
. _Specify the T2 board (lower)
IP address._ The tool will automatically connect to the address specified + 1 for T1.
If you specify an IP address, you must also tell the tool where to find the IPBus address tables.
You can either set the environment variable
AMC13_ADDRESS_TABLE_PATH
or use
the
-p option on the command line to do this. The path must be the name of a directory containing
the two files
AMC13_T1.xml and
AMC13_T2.xml. (In the standard source distribution these are symlinks
in the directory
...amc13/etc/amc35
below the top level. In the RPM distribution they are in
/opt/cactus/etc/amc13
).
Connection File
Alternatively you may specify the name of a connection file.
See
Cactus Tutorial
for details.
If you specify a connection file, by default it must contain the entries with ID
T1 and
T2 for one AMC13.
If you have multiple ID in the same file, name them with different prefixes and pairs ending in
.T1 and
.T2.
Then specify the ID prefix with the
-i command-line argument.
Running Scripts
A script file may be created with a list of
AMC13Tool2 commands. A script may be executed in two ways:
- By specifying the file name after -X (note capitol X) on the command line
- By executing the command
include
in interactive mode or from within another script
After executing a script the tool will normally return to interactive mode. If you wish the tool to exit
(e.g. so you can run scripts from within a shell script) just terminate the script with the command
quit.
Interactive Mode
The tool will enter interactive mode after executing any scripts specified. A
> prompt is displayed.
Type
h for a list of commands. Type
h <command> for detailed help, or
h * for detailed
help on all commands.
Generally, interactive commands consist of a command word followed by
optional arguments. The command words are case-sensitive. Each command
may have aliases (alternative names) given in parenthesis in the help.
Numeric arguments are interpreted as decimal unless prefixed with
0x
in which case they are interpreted as hexadecimal.
Tab completion and history editing are provided by the GNU readline library.
Tab completion is particularly useful for command words and address table entries.
Wildcards are permitted in address table entries in certain cases.
For example, the command
readT1 stat*ttc*err* will read and
display all address table entries matching the expression with wildcards.
Wildcards are simple shell-style by default, where
* matches any string.
An argument may be preceded with the string
perl: to force full perl-style
regular expression matching.
Detailed Command List
help (h)
Display list of commands. A command name may be given for a longer description
of a particular command.
quit (q, exit)
Exit the program.
echo
Echo the arguments after the command to the terminal (useful in scripts)
sleep
Delay execution for the specified time in seconds. Decimal values
may be used.
connect <module_id>
Connect to an AMC13 using the specified IP address or connection file.
See
section above for details on the syntax.
list (fv)
List all connected AMC13 modules with firmware version, serial number
and IP addresses. The module currently accepting commands is marked
with a
- character.
For example:
>list
Connected AMC13s
*0: SN: 86 T1v: 0211 T2v: 0021 cf: 192.168.1.82
1: SN: 82 T1v: 4007 T2v: 0021 cf: 192.168.1.90
sel <number>
Select an AMC13 to accept commands. Specify a number as shown
in the output of the list command.
readT1 (rv) <address> [<count>]
readT2 (rs) <address> [<count>]
Read from a register on the T1 or T2 board. <address> may be any
of the following:
- a numeric address (remember to use 0x prefix for hex
- the name of one address table item
- an expression containing wildcard characters
An optional count may be given if the address specifies a single register.
The specified number of 32-bit words will be read and displayed.
All displayed values are in hex.
writeT1 (wv) <address> [<data>]
writeT2 (ws) <address> [<data>]
Write to an address on T1 or T2 board. Address may be numeric or an address
table item. Data must be numeric.
Data
may be omitted in which case a special
masked write is performed.
This is typically used for address table items with names starting with
ACTION..
For example:
wv ACTION.RESETS.GENERAL
Will correctly reset the T1 board.
i (en) <inputs> <options> (initialize AMC13 for data taking)
i (en) : Initialize AMC13
Usage:
i
inputs: list of inputs e.g. '1-12'
'*' enables all inputs which show AMC link ready
options: T to enable loop-back TTC on TTS output fiber
F to generate fake events in AMC13
N to leave AMC13 out of run mode after initialization
daq <config> (configure DAQ fiber output)
This command sets the configuration for the DAQ fiber (aka S-Link express, DAQLSC) outputs.
Options:
- 1 - enable SFP0 (top) DAQ fiber for AMC1-AMC12 readout
- 2 - enable SFP0 for AMC1-AMC6, SFP1 for AMC7-AMC12
- 3 - enable SFP0 for AMC1-AMC4, SFP1 for AMC5-AMC8, SFP2 for AMC9-AMC12
- d - disable all fibers
Note: recommend doing 'rd' (daq reset) after changing configuration
localL1A <mode> <burst> <rate> (Configure local L1A generator)
Option |
Function |
Note |
mode "o" |
specifies one trigger per <rate> orbits |
mode "b" |
specifies one trigger per <rate> BX |
mode "r" |
specifies random triggers in <rate> Hz |
mode "d" |
disable local L1A |
burst |
number of triggers per burst in single-burst mode |
rate |
number of orbits or BX between triggers or random rate in Hz units |
setOcrCommand (set orbit count reset TTC command)
Specify the TTC command to use for orbit count reset. Note that the low
two bits must be zero as they have predefined meanings (bit 0=BcR; bit 1=EcR)
setOrbitGap <start> <end> (set orbit gap for local triggers)
Triggers generated by the local
L1A generator will not occur in this range of BCN.
<start> must be in the range 0-3562
<end> must be in the range 1-3563
prescale <mode> <factor> (set local event capture mode/prescale)
This command sets the parameters for capture of selected events in the SDRAM
buffer for readout over IPBus using the commands
re
and
df
or other means.
mode: 0 for simple prescale (record every n events, n from 1...0x10000)
1 to match EvN with n low bits =0 where n from 5..20
factor: if mode=0, 1...0x10000
if mode=1, 5..20
lt <mode/count> (Enable/disable local L1A generator)
If <mode/count> is an integer, send that many bursts of triggers
(typically you would want to set the burst size to 1 using the
localL1A command
if using this feature).
If <mode/count> is a letter, perform one of these functions:
Mode |
Function |
e |
Enable local trigger generator |
d |
Disable local trigger generator |
c |
Start continuous triggers |
If you set up the trigger generator using
localL1A it is automatically
enabled (e.g.
lt 5
would generate 5 bursts) but it does not start to run
continuously unless you enter
lt e
. To stop continuous triggers, enter
lt d
.
rg (general reset)
Reset most AMC13 logic. For firmwares before 0x20f/0x4006 this resets DAQ links too. After this version, use 'rd' to reset DAQ separately
rc (counter reset)
Reset AMC13 counters.
rd (DAQ reset)
DAQ Link reset (firmware 0x20f/0x4006 and above)
start (Enable run mode)
stop (Disable run mode)
nodes {T1|T2} <regex> (list address table nodes)
This traverses the IPBus address table for either T1 or T2 board
and displays all items matching the specified regular expression.
The regular expression format is rather simple; '*' matches any string.
For example:
>nodes t1 *ttc*error*
9 nodes matched
0: STATUS.TTC.BCNT_ERROR (addr=00000000 mask=00000040) r
1: STATUS.TTC.BCNT_ERRORS_HI (addr=00000045 mask=0000ffff) r
2: STATUS.TTC.BCNT_ERRORS_LO (addr=00000044 mask=ffffffff) r
3: STATUS.TTC.MULT_BIT_ERROR (addr=00000000 mask=00000100) r
4: STATUS.TTC.MULT_BIT_ERRORS_HI (addr=00000043 mask=0000ffff) r
5: STATUS.TTC.MULT_BIT_ERRORS_LO (addr=00000042 mask=ffffffff) r
6: STATUS.TTC.SGL_BIT_ERROR (addr=00000000 mask=00000080) r
7: STATUS.TTC.SGL_BIT_ERRORS_HI (addr=00000041 mask=0000ffff) r
8: STATUS.TTC.SGL_BIT_ERRORS_LO (addr=00000040 mask=ffffffff) r
>
re <all> (read/display event from SDRAM)
This command will read the next event from the SDRAM and display
the first 10 words and last 5 words of the event. If the argument
all
is given, the entire event is displayed. The read pointer is advanced
to the next event.
rev (read/display event using new vector interface)
This command is equivalent to
re except that it uses (tests) the new
vector-based function to read events.
df <file> <count> (read events to file)
This command reads events from the SDRAM buffer and writes them to
a binary file. The
file argument specifies the file to write.
The
count argument specifies the number of events (default is 1).
The file format is defined as a list of 64-bit words in little-endian
byte order as follows. See
AMC13CommonFirmwareProposal for detailed
description of AMC13 payload format.
badc0ffeebadcafe magic number present at start of each event
cccccccccccccccc size of event in 64-bit words
510000781f412308 CMS common data format header
104101401a540110 AMC13 header, specifying 4 AMCs
0f00040300010000
...
c62b8d9c000781f4 AMC13 trailer with CRC
a0001014c3590000 CMS command data format trailer
ttc <options> (control TTC history capture)
Usage:
ttc h on - ttc history enable
ttc h off - ttc history disable
ttc h clr - ttc history clear
ttc h d - ttc history display items or all
ttc f on - ttc filter enable
ttc f off - ttc filter disable
ttc f clr - ttc filter clear
ttc f s - set TTC filter list item
is item 0-15 to set
is value to match for filtering commands
is bits to ignore when filtering commands
ttc f list - list currently-defined filters
ttc f ena - enable specific filter by number
ttc f dis - disable specific filter by number
For example:
[hazen@cms4 amc13]$ AMC13Tool2.exe -c 192.168.1.176
...
>en 1-4 f t
parsed list "1-4" as mask 0xf
Enabling fake data
Enabling TTS as TTC for loop-back
AMC13 out of run mode
AMC13 is back in run mode and ready
>ttc h on (turn on TTC history)
>ttc h d 5 (display 5 commands)
History buffer has 512 entries
NOTE: TTC history capture disabled before readout
Cmd --Orbit- BcN --EvN-
0: 01 0003cf4e dea 000001 (these are all Bc0 and uninteresting)
1: 01 0003cf4f dea 000001
2: 01 0003cf50 dea 000001
3: 01 0003cf51 dea 000001
4: 01 0003cf52 dea 000001
>ttc f s 0 0x01 0xfe (set filter item 0 to 0x01 with mask 0xfe)
>ttc f on (turn on filtering)
>ttc h clr (clear the history)
>ttc h on (turn history back on)
>ttc h d 5 (display 5 entries)
History buffer has 0 entries
>ttc h on (turn history back on)
>wv ACTION.LOCAL_TRIG.SEND_OCR (send OcR command)
>wv ACTION.LOCAL_TRIG.SEND_OCR (twice for fun)
>ttc h d 5 (display 5 entries)
History buffer has 2 entries
NOTE: TTC history capture disabled before readout
Cmd --Orbit- BcN --EvN-
0: 28 00021c6b a17 000001
1: 28 000203d5 b65 000001
>ttc f list (list the items being filtered)
Item Ena CMD Mask
0 On 01 fe
1 Off 00 00
...
15 Off 00 00
>
vfh : verify flash header -- vfh OR vfh
vbs : verify flash golden -- vbs OR vbs
vs : verify flash spartan -- vs OR vs
vv (vk) : verify flash virtex/kintex -- vv OR vv
pfh : program flash header -- pfh OR pfh
pbs : program flash golden -- pbs OR pbs
ps : program flash spartan -- ps OR ps
pv (pk) : program flash virtex/kintex -- pv OR pv
status (st) : Display AMC13 Status
usage:
status table_name
level from 1..9 with 1 being least verbose (99 displays everything)
table_name limits the display to the table named
statusHTML : Display AMC13 status in basic HTML format
usage:
statusHTML table_name
level from 1..9 with 1 being least verbose (99 displays everything)
table_name limits the display to the table named
openStatusFile : Open a text file to stream status info to
closeStatusFile : Close the text file
---
printFlash : print flash data for testing only
verifyFlash : verify flash data from file -- verifyFlash file address
programFlash : program flash data from file -- programFlash file address
reconfigureFPGAs : reconfigure FPGAs from flash
verifyFlashFile : verify flash data from file -- verifyFlash file
programFlashFile : program flash data from file -- programFlash file
selectFileTest : test function for MCS file parsing -- selectFileTest file
Flash Programming Commands (for firmware updates, etc.)
Flash programming commands uses the board's serial number to identify the relevant firmware chip-type for the user indicated flash region. It then looks for matching mcs files in the current directory and lists them for the user to pick from. Once the user selects the mcs file to use, the flash action (verify or program) will be carried out.
When reprogramming, once the flash has been programmed, load the new firmware using 'reconfigureFPGAs'
For detailed recipe for updating firmware follow this link:
Firmware Update Recipe
vfh (Verify Flash Header)
vbs (Verify Backup Spartan, e.g. Golden)
vs (Verify Spartan, e.g. T2)
vk (or vv) (Verify Kintex/Virtex, e.g. T1)
pfh (Program Flash Header)
pbs (Program Backup Spartan, e.g. Golden)
ps (Program Spartan, e.g. T2)
pk (or pv) (Program Kintex/Virtex, e.g. T1)
reconfigureFPGAs (reconfigure FPGAs from flash)
--
EricHazen - 18 Oct 2014