Skip to content

Releases: LDMX-Software/pflib

v3.4.0 : new scans and analyses

01 Aug 15:57
67fc8b2
Compare
Choose a tag to compare

Lot's of new scans and analyses focused on learning how to tune the chip. Next overall step is to translate these scans/analyses into algorithms that we can put into the C++ for doing a first pass of the chip tuning.

What's Changed

New Contributors

Full Changelog: v3.3.1...v3.4.0

v3.3.1 : parameter timescans and trigger delay shifts

24 Jun 16:38
205fd6d
Compare
Choose a tag to compare

What's Changed

#148 adds an option for injecting charge before the current conveyor ("preCC") by @andpet1324
#149 follows up this addition by defining a new command in the TASKS menu that allows users to do a time scan for each entry in a parameter points file, allowing us to view how a pulse changes with increasing amplitude (for example). by @andpet1324

#151 shifted the trigger L1A capture delay and updated the definition of DAQ.SETUP.STANDARD in order to apply this configuration.
The fast command definitions and the necessary HGCROC parameters are defined within this command and only need to be run after at HGCROC hard reset or firmware load.

🧹 Tidying

New Contributors

Full Changelog: v3.3.0...v3.3.1

v3.3.0 : reorg and general scan reporting for duty

11 Jun 19:48
cd11bf1
Compare
Choose a tag to compare

What's Changed

#143 does some major refactoring/reorganization with an eye towards reducing re-compile times and hopefully easing development. This PR is what is causing me to make a minor release to signal to other developers that their code may conflict with the updated version due to how many files I've touched/moved.

#144 introduces a TASKS.GEN_SCAN command where users can input a CSV file containing the parameters to scan over, the number of events to scan, the channel to write out to the output file, and any other scan-wide parameters to set. This is hopefully an intermediate command where we can use it to explore different kinds of scans. Any scans that we expect to do regularly (e.g. across multiple HGCROCs during comissioning) should be translated into a C++ menu command so that it is easier to apply across many ROCs. I'll add more documentation on how to use this command to the wiki.

Full Changelog: v3.2.2...v3.3.0

v3.2.2: high range and trigger links

09 Jun 20:15
Compare
Choose a tag to compare

What's Changed

#136 enabled time-scanning of HighRange internal calibration pulses through the addition of another by parameter.

e2c3b19...f587314 added reading/writing of a ~/.pftool-history file to the menu so that scroll back is persisted between sessions (and to help debug)

#139 added a new command to help time-in the trigger links using charge injections and the stored the delay results found at UMN into the STANDARD setup.

Full pftool Menu Dump You can get this for yourself with `./pfootl --dump`.
  LOG          Configure logging levels
  EXPERT       expert functions
    I2C          raw I2C interactions
      BUS          Pick the I2C bus to use
      READ         Read from an address
      WRITE        Write to an address
      MULTIREAD    Read from an address
      MULTIWRITE   Write to an address
  ELINKS       manage the elinks
    RELINK       Follow standard procedure to establish links
    HARD_RESET   Hard reset of the PLL
    STATUS       Elink status summary
    SPY          Spy on an elink
    AUTO         Attempt to re-align automatically
    BITSLIP      Set the bitslip for a link or turn on auto
    SCAN         Scan on an elink
    DELAY        Set the delay on an elink
    BIGSPY       Take a spy of a specific channel at 32-bits
  ROC          Read-Out Chip Configuration
    HARDRESET    Hard reset to all rocs
    SOFTRESET    Soft reset to all rocs
    DIRECT_ACCESS_PARAMETERS list the direct access parameters we know about
    GET_DIRECT_ACCESS print a direct access parameter
    SET_DIRECT_ACCESS set a direct access parameter
    IROC         Change the active ROC number
    RUNMODE      set/clear the run mode
    CHAN         Dump link status
    PAGE         Dump a page
    PARAM_NAMES  Print a list of parameters on a page
    POKE_REG     Change a single register value
    POKE_PARAM   Change a single parameter value
    POKE         Alias for POKE_PARAM
    LOAD_REG     Load register values onto the chip from a CSV file
    LOAD_PARAM   Load parameter values onto the chip from a YAML file
    LOAD         Alias for LOAD_PARAM
    DUMP         Dump hgcroc settings to a file
  FAST_CONTROL configuration and testing of fast control
    STATUS       Check status and counters
    SW_L1A       Send a software L1A
    LINK_RESET   Send a link reset
    BUFFER_CLEAR Send a buffer clear
    RUN_CLEAR    Send a run clear
    COUNTER_RESET Reset counters
    CALIB        Setup calibration pulse
  TASK         tasks for studying the chip and tuning its parameters
    CHARGE_TIMESCAN scan charge/calib pulse over time
  DAQ          Data AcQuisition configuration and testing
    STATUS       Status of the DAQ
    RESET        Reset the DAQ
    PEDESTAL     Take a simple random pedestal run
    CHARGE       Take a charge-injection run
    DEBUG        expert functions for debugging DAQ
      STATUS       Provide the status
      ESPY         Spy on one elink
      ADV          advance the readout pointers
      SW_L1A       send a L1A from software
      CHARGE_TIMEIN Scan pulse-l1a time offset to see when it should be
      CHARGE_L1A   send a charge pulse followed by L1A
      L1APARAMS    setup parameters for L1A capture
      TRIGGER_TIMEIN look for canidate trigger delays
    SETUP        setup the DAQ
      STATUS       Status of the DAQ
      ENABLE       Toggle enable status
      L1APARAMS    Setup parameters for L1A capture
      FPGA         Set FPGA id
      STANDARD     Do the standard setup for HCAL
      FORMAT       Select the output data format
      SETUP        Setup ECON id, contrib id, samples

Full Changelog: v3.2.1...v3.2.2

v3.2.1: starting tasks

04 Jun 20:37
e2c3b19
Compare
Choose a tag to compare

⚡ Updates

#132 has ./pftool print the version of the firmware and check that it is the active firmware when it is lauched. This makes the launch a bit slower since the most reliable way to check the firmware version is to query rpm, but I think it is worth it to avoid potentially time-consuming data confusions.

#133 starts a new TASK menu with a CHARGE_TIMESCAN command. Additionally, it proposes a "new" data format that I'm calling "pflib CSV" which is just a CSV with an (optional) additional line at the top starting with a # and then containing a JSON dictionary with run parameters. An example of writing this is done in this command and example of reading this data format is given in python with ana/read.py (which is used in ana/charge/time-scan.py).

🧹 Cleanup

0d1e51b removed the old reference documents causing confusion. Please look at the wiki for links to the most up-to-date documents we have access to.

6fabef3 removed the git checkout part of the Quickstart. Not only did it ask the user to pick an extremely old version, it also is not needed anymore given how we deduce our version.

Full Changelog: v3.2.0...v3.2.1

v3.2.0 : ease writing of new commands

03 Jun 18:35
6ab1826
Compare
Choose a tag to compare

The main reason this is a minor release as opposed to a patch release is that I've done a few refactors that will hopefully make it easier to write new commands for pftool.

What's Changed

#125 and #126 are mainly there to make re-compling faster by avoiding compiling the same code twice.

#127 adds a BaseMenu::readline_path function that constructs a file path using the default_output_directory and timestamp_format parameters within a pftoolrc. This makes it easier for folks to construct an output file path and users can change where their output files go and what their timestamps look like. For example, my pftoolrc looks like

default_output_directory: "../data"
timestamp_format: "-%Y-%m-%d-%H%M%S"

since I want my output files in a specific directory (relative to where my build is since thats where I usually launch pftool) and I like dashes - instead of underscores _.

#123 adds a "test parameters" mechanism that sets parameters back to their values before applying test values when the handle is destructed (aka goes out of scope). The DAQ.DEBUG.CHARGE_TIMEIN command shows an example of how to use it, but basically

// PAGE.PARAM1 is some value defined by other POKE/LOAD calls
{
  // inside some function, for loop, or if statement
  auto test_param_handle = roc.testParameters()
    .add("PAGE", "PARAM1", new_value);
    .apply();
  // PAGE.PARAM1 is new_value
}
// outside the scope of test_param_handle, PAGE.PARAM1 is back
// to what it was above

#131 refactors how we write the data to output files in order to avoid copying around boilerplate code. Look to that PR description for a bit more detail, but in short you can use lambda functions in order to decide how the CSV rows are written and therefore add/subtract columns as well as choose which channels are written.


Putting these all together, I have written a time scan in my work for #130 (not merged since I haven't confirmed these are the correct parameters and ordering yet), but it offers a good example of using these features for writing commands.

        ->line("CHARGE_TIMESCAN", "scan charge/calib pulse over time", [](Target* tgt) {
          int nevents = BaseMenu::readline_int("How many events per time point? ", 100);
          int calib = BaseMenu::readline_int("Setting for calib pulse amplitude? ", 1024);
          // get a path from the user, we provide a prefix that will be put before the timestamp
          // the default output directory is controlled by the user and defaults to PWD
          // an extension is optional, if no extension is provided here, the user is instructed
          // to not provide an extension, it is assumed the developer (you) adds the extension
          std::string fname = BaseMenu::readline_path("charge-time-scan", ".csv");
          static int rate = 100; // pretty fast without overwhelming chip
          static int run = 1; // dummy, not stored
          // apply scan-wide settings that will be unset when scan is done
          pflib::ROC roc{tgt->hcal().roc(iroc, type_version)};
          auto test_param_handle = roc.testParameters()
            .add("REFERENCEVOLTAGE_1", "CALIB", calib)
            .add("REFERENCEVOLTAGE_1", "INTCTEST", 1)
            .add("CH_61", "HIGHRANGE", 0)
            .add("CH_61", "LOWRANGE", 1)
            .apply();
          // variables overwhich we are scanning, defined here so they can be captured by lambda functions
          // used in writing below,
          int phase_strobe{0};
          int charge_to_l1a{0};
          int channel{61};
          pflib::DecodeAndWriteToCSV writer{
            fname,
            // the '&' between the `[` and `]` has the lambda function capture ALL local variables
            //  see https://en.cppreference.com/w/cpp/language/lambda.html#Lambda_capture
            // for the grisly details
            [&](std::ofstream& f) {
              f << std::boolalpha
                << "# data collected from channel " << channel << "\n"
                << "charge_to_l1a,phase_strobe,"
                << pflib::packing::Sample::to_csv_header << "\n";
            },
            [&](std::ofstream& f, const pflib::packing::SingleROCEventPacket& ep) {
              auto sample{ep.channel(channel)};
              f << charge_to_l1a << ',' << phase_strobe << ',';
              sample.to_csv(f);
              f << '\n';
            }
          };
          tgt->setup_run(run, DAQ_FORMAT_SIMPLEROC, daq_contrib_id);
          auto central_charge_to_l1a = tgt->fc().fc_get_setup_calib();
          // do NOT re-declare the parameters we are iterating over (i.e. no `int` before `charge_to_l1a`)
          // this then uses the same variables captured by the writing lambdas so their values for the writer
          // and for this loop are the same
          for (charge_to_l1a = central_charge_to_l1a-1;
               charge_to_l1a < central_charge_to_l1a+2; charge_to_l1a++) {
            tgt->fc().fc_setup_calib(charge_to_l1a);
            pflib_log(info) << "run with charge_to_l1a = " << tgt->fc().fc_get_setup_calib();
            for (phase_strobe = 0; phase_strobe < 16; phase_strobe++) {
              // apply single-run settings that will be unset after this for loop
              auto phase_test_handle = roc.testParameters()
                .add("TOP", "PHASE_STROBE", phase_strobe)
                .apply();
              usleep(10);
              pflib_log(info) << "run with TOP.PHASE_STROBE = " << phase_strobe;
              tgt->daq_run("CHARGE", writer, nevents, rate);
            }
          }
        })

Full Changelog: v3.1.4...v3.2.0

v3.1.4: nibble permutations :pie:

29 May 20:29
Compare
Choose a tag to compare

🥧

After implementing many updates to the decoding infrastructure #116 to help debug, we eventually found out that the firmware needed to be patched again.

I have started a Firmware page on the wiki to collect notes on the firmware. You should update to 20250529_120007-10dbd92 in order to avoid a nibble-shuffling bug that was corrupting our data.

Warning

Make sure to update your L1 delay to 12 from the original setting of 11.
The DAQ.SETUP.STANDARD command in pftool does this for both data links (the trigger links remained unchanged).

What's Changed

Full Changelog: v3.1.3...v3.1.4

v3.1.3 : patch event-skipping in pedestal runs

22 May 19:28
2e30083
Compare
Choose a tag to compare

Another patch arising from my investigation of the daq link frame headers. This one is even more egregious than the one before and the patch slows the L1A/readout requests down so that the chip can actually handle them all and not get overwhelmed.

What's Changed

Full Changelog: v3.1.2...v3.1.3

v3.1.2

20 May 19:28
Compare
Choose a tag to compare

After @jmmans and I did some debugging, we found that the link read pointer was not always being advanced during a normal pedestal run. While debugging this issue, we also ended up implementing a few more debug/status options that could be useful.

This updated software benefits from updates to the firmware that @jmmans has completed and included in a new version 20250520_140433-10dbd92 available in the shared Google drive directory.

What's Changed

Full Changelog: v3.1.1...v3.1.2

v3.1.1

19 May 14:44
Compare
Choose a tag to compare

I'm mainly making this release since it updates how the Version header is deduced. Changing the version header is helpful to make sure that any logs printed to the terminal reflect the source code that was built into the executable.

What's Changed

  • add config that disables TOT and TOA for all channels c982472
  • quiet printing of elink addresses for quieter data collection 72e1b1f
  • move version header creation to compile time so that it is auto-updated whenever the source code changes da729fe
    • This change then had me remove the generation of the CMake infra for the installed pflib target, but since I don't think anyone was using it, I think that's okay. If you do need that, please open an issue and I'll figure it out.

Full Changelog: v3.1.0...v3.1.1