|
|
# GNU Radio
|
|
|
|
|
|
GNU Radio is an open-source framework for creating signal processing applications that run on general-purpose processors. It is widely used in research, industry, and academia. and can be combined with SDR hardware to create real-world communication systems.
|
|
|
|
|
|
- [GNU Radio Project](https://gnuradio.org)
|
|
|
|
|
|
GNU Radio will be the main framework supported in CDC for implementing your design project solutions.
|
|
|
|
|
|
## Documentation
|
|
|
|
|
|
There is a large amount of documentation available for GNU Radio.
|
|
|
|
|
|
- [GNU Radio Wiki](https://wiki.gnuradio.org)
|
|
|
- [GNU Radio Usage Manual](https://wiki.gnuradio.org/index.php?title=Usage_Manual)
|
|
|
- [GNU Radio C++ API](https://www.gnuradio.org/doc/doxygen/)
|
|
|
- [GNU Radio source code on Github](https://github.com/gnuradio/gnuradio)
|
|
|
|
|
|
In particular, the GNU Radio Wiki has a suite of useful beginner and intermedia [tutorials](https://wiki.gnuradio.org/index.php?title=Tutorials), many of which are referenced below. These should be your starting point to better understand concepts important in developing GNU Radio applications.
|
|
|
|
|
|
The wiki also has documentation for many GNU Radio signal processing blocks which explain their configuration and operation. Unfortunately, not all of the documentation is complete, so at times you may need to investigate a block or object's source code should you want to use it. See the Python and C++ sections below for more information on understanding GNU Radio blocks.
|
|
|
|
|
|
## Flowgraphs
|
|
|
|
|
|
Applications are created in GNU Radio by constructing flowgraphs, which are collections of interconnected signal processing blocks. The specific blocks used, their configuration, and the manner in which they are connected dictates the functionality of your application. Flowgraphs can be created graphically, in Python, or in C++.
|
|
|
|
|
|

|
|
|
|
|
|
Blocks in a flowgraph perform defined signal processing operations, with source blocks generating data, other blocks processing data, and sink blocks consuming data. In the above example, two *Signal Source* blocks generate cosine waveforms with frequencies of 350 and 440 Hz, the *Add* block , and then the wavefor is outputted to the computer's soundcard
|
|
|
|
|
|
Once execution of a flowgraph is started, the GNU Radio scheduler handles scheduling block processing and piping the generated data from the output port of an upstream block block to the input port of the next downstream block. This results in data streams flowing through the graph, where streams of data can be of different types (bytes, integers, floats, complex, etc.). For real-time operation, all blocks in the flowgraph must be able to keep up with the rate of arriving data on their input ports. GNU Radio functionality can be extended by writing new blocks in either Python or C++.
|
|
|
|
|
|
See [What is GNU Radio](https://wiki.gnuradio.org/index.php?title=What_Is_GNU_Radio) for an additional overview.
|
|
|
|
|
|
## The GNU Radio Companion (GRC)
|
|
|
|
|
|
The GNU Radio Companion is a graphical tool for creating and running GNU Radio flowgraphs, and can be used in very much like Simulink or LabVIEW. It is the easiet way to create new applications when the libary of existing signal processing blocks is sufficient for your need.
|
|
|
|
|
|

|
|
|
|
|
|
See the following tutorials GRC tutorials:
|
|
|
- [Your First Flowgraph](https://wiki.gnuradio.org/index.php?title=Your_First_Flowgraph)
|
|
|
- [Python Variables in GRC](https://wiki.gnuradio.org/index.php?title=Python_Variables_in_GRC)
|
|
|
- [Runtime Updating Variables](https://wiki.gnuradio.org/index.php?title=Runtime_Updating_Variables)
|
|
|
- [Signal Data Types](https://wiki.gnuradio.org/index.php?title=Signal_Data_Types)
|
|
|
- [Converting Data Types](https://wiki.gnuradio.org/index.php?title=Converting_Data_Types)
|
|
|
- [Packing Bits](https://wiki.gnuradio.org/index.php?title=Packing_Bits)
|
|
|
- [Streams and Vectors](https://wiki.gnuradio.org/index.php?title=Streams_and_Vectors)
|
|
|
|
|
|
It is often convenient to make commonly used block combinations into a *hierarchical block* that can be imported into a flowgraph as a single block. To do so in GRC, see:
|
|
|
- [Hier_Blocks and Parameters](https://wiki.gnuradio.org/index.php?title=Hier_Blocks_and_Parameters)
|
|
|
|
|
|
## Python Flowgraphs and Blocks
|
|
|
|
|
|
The Python programming language is one of two languages used within GNU Radio. As an interpreted language with intuitive syntax, it is well-suited for specifying flowgraphs to create applications. In fact, under the hood GRC is just generating a Python script to instantiates your designed flowgraph. Flowgraphs can be defined directly in Python instead.
|
|
|
|
|
|

|
|
|
|
|
|
See the following GNU Radio tutorial on understanding a flowgraph's Python code:
|
|
|
- [Flowgraph Python Code](https://wiki.gnuradio.org/index.php?title=Flowgraph_Python_Code)
|
|
|
|
|
|
Python is also quick and convenient for implementing some signal processing blocks in GNU Radio, but these should generally be blocks that are not computationally intensive. As an interpreted language, Python will generally be slower than compile C++ code, the other language used in GNU Radio.
|
|
|
|
|
|
See the following GNU Radio tutorials on creating Python blocks:
|
|
|
- [Creating Your First Block](https://wiki.gnuradio.org/index.php?title=Creating_Your_First_Block)
|
|
|
- [Python Block with Vectors](https://wiki.gnuradio.org/index.php?title=Python_Block_with_Vectors)
|
|
|
|
|
|
## Out-of-tree Modules and C++ Blocks
|
|
|
|
|
|
As an interpreted language, Python is very flexibile and easy to program in but may be too slow for creating blocks that must perform a large amount of computations. Instead, the bulk of blocks in GNU Radio are implemented in C++ for execution speed. You can create your own C++ signal processing blocks, but this is more challenging than writing blocks in Python. GNU Radio functionality is extended through the creation of Out-of-Tree (OOT) modules that also conveniently setup the details you need to successfully compile new C++ blocks.
|
|
|
|
|
|
See the GNU Radio following tutorials on out-of-tree modules and writig C++ blocks:
|
|
|
|
|
|
- [Out of Tree Modules](https://wiki.gnuradio.org/index.php?title=OutOfTreeModules)
|
|
|
- [Writing blocks in C++](https://wiki.gnuradio.org/index.php?title=Guided_Tutorial_GNU_Radio_in_C%2B%2B)
|
|
|
- [YAML GRC](https://wiki.gnuradio.org/index.php?title=YAML_GRC)
|
|
|
|
|
|
## Advanced GNU Radio Concepts
|
|
|
|
|
|
### Polymorphic Types (PMTs)
|
|
|
|
|
|
Polymorphic Types (PMTs) are a GNU Radio construct used to represent concrete data types (bytes, integers, vectors, etc.) in an abstract way. They are a fundamental enabler of passing data between blocks through the use of stream tags and message passing.
|
|
|
|
|
|
See the following GNU Radio tutorial:
|
|
|
- [Polymorphic Types (PMTs)](https://wiki.gnuradio.org/index.php?title=Polymorphic_Types_(PMTs))
|
|
|
|
|
|
### Stream Tags
|
|
|
|
|
|
Stream tags allow control information to be attached to or *tagged* to a specific data sample in a given stream. This is useful for passing control or configuration information to downstream blocks with an associated time validity.
|
|
|
|
|
|
See the following GNU Radio tutorials on stream tags:
|
|
|
- [Python Block Tags](https://wiki.gnuradio.org/index.php?title=Python_Block_Tags)
|
|
|
- [Stream Tags](https://wiki.gnuradio.org/index.php?title=Stream_Tags)
|
|
|
|
|
|
### Message Passing
|
|
|
|
|
|
By default, data passes between blocks as a continuous stream of samples. Many functions in communication systems, however, are better modeled by the asynchronous passing of data blocks of a given size. These data blocks are called messages in GNU Radio, and *message passing* is an alternative way of passing data or control information between blocks. Message passing also simplifies the interaction of external entities with a flowgraph.
|
|
|
|
|
|
See the following GNU Radio tutorials on message passing:
|
|
|
- [Python Block Message Passing](https://wiki.gnuradio.org/index.php?title=Python_Block_Message_Passing)
|
|
|
- [Message Passing](https://wiki.gnuradio.org/index.php?title=Message_Passing)
|
|
|
|
|
|
### Profiling
|
|
|
|
|
|
- [Performance Counters](https://wiki.gnuradio.org/index.php?title=Performance_Counters)
|
|
|
|
|
|
### VOLK
|
|
|
|
|
|
- [VOLK Guide](https://wiki.gnuradio.org/index.php?title=VOLK_Guide) |