calctrl - ComPair/ComPair-tracker-FPGA GitHub Wiki

calctrl

This is a command-line tool to configure and run the external calibrator

Build instructions

Currently Lucas has no idea why this thing can't be built as a petalinux application. SO, you will have to do a hacky thing and build it in the Vivado SDK.

1) In the SDK, create a new c++ linux project named "calctrl"

Just choose the "empty" project template.

2) Rename main.cc to calctrl.cpp

3) Copy files into SDK src directory

The source files are found in ComPair-tracker-FPGA/src/sdk-apps/calctrl/. So, copy all files over:

cp ComPair-tracker-FPGA/src/sdk-apps/calctrl/* ComPair-tracker-FPGA/work/zynq/zynq.sdk/calctrl/src/

NOTE: calctrl has not made it into dbe-production branch!!!! At the moment (2/13), you will have to get the source from the master branch!!!!

4) Build!

If you run into errors related to macros not being defined, make sure that the include/ from a BSP is included. This is done in C/C++ Build Settings -> Directories.

5) scp the elf over

The executable will end up in ComPair-tracker-FGPA/work/zynq/zynq.sdk/calctrl/Debug/calctrl.elf. You can scp it to the silayer.

Usage

Usage: calctrl [OPTIONS] [PULSE-FIRE-CMDS]
  OPTIONS:
    --cal-pulse-disable   : Disable the firing of calibration pulses.
                          : Default behavior: cal pulse is enabled.
    --vata-trigger-enable : Enable firing of vata triggers with calibration pulses.
                          : Default behavior: vata triggers disabled.
    --fast-or-disable     : Disable the fast-or trigger acceptance by vatas.
                          : Default behavior: fast-or is enabled.
    --pulse-width WIDTH   : Set the pulse width in number of clock cycles.
    --trigger-delay DELAY : Set the trigger delay in number of clock cyles.
    --repeat-delay DELAY  : Set the delay between successive calibration pulses.
    --set-cal-dac VALUE   : Set the calibration dac value.
  PULSE-FIRE-CMDS: only one of the below may be specified:
    --start      : Start firing infinite train of calibration pulses.
    --stop       : Stop firing infinite set of calibration pulses.
    --n-pulses N : Fire N calibration pulses.

All-caps things are variables that you set. Do not write those out verbatim!

Example

  • Set the pulse height to whatever corresponds to 2048:
calctrl --set-cal-dac 2048
  • Set the pulse width, repetition delay, and repeatedly fire:
calctrl --pulse-width 100 --repetition-delay 100 --start
  • Stop endless calibration pulses
calctrl --stop

Note: I do not think calibration settings (pulse-width, repetition delay, ect) are persistent, so you should set them each time if you don't like the defaults