Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

The oRSC

pklabbers edited this page Jan 6, 2014 · 17 revisions

Setting up the oRSC for VME access and pattern writing

This is based on: https://github.com/uwcms/cms-calo-layer1/blob/master/orsc_ctp6_play_be/README.txt which isn't complete for novices. Make sure you have the latest version of the cms-calo-layer1 code from github.

Turn on the RCT crate if it is off. Log in to the PC connected to the oRSC with the USB-JTAG box and cables. You may want to boot the RCT caenRCTboot. After that:

cd trigger_code/cms-calo-layer1
source ./environment.sh
xmd
XMD% fpga -f bitfiles/orsc/top_be.bit -debugdevice deviceNr 1
XMD% connect mb mdm -debugdevice deviceNr 1   <-- This connects to the backend FPGA, the Spartan
XMD% rst                                      <-- This is necessary if you get an error attaching to the Spartan
XMD% dow orsc_ctp6_play_be/payload.elf        <-- This is the Embedded C for the Spartan
XMD% fpga -f bitfiles/orsc/top_fe.bit -debugdevice deviceNr 2
XMD% connect mb mdm -debugdevice deviceNr 2   <-- This connects to the frontend FPGA, the Kintex
XMD% rst                                      <-- This is necessary if you get an error attaching to the Kintex
XMD% dow orsc_ctp6_play_fe/payload.elf        <-- This is the Embedded C for the Kintex
XMD% run                                      <-- This starts the program on the Kintex
XMD% connect mb mdm -debugdevice deviceNr 1   <-- Switch back to the Spartan
XMD% run                                      <-- This starts the program on the Spartan

Now leave this open in a terminal window and connect with two other windows to the PC with the VME connection, hopefully the same PC. You can use this later to check the memories of the FPGAs.

In each window type source ~rctts/cactusprojects/rct/environment.sh. In one of the windows start vmedia. In the other you can run the oRSCPlayback code Sridhara wrote, or do other tasks with the oRSC. For more information do oRSCPlayback --help. For example oRSCPlayback --i --do --verify 2 does a increment pattern over VME and verifies the data twice.

Checking the memories using XMD

After you have done the above, you can check the memories of the FPGAs have been written correctly. If so, they should be identical. In the terminal window with XMD open:

XMD% connect mb mdm -debugdevice deviceNr 2   <-- Switch to the Kintex 
XMD% stop                                     <-- Stop the processor on the Kintex
XMD% mrd 0x10000000 256                       <-- Dump the memories on the Kintex
XMD% connect mb mdm -debugdevice deviceNr 1   <-- Switch to the Spartan
XMD% stop                                     <-- Stop the processor on the Spartan
XMD% mrd 0x10000000 256                       <-- Dump the memories on the Spartan

The dump should give the same results, or if you are having problems, you should see differences (and sometimes random bits written to the memories that you are not expecting, like a 0x2000 pattern).

Connecting to the backend serial USB console

Connect a USB cable from the front panel of the oRSC to the hub on the VME PC. When you connect it, you should be able to see the USB-to-serial device appear in the kernel log when you type dmesg.

ftdi_sio 1-3.1.1:1.0: FTDI USB Serial Device converter detected
drivers/usb/serial/ftdi_sio.c: Detected FT232BM
usb 1-3.1.1: FTDI USB Serial Device converter now attached to ttyUSB0

So now you now that you have a serial console on /dev/ttyUSB0. You can connect to it using screen.

sudo screen /dev/ttyUSB0

now you are connected to the oRSC BE UART console. printf statements will show up here. To escape from screen, hit Ctrl-A, then (capital) K.

Uploading oRSC bitfiles

Run make orscbitfiles from the main directory. It will connect via XMD and upload the bitfiles in bitfiles/orsc.

###VMEStream

The executable for VMEStream is vme2fd. Its purpose is to provide a convenient interface to the oRSC from the VMEPC.

####vme2fd

Two named pipes, orsc_send and orsc_recv are created on the VMEPC. They can be created using mkfifo. These can be read to and written from like any other UNIX file. They are essentially buffers. Data is written to the back of the buffer, and read (and removed) from the front of the buffer. Here is an example:

$ mkfifo test_pipe
$ echo "put that in your pipe and smoke it" > test_pipe

The process will hang. In a separate terminal, go to the same directory and do the following

$ cat test_pipe
put that in your pipe and smoke it

The echo command should then complete successfully. It should be noted that named pipes cannot be created in AFS. It will need to be done in a /scratch or /tmp directory at Wisconsin.

To run vme2fd, you run

./vme2fd orsc_send orsc_recv

Data going in to orsc_send will be sent to the oRSC, and orsc_recv contains data arriving from the oRSC.

Known Problems

If the PC has been rebooted, you may see the message:

ERROR: Connection to Board Failed

Failed to Open JTAG Cable
	Cable target is not connected to the host

to remedy this problem see https://github.com/uwcms/cms-calo-layer1/wiki/The-CTP6#known-problems--solutions

Latest Bit Files, Documentation:

See sub-directories in: cms904usr:~pamc/trigger_code/newest_bitfiles/orsc