Intro to ROACH
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
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:
- Access the ROACH directly to collect your data.
- Enter the directory where your bof files are stored
- 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.
- Enter the directory where your data is stored.
- Write 1 (in hex) to trig – this will start the sampler running, and will begin writing data to adc_bram .
echo -ne "\x00\x00\x00\x01" > 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!
echo -ne "\x00\x00\x00\x00" > trig
- 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:
scp email@example.com:/proc/PID/hw/ioreg/adc_bram .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!