Testing Clock Cards

From MCEWiki

Setup

The following equipments are needed:

  • mas PC: An ubuntu-based PC with ARC-64 PCI card installed an running mas software.
  • A fully populated 5-MDM MCE subrack with Device under test (DUT) plugged into this backplane during testing.
  • fibre-optic cable: connects mas-PC to Clock Card.
  • set of Linear supplies to power up the cards. (3V, 4.5V, 6.2V, -6.2V)
  • Altera USB programmer: attached to the JTAG connector in Clock card front panel.
  • PC with Quartus installed: used to program FPGA and configuration devices on Readout Card.
  • Sync Box with a fiber-optic cable connecting a fiber output to the sync input of the Clock Card.

If you have all the above and if your DUT has already been smoke tested, you are ready to start:

  1. Connect all the cables.
  2. unplug all cards from Subrack except Clock card unit under test, (just pull out, so they are not inserted)
  3. Power on the MCE and if the clock card is not progammed, the red led should be on.

Configuring Clock Card

The FPGA on clock card (U7) can be configured from one of the two on-board configuration devices (EPC16): A factory configuration device (U18) and an application configuration device (U17). The factory configuration is loaded upon power up and hard reset. The application configuration is loaded by issuing a command on the mas PC: wb cc config_app 1.

The FPGA and the application configuration device can be programmed through the front-panel JTAG port while the factory configuration device can be programmed from the on-board connector.

Programming via Front-panel JTAG connector

  1. Load FPGA firmware using Quartus. Firmware is located at http://e-mode.phas.ubc.ca/mce_firmware/. Run auto-detect and you should see list of devices. The part at the bottom of the list corresponts to Clock card FPGA and the part above it in the list is EPC16 or the "application configuration device". Right click on the row and choose a file to program. Load following firmware from the above directory: CC firmware 5.0.e, cc_v0500000e_15may2012.sof for FPGA and cc_v0500000e_15may2012.pof for EPC16. Then checkmark the program button for both devices and press start programming. The green LED should come up when programming is done.
  2. If the tx/rx fibers are connected right, the red LED is off and the green LED is on. If the Sync Box fiber is connected and Sync Box is on, then the amber LED is also off.
  3. Now make sure that the card communicates with the PC.
 mce_cmd -x rb cc fw_rev

and you will see:

 Line   0 : ok : 0x500000e

So far, you confirmed that FPGA is programmed successfully and the fiber interface is working.

Now, proceed to programming the factory-configuration device.

Programming via on-board P2 JTAG connector

  1. Now turn off the MCE,
  2. unplug the Clock Card and move the JTAG programming cable from the front-panel to the on-board P2 connector. plug the card back in and let the cable slide through the slot.
  3. Power on the MCE.
  4. In Quartus, press on auto-detect and you should only see two devices listed. Choose the same pof file for EPC16.

cc_v0500000e_15may2012.pof

  1. Turn off the MCE, unplug the card and remove the JTAG cable. Then re-insert the card and power on the MCE.
  2. The green LED should come on. Ths confirms that factory configuraiton is loaded successfully upon power up.
  1. Verify that the application configuration can be loaded successfuly:
mce_cmd -x wb cc config_app 1

The Green LED should momentarily go off, the red LED should momentarily turn on and then when firmware is loaded, green LED would be on and red is off. This shows that application configuration is loaded successfully.

  • Note 1: Sometimes the reconfiguration time exceeds the timeout period and you get an "MCE timeout" message. Issue another command like rb cc fw_rev to verify that the FPGA was reconfigured successfully.
  • Note 2: Sometimes when you switch between external and internal clock, you get an "Unexpected interface (DSP) error" caused by an accidental character transmit on the fiber during configuration switch over, if this happens, you need to reset the PCI card by issuing: mce_cmd -x dsp_reset.

Testing General Features (card_all_test)

The following script is used to test features that are common to all MCE cards: LED, silicon id, card_type, PCB revision, LEDs, dip switches, etc.

On mas PC, type:

card_all_test -c cc SCC-NNN

The output should look like:

 ****** Check to make sure the LEDs on the target card switched status! ****
 Unit Under Test  :  CC
 Serial Number    :  SCC-069
 Firmware Revision:  5.0.e
 card_id          :  0x20be502
 slot_id          :  [8]
 card_type        :  3
 card_rev         :  D
 fpga_temp        :  34 C pass
 card_temp        :  28 C pass
 results are in   :  /data/cryo/current_data/SCC-069_1285959943_all_test

copy the results into the test logfile and record the card_id on MCE CARD Serial-Number Lookup

testing communication with backplane silicon_id chip

issue following commands to make sure clock card can read the silicon_id and temperature from the id chip on the backplane:

mce_cmd -x rb cc box_id
mce_cmd -x rb cc box_temp

record the results in logfile

lvds rx/tx or command/reply lines

run mce_status -s|grep fw_rev and you should see all cards listed, make sure there are 9 replies. cc fw_rev : 0x500000e rc1 fw_rev : 0x5010005 rc2 fw_rev : 0x5010005 rc3 fw_rev : 0x5010005 rc4 fw_rev : 0x5010005 bc1 fw_rev : 0x5000000 bc2 fw_rev : 0x5000000 bc3 fw_rev : 0x5000000 ac fw_rev : 0x5000004

If any of the replies is ERROR and the card is present, then check you need to debug the corresponding lvds_rx on Clock Card.

Record the result in logfile.

Sync Box communication and clock circuitry

Check the amber LED and it should be on if the Sync input is not connected or if the Sync Box is off. Check to see the LED go off when the Sync Box is turned on and the fiber cable is connected to the Sync input. Now on mas PC, issue the following commands:

wb cc select_clk 1
wb cc use_dv 2
wb cc use_sync 2
rb cc select_clk 

The last command should return 1 which means the Clock Card is still running from the Sync Box clk.

Note: Sometimes when you switch between external and internal clock, you get an "Unexpected interface (DSP) error" caused by an accidental character transmit on the fiber, if this happens, you need to reset the PCI card by issuing: mce_cmd -x dsp_reset.

Take some data to verify that the manchester decoder is working:

mce_run test_data_xxxx 100 1

check to see whether the file exist and has some data. Then unplug the Sync input and issue:

wb cc led 7

no reply should come back. Now issue

rb cc select_clk 

and the result should be 0 which means the clock has fallen back on the internal clock on clock card.

reset switch and brst line

Press the switch on the front panel and you should see the green LED go off and red LED go on indicating configuration file reloaded. After few seconds, the red one should go off and green one come back on indicating that the reset switch works properly.

To make sure brst line on Clock Card is working, toggle the LEDs from their default state and then issue a reset command and make sure the LEDs go to their default state (only Green on) which would mean the reset worked.

wb rc1 led 7 

(red and amber LED go on, green goes off)

mce_cmd -x mce_reset

log results