Skip to main content

Red Pitaya - A quick guide for developers

The guide is intended for developers looking to work on the command line tools of the Red Pitaya.

All necessary steps required to build and run the tools are given. Linux users wil find it quite handy.

A helpful resource for Windows users is also included.

Guide is available as raw text (below) and as a pdf download.

----

Modifying measurement tools:

These tools are based on C code and are executed from the terminal / command line. The currently available utilities include:

 

1. Acquire: Signal acquistion from fast ADC inputs

 

2. Generate: Signal generation from fast DAC outputs

 

3. Calib: Adjustment of calibration coefficients of offsets and gains of data converters

 

4. Monitor: Access system registers

 

The most up-to-date codes are hosted on GitHub and can be copied to your PC for further editing. The following section illustrates the suggested steps leading to compiling and deploying your modifications.

 

Setup procedure:

Linux (any distrubution) is recommended as the operating system for any Red Pitaya specific development. The reasons being that setting up toolchains, build and make utilities are much more simplified via the default terminal in Linux. The steps below were performed on the 64-bit Ubuntu Linux 14.04 LTS (Trusty Tahr) platform.

  • Make your modifications to the code (the '.c' file) present within the utility's folder within the parent 'Test' directory. You can use any editor / IDE to do so. For Linux, Light Table is recommended (http://www.lighttable.com/).

  • Open the terminal (command line). Run the following to install the ARM GNU toolchain and build-essential utilty :-

sudo apt-get install build-essential

sudo apt-get install gcc-arm-linux-gnueabi

For Ubuntu 10.04 users, the Linaro toolchain repository must be enabled before the above installs. To do so :-

sudo add-apt-repository ppa:linaro-maintainers/toolchain

sudo apt-get update

  • Using the 'cd' command, navigate to the directory containing the tool code. If the original directory structure from GitHub is preserved, it should be RedPitaya/Test//. For example, RedPitaya/Test/acquire/.

  • Next, recompile using the command:

    make CROSS_COMPILE=arm-linux-gnueabi- clean all

    If you encounter any errors, first check that the make file is present in the directory and filename as 'Makefile' (case-sensitive). If error persists, re-install the build-essential tool and restart your computer.

  • To test your newly modified code, connect your Red Pitaya to the PC. Either a serial USB connection or SSH should suffice. To SSH, open terminal and type :-

    ssh root@

    Usually, is 192.168.1.100. However, you can manually configure a static IP and netmask from the 'edit connections' option within the Linux network icon. Select 'IPv4 Settings', 'manual' method, set address to '192.168.1.1', netmask to '255.255.255.0', press Enter button and save.

    You will be prompted for the password. Type in root and then press enter. Once connected you should see something like:

red-pitaya-a-quick-guide-for-developers-1_f405e77873d7f2d65f1560dcac639b238110f12a.png

  • The generated executable after compilation can be secure copied (scp) to the Red Pitaya's temp directory. Beforing running the scp command, make sure your terminal points to the computer folder where the re-compiled tool contents are present. Next, type:-

scp root@:/tmp

  • For example, scp acquire root@192.168.1.100:/tmpNote that the 'tmp' directory on the SD card is only used for testing without altering the original tool code.

Screen shot below shows the re-compiled acquire executable being copied:red-pitaya-a-quick-guide-for-developers-2_dda4d4f42f95640912e1b5c9e6cb04f0b3dc7026.png

red-pitaya-a-quick-guide-for-developers-3_c11318f08403e2fc8df47fe7e35cd2ce43cf2b6f.png

red-pitaya-a-quick-guide-for-developers-4_6c07c5757d0754c57f0d699b87ce7919b3efc2f6.pngAn example on modifying the tool is seen in the developer guide.

The screenshot shows the results after modifying the 'acquire' tool code to display the minimum, maximum and average values of the acquired signal:

Note: To avoid conflicts, command line utilities should NOT be used in parallel with any of the web applications.

 

For users on Windows:

A very helpful guide with links to the required toolchains and debugging plug-ins (on Eclipse IDE) can be found at:

http://gnuarmeclipse.livius.net/blog/install/

This will assist you in the cross-compilation process. Remember to follow the steps in order as per the website.

The executable can be pushed to the Pitaya using SSH as explained in the Linux version.

A curious mind with a passion for 3D CAD & rapid prototyping.