Software-defined radio (SDR) platforms, when used with the right development tools, enable the rapid prototyping of new radio waveforms. Nutaq offers a complete model-based design suite for SDR platforms (e.g. the PicoSDR) that provides hardware abstraction and simplifies development. The Nutaq Model-Based Design Kit (MBDK) consists of an ensemble of blocks that can be connected with Xilinx System generator blocks within the Simulink environment. The block set automatically generates the HDL and netlist from flow graphs for the system’s FPGA. It also automatically manages the different device peripherals like radio transceivers, RAM memory, and the PCIe or GigE interface to a PC. Included as part of the MBDK block set are two blocks dedicated to interfacing with the on-board RAM, making it easy for developers to use it for recording and/or playing back of pre-modulated radio waveforms or raw data.
The MBDK record and playback block set is covered in detail in a previous blog.
Some developers prefer to prototype their radio waveform on an external computer rather than from the on-board FPGA. This workflow is also supported on Nutaq SDR platforms like the PicoSDR. For this platform, GNU Radio can be used as model-based development environment. GNU Radio offers similar record and playback functionality to the Nutaq blocks. You can use the PicoSDR to transmit a pre-modulated waveform from a file on your PC as well as record an RF signal received from the PicoSDR to a file. To accomplish this, you can use the following blocks from the GNU Radio library: file source and file sink.
GNU Radio File Source and File Sink blocks
The File Source and File Sink blocks are part of the default GNU Radio library and can be dragged and dropped into the GNU Radio Companion workspace.
The File Source block can be used in combination with other blocks, namely the Radio420 Sink block. In the following example, the File Source block reads the waveform stored in the form of a raw binary file on disk (myBin.bin). The GNU library’s Throttle block is used to maintain a constant real-time data rate of 51.2 ksps of IQ data. The library’s Rationnal Resampler block is used to up-sample the waveform data stream to match the sampling rate of the PicoSDR’s radio IQ DACs. The sampling rate for the PicoSDR DACs is set from the Radio420 GigE: Global block to 10.24 MSPS IQ interleaved, which means 5.12 MSPS for the I DAC and 5.12 MSPS for the Q DAC. The Rationnal Resampler is set with an interpolation rate of 100 so that the waveform data stream at 51.2 ksps interleaved gets up-sampled to 5.12 MSPS interleaved. Finally, the Radio420: GigE Sink Interleaved block is used to send the data out to the PicoSDR via the PC’s GigE interface. In this example, the radio transceiver of the PicoSDR (Radio420M) will up-convert the waveform to a carrier frequency of 900 MHz. The carrier frequency is configurable from the Radio420 GigE: Global block. The File Source block’s Repeat parameter will playback the waveform in a continuous loop when set.
Alternatively, the File Sink block could use Radio420 GigE: Source Deinterleaved to store the IQ data received and down-converted by the Radio420 capture. The File Sink block writes the samples to a binary file in little-endian format. The data type is configurable from the File Source or Sink block.
Five options are available for the data type parameter:
- complex64: IEEE 754 single-precision floats, 4 bytes per sample, real and imaginary
- float32: IEEE 754 single-precision floats, 4 bytes per sample
- int32: signed integer, 4 bytes per sample
- int16: signed integer, 2 bytes per sample
- int8: signed integer, 1 byte per sample
The appearance of the block changes based on the selected data type. This follows the data type color code used by GNU Radio Companion.
File Sink block with data type set to complex64
File Sink block with data type set to float32
File Sink block with data type set to int32
File Sink block with data type set to int16
File Sink block with data type set to int8
The following Python Scripy command reads data from the raw binary file (myFile.bin). The type, complex64, can be replaced with the chosen data type.
f = scipy.fromfile(open(“myFile.bin”), dtype=scipy.complex64)
Alternatively, the fread function of Matlab can be used to load the files to the Matlab workspace for offline post-processing or plotting.
File Sink block metadata
During Hackfest1211, developers worked on adding a meta-data structure to annotate files generated from the File Sink block. A File Sink block was created with header information along with a simple Python script to parse it. Version 0 of the metadata files included the blocks File Meta Sink and File Meta Source.
The File Meta Sink block creates a file and writes the IQ data to it, along with headers of meta-data such as the data type. The File Meta Source block is capable of reading out the metadata it needs, such as the data type, in order to automatically stream the IQ found in the file to a GNU Radio flow graph.
The Doxygen documentation for Meta File Source and Meta File Sink states:
These files represent data as binary information in between meta-data headers. The headers contain information about the type of data and properties of the data in the next segment of samples. The information includes:
rx_rate (double): sample rate of data. rx_time (uint64_t, double): time stamp of first sample in segment. size (uint32_t): item size in bytes. type (gr_file_types as int32_t): data type. cplx (bool): Is data complex? strt (uint64_t): Starting byte of data in this segment. bytes (uint64_t): Size in bytes of data in this segment.
When using the Nutaq PicoSDR for the playback or recording of radio waveforms, users have several options. They can use the on-board Virtex-6 FPGA along with the Nutaq MBDK record and playback blocks. Alternatively, they can use an external PC workflow enabled by GNU Radio. The GNU Radio File Source block reads a waveform from a file for transmission and the File Sink block stores the received waveform to a file.