Difference between revisions of "Programming over Fibre"
Line 114: | Line 114: | ||
== Development Notes == | == Development Notes == | ||
− | * | + | * [[intmce:Remote Firmware Update]] |
Revision as of 17:13, 15 November 2011
The procedure to update the MCE firmware over the fibre interface using a mas PC 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 1
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:
- Scan JTAG chain
- Generate JAM file
- Update Firmware
Scan JTAG Chain
run mce_auto_detect:
mandana@mce-ubc-1:~/mce_script/trunk/script$ 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.
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:
- Go to MCE Firmware Canning Party webpage: http://e-mode.phas.ubc.ca/mcefcp/
- copy and paste the result of mce_auto_detect on that webpage.
- Choose the target device(s) you want to program and a drop down menu of available firmware revisions will appear.
- Choose the firmware revision and click generate.
- Save the generated file in $MCE_JAM_DIR directory on your mas PC.
If you do NOT have access to internet:
- Install Quartus II Web Edition on Linux See Instructions here
- make a cdf file from the output of mce_auto_detect
- generate a jam file by typing:
quartus_cpf -c <cdf_file_name> <jamfilename>
Update Firmware
run mce_fw_update: Usage: mce_fw_update <device> <jamfilename>
device FPGA, EPC16, or EPCS64 - 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 filename - file needs to be located 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 Readout Cards.
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 1
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
Generating .JAM Files for Remote Update
- Generating .JAM Files For Remote Update (automated)
- MCE Programming File Conversions (manual)
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:
- MCE Jam Player -- SVN revision 16 (~/jp_25/mce_jam/trunk).
- jam_mce.c: contains low-level MCE routines used during programming
- all other files should be fine.