Programming over Fibre

From MCEWiki
(Redirected from Remote Firmware Update)

The procedure to update the MCE firmware over the fibre interface using a MAS PC, also known as "Remote Firmware Update", is described here.

Introduction

Each of the Address Card, Bias Cards, and Readout Cards of the MCE has an Altera Stratix FPGA along with a configuration device ( See here). The Clock Card, however, has one FPGA with two configuration devices. FPGAs are RAM-based devices while configuration devices are Flash-based devices. Upon power up, each FPGA is loaded from its respective configuration device. The Clock Card FPGA is loaded from its factory configuration device upon power up, but then later, the firmware in the application configuration device can be loaded into the FPGA by issuing a command, i.e.:

mce_cmd -x rs cc config_app

All these programmable parts, with the exception of the factory configuration device, are on a continuous JTAG chain that can be controlled via the MCE front-panel connector with an attached USB-Blaster, or via the Clock Card FPGA, provided it is running the right firmware, and is driven through the fibre interface.

The factory configuration device, however, is not on the same JTAG chain. It is only accessible through an on-board JTAG connector and can only be programmed with a USB-Blaster attached and Quartus Programmer.

In order to load temporary firmware, an sof file can be loaded into the FPGA. This firmware will be lost upon power cycle. To load permanent firmware, a pof file (or a jic file depending on EPC16 or EPCS64) can be loaded.

Remote Update: step by step

This can be done in 3 steps:

  1. Scan JTAG chain
  2. Generate JAM file
  3. Update Firmware

Scan JTAG Chain

Run mce_auto_detect:

user@ubuntu:~$ mce_auto_detect
mce_scan version 1
card_scan
#   card  card_id    card_type  pcb_rev    slot_id
      2 0x124fb77         3         0         8
      3 0x19c74de         2         0         4
      4 0x1256aa5         2         0         5
      7 0x19c0a93         1         6         1
      8 0x19c3071         1         6         2
      9 0x19c1455         1         6         3
     10 0x19c6305         0         0         0
jtag_scan
# id device
  1 EPC4/EPC8/EPC16
  2 EP1S40
  3 EPC4/EPC8/EPC16
  4 EP1S40
  5 EPC4/EPC8/EPC16
  6 EP1S10
  7 EPC4/EPC8/EPC16
  8 EP1S10
  9 EPC4/EPC8/EPC16
  10 EP1S10
  11 EPC4/EPC8/EPC16
  12 EP1S10
  13 EPC4/EPC8/EPC16

Note that the order of devices are cc (#1), rc2 (device #2, #3), rc1(#4, #5), bc3 (#6, #7), bc2(#8, #9), bc1(#10, #11), ac(#12, #13).

Device #1 refers to the Application configuration device on Clock Card.

If there are no devices listed below "jtag_scan", you probably have to flip a jumper on your clock card. See the section below on #Hardware Requirements .

Generate Jam File

You need to update firmware on one device type at a time, i.e., EPC only, or FPGA only, or EPCS64 only.

If you have access to internet:

  1. Go to MCE Firmware Canning Party webpage: http://e-mode.phas.ubc.ca/mcefcp/
  2. copy and paste the result of mce_auto_detect on that webpage.
  3. Choose the target device(s) you want to program and a drop down menu of available firmware revisions will appear.
  4. Choose the firmware revision and click generate (find out which is the appropriate firmware version here: https://e-mode.phas.ubc.ca/mcewiki/index.php/MCE_firmware and download the firmware from here: https://e-mode.phas.ubc.ca/mce/firmware/).
  5. Save the generated file somewhere on your mas PC.

If you do NOT have access to internet:

  1. Install Quartus II Web Edition on Linux See Instructions here
  2. make a cdf file from the output of mce_auto_detect. Here is a sample cdf file CDF
  3. generate a jam file by typing:
 quartus_cpf -c <cdf_file_name> <jamfilename>

Update Firmware

Run mce_fw_update:

Usage:   /usr/mce/mce_script/script/mce_fw_update <device> <jamfilename> 
  device        one of:
          FPGA:   for temporary firmware (sof)
          EPC16:  for permanent firmware on any card other than RC Rev. E (pof)
          EPCS64: for permanent firmware on RC Rev. E (jic)
  jamfilename   either an absolute pathname, or a file in $MCE_JAM_DIR

If you are programming FPGA parts (temporary firmware), this step takes seconds. However, it takes minutes to program permanent firmware into EPC16 or EPCS64 devices, e.g. 13 minutes to program 2 rev F. Readout Cards.

If the programming fails, you might need to mess with the programming frequencies. These are passed to mce_jam via the -f flag, as frequencies in Hz. See the mce_fw_update script, and try decreasing the frequency by a factor of 10.

Note that when programming permanent firmware, the fw_rev will not immediately be updated. The new firmware will not be loaded until the card is power cycled.

Troubleshooting Remote Update

Software Requirements

Make sure the following are installed. From the MAS repository:

  • mce_jam : This will be installed under /usr/mce/bin/.

From the MCE script repository (trunk):

  • read_idcode.jam : This should be in $MAS_TEMPLATE directory.
  • $MCE_JAM_DIR is set : This is set through mas_env.bash.
  • mce_auto_detect (in mce_script directory)
  • mce_fw_update (in mce_script directory)

Firmware Requirements

The Clock Card FPGA has to run firmware revision 5.0.7 or later. Considering that Clock Card FPGA can be loaded through either the Factory or Application configuration devices, at least one of these need to have 5.0.7+ firmware. If you are running Clock Card firmware prior to 5.0.7, which means your factory configuration device is loaded with firmware prior to 5.0.7, then attach USB-Blaster to the MCE front-panel connector. Run Quaruts Programmer, click on auto-detect, and program the second part from the bottom of the list, EPC16, with Clock Card firmware 5.0.7+.pof.

Then issue the following command:

mce_cmd -x rs cc config_app

to switch to the new firmware. (Read back the firmware revision to make sure the new firmware is now active.)

Hardware Requirements

The buffer that controls whether the FPGA can drive the JTAG chain or not is controlled by BB_EN or SW1 dip switch setting on the Clock Card. Clock Cards shipped earlier than Dec. 2010, do not have the right settings. To check this setting on your Clock Card, turn off the MCE power and unplug the Clock Card. The SW1.P1 labeled as "BB_EN" DIP should be on OPEN position.

  • Note that with DIP switch SW1.P1 set to OPEN, you can not program the FPGA(sof) from the front panel connector (USB_Blaster) anymore.
  • With DIP switch set to OPEN, if CC firmware is pre-5.0.7, you can not access the JTAG chain from the front panel connector (USB_Blaster) anymore. Assuming you have 5.0.7+ in your configuration device, you need to issue: mce_cmd -x rs cc config_app 1 to be able to access front-panel JTAG.

Footnotes

Porting Remote Configuration Sofware to DAS

The following C-code will need to be ported to DAS to enable Remote Configuration. You will need to convert the MCE WB and RB commands in the code to use DAS libraries and compile the code with the included Makefile:

Development Notes