Intro to ROACH

From AstroBaki
Revision as of 13:19, 24 February 2014 by Aparsons (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Interacting with BRAM files

When you collect data using the ROACH, you will be generating and copying BRAM files to your ugastro account. During this process you may try to look at the modification times of the BRAM file to check that you’ve written data to them, or perform other actions that treat the BRAM file like a file, and you’ll find that your results are not what you expect. This is because, in reality, the BRAM "files" are not actually files, but file-like buffers that map to memory on the FPGA. While things like modification times will not change, you can look at the contents of the file using

hd filename_bram

and will find the contents change over the course of you going through the commands below.

Using the ROACH to collect data

To collect data using the ROACH, execute the following commands:

  1.  ssh
    Access the ROACH directly to collect your data.
  2.  cd /boffiles
    Enter the directory where your bof files are stored
  3. [filename].bof &
    Execute a bof file to set up the firmware. If this doesn’t work then someone else has something running. When you run this step, you will see a job created as [#] PID. You will need that PID for the next step. If this message doesn’t come up, you can look up the PID using the command jobs.
  4.  cd /proc/PID/hw/ioreg
    Enter the directory where your data is stored.
  5.  echo -ne "\x00\x00\x00\x01" > trig
    Write 1 (in hex) to trig – this will start the sampler running, and will begin writing data to adc_bram .
  6.  echo -ne "\x00\x00\x00\x00" > trig
    Write 0 (in hex) to trig – this will stop the sampler. DO THIS BEFORE COPYING YOUR DATA. Trying to read (i.e. copy) the data while the computer is writing it to disk will lead to bad things!
  7.  scp .
    Copy your data over to one of your directories so you can begin working with it in python. To get the data into an array in python, use the function:
    with appropriate arguments.

Following these instructions should allow you to finish the ROACH portion of the lab without trouble. You should make the effort, however, to understand what everything means. You should be able to answer the following questions without pause:

  • What is a BRAM file really?
  • What is the analogous command to echo in python?
  • What do we mean by "in hex"?
  • What does the ">" do in steps 6 and 7?
  • How would you set lo_freq given the steps you’ve seen above?

After completing this portion of the lab, this knowledge will be assumed. With that said...happy sampling!