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.
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 :-
For Ubuntu 10.04 users, the Linaro toolchain repository must be enabled before the above installs. To do so :-
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 :-
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:
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:-
- For example, scp acquire firstname.lastname@example.org:/tmp . Note 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:
An 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:
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.