Reproducing OCRA

Reproducing - OCRA spectrometer:

OCRA is an Open-source Console for Real-time Acquisition in MRI. Using Red Pitaya board makes this controller system low cost and under $500.

Prior experience of the reproducer:

Never used Linux, terminal, Vivado, or FPGAs before the project. Basic level of Python and C programming.

Employed resources:

• Hardware: Red Pitaya (STEMLab 125-14 v1.1), Ethernet cable (crossed type), 4Gb SD card, Desktop/Laptop.
• Software: Linux (Ubuntu 18.4), Vivado HLx 2018.3 WebPACK, Python 3

Overview of the reproduction process flow:

Familiarizing with the Red Pitaya
• Download and test original Red Pitaya image.
• Download, build and test Pavel’s LED-blinker project (link).
• Download, build and test Pavel’s pulse NMR project.

Building the OCRA project
• Building the SD image for the Red Pitaya.
• Connecting to the Red Pitaya through the python GUI.
• Testing inputs and outputs in a predefined pulse sequence.

Step by step reproduction process:

1. Unlike in the resources provided by Pavel, Ubuntu was installed on a “physical machine” instead of a virtual machine because the later created the next challenges:

• VM performance can be slower - After installing Vivado and pre-requirements such as ARM cross compiler and build-essential, virtual machine became dramatically slow. This happened every time after running the virtual machine.
Virtual machines contains an entire operating system, this means the computer RAM splits between more than one operating system. Ubuntu requires at least 512MB memory size, but the more memory allocates, the faster and more powerful the virtual machine will be. When you have limited memory and you are running applications using more memory to process, the memory that not currently in used, swap into disk. This makes the system much slower.

• Accessing the peripherals from the VM – Setting up the VM to access, in our case, the USB port which connects to the SD card is not impossible, but add extra difficulties.
This access is necessary to copy the *.img file to the SD card which is instructed here, after inserting the SD card, following the df –h command, the available disk should be found, divided in two partitions with the names /dev/sdxN (which N is a number like 1,2,etc.)
In our case, unfortunately when the SD card is inserted, the disk is not known with the supposed name in virtual machine, thus is not easy to be found.

• Ethernet connection to the Red Pitaya and internet – If you are using a desktop with no WIFI connection, you will need to add an extra Ethernet adapter to be able to connect to the Red Pitaya and Internet at the same time. There seem to be a way to connect with the Red Pitaya via the USB which we haven’t tried as it adds extra complexity.

2. Created an account here to allow me to download Xilinx Vivado

3. Downloaded and installed Vivado HLx 2018.3: WebPACK and Editions - Linux Self Extracting Web Installer
Vivado HLx 2018.3: WebPACK and Editions - Linux Self Extracting Web Installer
(BIN - 112.56 MB) here

4. I used this link as it is very well explained about how to install Linux on virtual machine, installing Vivado via terminal and how to program some projects and observe the expected changes on Red-Pitaya local page

5. Following the above link, I became familiar with the FPGA board and red pitaya performance. As OCRA has followed Pavel Demin’s Pulsed NMR project, before starting OCRA’s instruction, I should get familiar with Pavel's projects. Consequently, first I followed the “LED Blinker” project.

Tried Pavel’s LED Blinker

First installed the required package:




Then set up the Vivado environment and cloned the source code repository:


Here I built boot.bin, devicetree.dtb and uImage:


Here to know the name of the device on my SD card I used the following command once before inserting the SD card,


and once after inserting the SD card.


So as it can be seen by df -h I found the available disk on the SD card.

Then needed to build a bootable SD card:
$ sudo sh scripts/debian.sh /dev/sdb

To copy the *.img file e SD card followed this link.
$ sudo umount /dev/sdb1 /dev/sdb2

$ sudo dd bs=1M if=red_pitaya_image_file.img of=/dev/sdb

Removed the SD card and insert it to the Red Pitaya, when we connect the Red Pitaya, it should be blinking.

Next building Pulse Nuclear Magnetic Resonance.

Contributors to this page: admin and azin .
Page last modified on Friday May 10, 2019 08:21:16 GMT-0000 by admin.