...
Startup Scripts
./load_fpga
Code Block | ||
---|---|---|
| ||
Usage: load_fpga [-f bit-file] [addresses]
-f bit-file
Optionally specify location of bit file, otherwise $BIT_FILE will
be loaded from the current directory |
Loads an FPGA image onto the specified AMC card, must be invoked on the target MTCA CPU.
tools/flash_fpga
Code Block | ||
---|---|---|
| ||
tools/flash_fpga amc525_lmbf.bit 200 |
Permanently stores FPGA image on the specified AMC525 card. The last octet of the AMC525 card is specified, and this tool must be run on the MTCA system. The given image will be automatically loaded as the AMC card boots. It takes just over 4 minutes to run this command as writing to the flash is slow.
tools/start
...
-ioc
This script should be passed An IOC is configured by creating a soft link to this script with the name of an the IOC configured in the iocs
directory. The IOC is launched (using epics/runioc
) under procServ
.
epics/runioc
Code Block | ||
---|---|---|
| ||
Usage: runioc [options] config-file
Starts MBF IOC with configured options.
-v Run with valgrind memory checker enabled
-l Add leak check to valgrind (must specify -v first)
-t Add track origins to valgrind (must specify -v first)
-q Disable PV logging
-u Don't lock hardware registers
-z Disable delay compensation
-n Run without initialising hardware
|
This is the main launcher for running the EPICS IOC. Don't use the -v
option for normal operation as it slows things down too much. The -z
option is only for use with delay compensation measurement. The -n
option is only useful for demonstration or simple IOC debugging.
This script should not normally be run directly, instead use the launcher links in iocs
.
epics/setup_mbf
Code Block | ||
---|---|---|
| ||
setup_mbf ioc-config |
This script is run as part of IOC initialisation to initialise the hardware. The main work is programming the three devices (PLL, ADC, DAC) on the FMC500 card. An IOC configuration file must be passed as the only argument.
epics/initial-state
Code Block | ||
---|---|---|
| ||
initial-state ioc-name |
This helper script can be run after the first run of an EPICS IOC or when the state file has been deleted. The compensation filters and ADC limits are reset, the bunch output gains are all set to 1, and some initial bank configurations are set.
...
All of the scripts described here are run as helpers for the EDM screens.
epics/opi/scripts/mbf-run-command
This is a wrapper script for running other helper scripts in a temporary xterm terminal. This is done so that if the script fails then the output can be reviewed.
...
This script launches Firefox to view the appropriate help page when the help button
on a GUI screen is pressed....
sites/
...
DLS/scripts/mbf-setup-tune
This script is Diamond specific, and is called in response to each of the "Tune" setup buttons at the bottom of the MBF Overview page (as configured at Diamond).
Code Block | ||
---|---|---|
| ||
usage: mbf-setup-tune [-h] [-c CONFIG] [-d] [-m RING_MODE] [-t TUNE] [-n] device mode Configure device in specified setup mode. positional arguments: device TMBF device name to configure mode Configuration mode, must be one of TUNE, AP, FB optional arguments: -h, --help show this help message and exit -c CONFIG Alternative configuration file -d Enable debug mode -m RING_MODE Specify ring mode, otherwise PV will be consulted -t TUNE Specify tune, otherwise config file will be consulted -n Dry run, don't actually write to device |
The configuration mode is set according to the button name as follows:
Tune setup | Mode | Description |
---|---|---|
Tune Only | TUNE | Normal tune measurement configuration without feedback. |
Tune Special | AP | Special configuration for accelerator physics. Wider tune measurement sweep. |
Feedback On & Tune | FP | Normal tune measurement together with bunch-by-bunch feedback. |
The setup is read from two files:
File | Description |
---|---|
setup_defaults.py | This sets defaults for all of the settings that will be written by this script. |
MBF_tune.config | This file is designed to be edited by operators and is used to fine tune the behaviour of this script. |
epics/opi/scripts/mbf-set-waveform
Code Block | ||
---|---|---|
| ||
mbf-set-waveform PV value [bunch] |
This helper function is called from the detector bunch setup screen, and is used to update a waveform PV. If bunch
is not specified the entire waveform is set to value
, otherwise only the selected bunch is updated.
epics/opi/scripts/mbf-set-one-bunch
...
Tune Fitter
The tune fitter is managed by the following scripts.
tune_fit/runioc
Script for launching the tune fitter.
iocs/start-fitter
Helper script for launching tune fitter IOC.
tune_fit/plot_replay
Used to run tune fitter algorithm on canned data.
Development Scripts
Note that build scripts are not documented here.
...
Provides direct access to the FMC 500 SPI registers. Use with care! If no value is given the register is read, otherwise value
is written to the register. The spi
parameter determines which device is addressed:
spi | Device | Description |
---|---|---|
0 | LMK04828B | Clock Jitter Cleaner with Dual Loop PLLs. Elsewhere referred to just as "the PLL". |
1 | AD9684 | Dual Analog-to-Digital Converter (ADC). |
2 | AD9122 | Dual 16-Bit 1230 MSPS TxDAC+ Digital-to-Analog Converter (DAC). |
tools/scan_idelay
Code Block | ||
---|---|---|
| ||
usage: scan_idelay [-h] [-a ADDR] [-f F_RF] [-s IDELAY] [-n CAPTURE_COUNT] [-m CLOCK_MODE] Scan for best IDELAY setting optional arguments: -h, --help show this help message and exit -a ADDR Set physical address of card. If not specified then use card 0 -f F_RF RF frequency, used to calculate number of samples -s IDELAY If set, set IDELAY to this after test -n CAPTURE_COUNT Number of data points captured for each sample -m CLOCK_MODE Configure clock mode before running scan |
Scans through ADC clock to data delays and shows result from reading test pattern. Needs to be run on initial commissioning of new hardware, and should be checked after updating firmware.
Areas of Concern for Portability
The following issues will need to be sorted out.
...
tools/find_freq
Code Block | ||
---|---|---|
| ||
$ ./find_freq 499.682
VCO0 D = 5
(R2 = 55, N2 = 1374 = 2 * 687), offset = +91.3%
(R2 = 57, N2 = 1424 = 2 * 712), offset = +65.8%
(R2 = 58, N2 = 1449 = 3 * 483), offset = +53.7%
(R2 = 59, N2 = 1474 = 2 * 737), offset = +42.0%
(R2 = 61, N2 = 1524 = 2 * 762), offset = +19.8%
(R2 = 63, N2 = 1574 = 2 * 787), offset = -1.1%
VCO1 D = 6
(R2 = 46, N2 = 1379 = 7 * 197), offset = +88.7%
(R2 = 53, N2 = 1589 = 7 * 227), offset = -7.1% |
Searches through possible settings for clock PLL divisors to meet the given target frequency (in MHz). Returns a list of possible VCOs and a list of possible divisors in descending order of offset. The offset percentage indicates how far the target frequency is from the tunable centre frequency as a percentage of the full tunable range (±10-4).