Version 66 (modified by Dan Gastler, 6 years ago) (diff)


Programming Firmware

Firmware versions

Logic board

     Added new C5 command that increments the spill number, but causes no spill.  This is C5 word 0x3.
     Added new command("tdc_prog") to Logicboard to allow reprogramming of the TDC uC via the bootloader with no power-cycle.
     Fixed bug in external clock reset register.
     Added hacked command to Logicboard to allow reprogramming of the TDC uC via the bootloader. (requires power cycle after)
     Fixed bug in clock source switch which did not affect normal operation.
     Lengthened the recovery period in the onewire temperature sensors to fix issue with bus with four flexis.
     First public release of firmware for a New Logic-board.  This has the commands to talk to a new IntegratedTDC. 

Integrated TDC board

  • v20170609
       Added new C5 command that increments spill number, but doesn't start a spill.  This is C5 value 0x3.
  • v20170607
       Added new C5 command that increments spill number, but doesn't start a spill.  This is C5 value 0x3.
  • v20170424
       First release of new timing binned firmware.  Untested channel masking.
  • v20170308
       Changed timing bins
  • v20170302
       Auto time stamping added to registers 0x9-0xc.  First crack at timing bins.
  • v20160606
       New version that correctly sets the event number register to the number of events generated. 
  • v20160405
       First public firmware for the new Integrated TDC board. 

Integrated TDC uC

  • v1.30
       Implemented a fix for all the strange led problems.
  • v1.20
       Added a version command for the upcoming python script.
  • v1.10
       First public firmware for the new Integrated TDC uC. 


OLD Logic Board design

     Updated CDR set as power-up default.  Flash programming commands. 
    Fixes to new event builder (missing CRC word) and connection of missed daq register fields (CDR historgrams, etc)
    New event builder
    New event builder
    Added some FLASH commands.  picoblaze clock dropped to 62.5Mhz from 125.
   Added longer CDR test time period.  Please add a event builder reset before this command is run. 
   Added cdr command to the SC interface that checks and corrects TDC serial data recovery for all enabled TDCs.
   This should be done after you enable the TDCs( on the LogicBoard reg 0x40), but before you call an event builder reset.
    New data format: 
    Added several more registers to the TDC readout for debugging: 
  • TOOL:
        A tool for automatically doing the manual TDC CDR alignment. 
        There are a few situations where this fails to work; power cycle in those situations. 
    CDR phase controls. 
    Bad firmware date (I'll fix tomorrow)
    Upgrade init script to []
    Look for constant incrementing in misaligned idles or no incrementing in k-chars using []
    Added slow control readout of full data, added CDR status (not useful though) and the current 10b and 8b words from the TDC. 
    The next version will try the 4phase CDR lock-on code instead of the current 5phase one. 
    Stable readout if glib is reset after Logicboard initialization. 
    Current bugs: TDC summary words in LB header always say there is a size error. 
    Better data alignment at BU.  
    Current bugs: Still buggy word 15 in TDC.  TDCs are marked as bad size, but seem ok. Logicboard event number starting at two.
   Removed buffer word in TDC fifo.
  UART interface now shows the new version number on power-up and with the "version" command. 
  Event builder has been updated to initialize more things on reset.
  Starting with this version, the firmware version number is stored in DAQ register 0x1 and is in the format of YYMMDDVV. 
  Ex. This version reads: 0x0F050C01 meaning 2015-05-12 v1

Old design TDC Board daughter-board firmware

   Minor changes to the clocking circuits. 
   Added software and hardware addresses to the TDC data format in word 14. 
   Back to non 2048 readout.

Programming Firmware


  1. Plug in the Logicboard (slow control and power) and Integrated TDC if you want to reprogram the TDC or uC.
  2. Download the most recent version of the firmware for the Logicboard, Integrated TDC, or Integrated TDC uC from this page.
  3. Download the flash programming tool (both python scripts)
  4. run the file, followed by the firware you want to upload (and -i 0 or -i 1 for TDCs 0 or 1)
    • If you just powered up the Logicboard or TDC, you have to wait about 5 sconds for the logicBoard or until the fpgas program or fail to program before the script can connect.

Explanation (what the python script does) (see for command explanations)

  • The code for programming a Logicboard or Integrated TDC is very similar:
    1. Erase the flash memory with a "fe" command.
    2. Clear the flash buffer (which is in the uC, not th flash memory) with a "fc" command.
    3. Set the memory address to be written to (Starting at 0) with "faw 000000".
    4. Write data into the flash buffer (up to 16 lines of data) with a "fww" followed by the line to write to and the data line.
    5. Write the flash buffer to the flash with the "fw" command.
    6. Repeat until all data has been written to the flash.
  • The code for programming an Integrated TDC uC is slightly different:
    1. Write "tdc_prog" followed by the integrated TDC to connect to (ex. "tdc_prog 0")
      1. This will connect to and restart the tdc, so that you can send commands to the bootloader.
    2. Send a series of bootloader commands to get in sync with the booyloader and enter programming mode.
    3. Send a bootloader command with the address to write to.
    4. Write a page of data (usually 128 bytes)
    5. Repeat until all data has been written.
    6. Send a command to leave the bootloader.