Difference between revisions of "User:Duggabe"

From GNU Radio
Jump to: navigation, search
(Install GNU Radio)
 
(91 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Guided Tutorials 2.0 outline:
+
<!-- InstallingGRFromSource_on_Raspberry_Pi -->
 +
These instructions have been tested with the <q>Raspberry Pi OS (32-bit) with desktop and recommended software</q> on a Raspberry Pi 3B+. A 32GB microSD card is recommended.
  
*  Beginner User Level:
+
== Set up a swap file ==
**      '''Very brief intro to GR, SDR, DSP''', i.e. this page- [[Guided Tutorial Introduction]].  We should reference to external sources for DSP/SDR background for those who need more
 
**      '''Intro to GR usage'''- GRC and flowgraphs, i.e. this page- [[Guided Tutorial GRC]]
 
**      '''Understanding sample rate, and how hardware and decimation/interpolation blocks impact it'''.  So [[Guided Tutorial Hardware Considerations]] and [[Guided Tutorial Extras Sample Rates]] and Barry's new writeup, but we can probably condense it down
 
**      '''Brief intro to PMTs, stream tags, and messaging passing''' (refer to Usage Manual for more info), i.e. this page- [[Guided Tutorial Programming Topics]]
 
**      '''Example practical usage of GR- PSK Demodulation''', i.e. this page- [[Guided Tutorial PSK Demodulation]]
 
* Intermediate User Level:
 
**  '''Understanding a flowgraph's python code''', content can come from [[Guided Tutorial GNU Radio in Python]]
 
**  '''Writing your own block''' (using Embedded Python Block), content can come from [[Guided Tutorial GNU Radio in Python]] and elsewhere
 
**  '''Writing the YAML/XML file for a block'''
 
**  '''Out of Tree modules''', should cover creation/installation and both Python and C++ blocks (but not writing them blocks themselves)
 
**  '''Writing blocks in C++'''
 
* Expert User Level:
 
**  '''Writing flowgraphs in C++''' (new to 3.8)
 
**    '''Volk- what it does, why it rocks, how to write new kernels'''
 
**  '''Working with ALSA and Pulse Audio'''
 
**  (any of the other really niche topics we already have tutorials for, i.e. the order isn't going to mean much)
 
* Developer Level:
 
**    Source level debugging C++ OOT modules with Visual Studio Code, see [[UsingVSCode]]
 
**    Building and Source level debugging C++ OOT modules with Eclipse, see [[UsingEclipse]]
 
**    Using Git with GNU Radio, see [[DevelopingWithGit]]
 
**    (anything else developer centric)
 
<br>
 
<hr>
 
= Draft Tutorials 2.0 =
 
  
==  Beginner User Level ==
+
A swap file will improve the compile time greatly.
These tutorials are designed to guide new GNU Radio users to a better understanding of the project.
 
* [[Guided_Tutorial_Introduction|'''A brief introduction to GNU Radio, SDR, and DSP''']]
 
* [[Guided_Tutorial_GRC|'''Intro to GNU Radio usage''']]
 
* [[Guided_Tutorial_Hardware_Considerations|'''Using GNU Radio with Hardware''']]
 
* [[Sample_Rate_Tutorial|'''Understanding sample rate''']]
 
* [[Guided_Tutorial_Programming_Topics|'''Brief intro to PMTs, Stream Tags, and Messaging Passing''']]
 
* [[Guided_Tutorial_PSK_Demodulation|'''Example Usage of GNU Radio: PSK Demodulation''']]
 
  
== Intermediate User Level ==
+
<pre>
* [[Flowgraph_Python_Code|'''Understanding a flowgraph's python code''']]
+
sudo fallocate -l 2G /swapfile
* [[Embedded_Python_Block|'''Writing your own block''' (using Embedded Python Block)]]
+
sudo chmod 600 /swapfile
**  '''Writing the YAML/XML file for a block'''
+
sudo mkswap /swapfile
* [[OutOfTreeModules|'''Out of Tree modules''']]
+
sudo swapon /swapfile
**  '''Writing blocks in C++'''
+
</pre>
 +
<p>To make the swap file permanent, add this line to /etc/fstab</p>
 +
<pre>
 +
/swapfile  none  swap  sw  0  0
 +
</pre>
  
== Expert User Level ==
+
== Load prerequisites ==
*  '''Writing flowgraphs in C++''' (new to 3.8)
 
* [[VOLK_Guide|'''Volk- what it does, why it rocks, how to write new kernels''']]
 
* [[ALSAPulseAudio|'''Working with ALSA and Pulse Audio''']]
 
* [[TutorialsSimulations|'''Simulations''']]
 
* [[TutorialsTaggedStreams|'''Tagged streams for variable-length PDUs''']]
 
* [[Basic OFDM Tutorial|'''Basics of OFDM''']]
 
  
== Developer Level ==
+
You may have some of these prerequisites already, but it doesn't hurt to get them again and check for the latest versions.
* [[UsingVSCode|'''Source level debugging C++ OOT modules with Visual Studio Code''']]
 
* [[UsingEclipse|'''Building and source level debugging C++ OOT modules with Eclipse''']]
 
* [[DevelopingWithGit|'''Git and GNU Radio''']]
 
* [[Octave|'''How to use Octave or Matlab with GNU Radio''']]
 
  
<br>
+
<pre>
<hr>
+
sudo apt update --allow-releaseinfo-change
<b>Content we will need to create</b>
+
sudo apt upgrade
<hr>
+
sudo apt install git cmake g++ libboost-all-dev libgmp-dev swig python3-numpy \
*  '''Writing the YAML/XML file for a block'''
+
python3-mako python3-sphinx python3-lxml doxygen libfftw3-dev \
*  '''Writing blocks in C++'''
+
libsdl1.2-dev libgsl-dev libqwt-qt5-dev libqt5opengl5-dev python3-pyqt5 \
*  '''Writing flowgraphs in C++''' (new to 3.8)
+
liblog4cpp5-dev libzmq3-dev python3-yaml python3-click python3-click-plugins \
 +
python3-zmq python3-scipy libpthread-stubs0-dev libusb-1.0-0 libusb-1.0-0-dev \
 +
libudev-dev python3-setuptools python-docutils build-essential liborc-0.4-0 liborc-0.4-dev
 +
</pre>
  
<br>
+
== Install UHD from source ==
<hr>
+
 
<b>Content which is not used from original Tutorials page</b>
+
If you want to use GNU Radio with a USRP, install the UHD package from source using the following instructions.
<hr>
+
UHD sits at the same level as GNU Radio as an independent driver, which gr-uhd references.  So if you want gr-uhd enabled, you <b>FIRST</b> must clone and install UHD.
* [[Guided_Tutorial_Extras_Sample_Rates#E2.3._A_Note_on_Resampling]]
+
 
* [[Guided_Tutorial_GNU_Radio_in_Python|Programming GNU Radio in Python]]
+
For this example, we will start in the home directory to parallel the steps in [[InstallingGR#To_install_system_wide]].
* [[Guided_Tutorial_GNU_Radio_in_C++|Programming GNU Radio in C++]]
+
 
* [[TutorialsCoreConcepts|Core concepts of GNU Radio applications]] - A must-read for everyone
+
<pre>cd ~/</pre>
* [[TutorialsWritePythonApplications|WritePythonApplications]] - A tutorial on how to develop Python GNU Radio applications.
+
 
* [[TutorialsQTGUI|QTGUI Tutorial]] - A tutorial on how to develop Python GNU Radio applications.
+
Clone the code into your home directory:
* [http://www.trondeau.com/gr-tutorial/ Tom Rondeau's gr-tutorial] - Some tutorials from the boss himself.
+
 
** [[OutOfTreeModulesConfig|Tutorial on how to configure OOT packages to find and link against GNU Radio]]
+
<pre>
* [[TutorialPythonFunctions|Writing a Python Function for GRC]]
+
git clone git://github.com/EttusResearch/uhd.git
* [[TutorialsDebugging|How to debug your applications]]
+
cd ~/uhd
* The GNU Radio Scheduler http://www.trondeau.com/blog/2013/9/15/explaining-the-gnu-radio-scheduler.html
+
</pre>
* [http://www.brainshark.com/SPS/vu?pi=zH8zQcV8dzAXPbz0 VOLK Introduction]
+
 
* [[TutorialsRemoteGUI|Remote GRC Operations]]
+
<b>Note:</b> In the following command, change <code>v3.15.0.0</code> to some other branch or tag if you want to build a different version.
* [[UsingVim|Using VIM for editing GNU Radio modules]]
+
<pre>
* [[UsingCB|Using Code::Blocks for editing GNU Radio modules]]
+
git tag -l
 +
git checkout v3.15.0.0
 +
</pre>
 +
 
 +
<b>Note:</b> Unlike most build processes, UHD builds under the <code>host</code> directory.
 +
<pre>
 +
cd host
 +
mkdir build
 +
cd build
 +
</pre>
 +
 
 +
<b>Note:</b> In the following command, we will use <code>-DCMAKE_INSTALL_PREFIX=/usr/local</code> to install UHD into the same prefix as GNU Radio. When compiling for ARM platforms, the assumption is made that NEON extensions are available if the arm_neon.h header is found. However, for platforms such as Raspberry Pi, one must specify -DNEON_SIMD_ENABLE=OFF in the following command.
 +
 
 +
<pre>
 +
cmake -DNEON_SIMD_ENABLE=OFF -DCMAKE_INSTALL_PREFIX=/usr/local ../
 +
</pre>
 +
 
 +
<b>Note:</b> In the following command, if your computer's CPU has multiple cores, you can use the argument <code>-j#</code> to speed compilation; <br> e.g., <code>make -j3</code> will use 3 threads in the build. Specify at least one less than the number of CPU cores so the system does not appear to 'freeze' during the build. If not specified, then a single thread is used for the build; this is not necessarily a bad thing, but it will take roughly 2 times as long to build as using 2 threads, and roughly 3 times as long to build as using 3 threads.<br>
 +
 
 +
<pre>
 +
make -j3
 +
make test
 +
sudo make install
 +
</pre>
 +
 
 +
If you're running Linux, then always do the following command after installing any library:
 +
 
 +
<pre>sudo ldconfig</pre>
 +
 
 +
You can now download the UHD FPGA Images for this installation.
 +
<pre>
 +
sudo uhd_images_downloader
 +
</pre>
 +
 
 +
On Linux, udev handles USB plug and unplug events. The following commands install a udev rule so that non-root users may access the device.
 +
<pre>
 +
cd ~/uhd/host/utils
 +
sudo cp uhd-usrp.rules /etc/udev/rules.d/
 +
sudo udevadm control --reload-rules
 +
sudo udevadm trigger
 +
</pre>
 +
 
 +
The installation of UHD is now complete. At this point, connect the USRP to the host computer and run:
 +
<pre>
 +
uhd_usrp_probe
 +
</pre>
 +
 
 +
== Install GNU Radio ==
 +
 
 +
<p><b>The next steps will take two or more hours. Be patient. The terminal does show the progress.</b></p>
 +
 
 +
Click [[InstallingGR#From_Source]] to go to the install instructions.

Latest revision as of 01:46, 7 July 2020

These instructions have been tested with the Raspberry Pi OS (32-bit) with desktop and recommended software on a Raspberry Pi 3B+. A 32GB microSD card is recommended.

Set up a swap file[edit]

A swap file will improve the compile time greatly.

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

To make the swap file permanent, add this line to /etc/fstab

/swapfile  none  swap  sw  0  0

Load prerequisites[edit]

You may have some of these prerequisites already, but it doesn't hurt to get them again and check for the latest versions.

sudo apt update --allow-releaseinfo-change
sudo apt upgrade
sudo apt install git cmake g++ libboost-all-dev libgmp-dev swig python3-numpy \
python3-mako python3-sphinx python3-lxml doxygen libfftw3-dev \
libsdl1.2-dev libgsl-dev libqwt-qt5-dev libqt5opengl5-dev python3-pyqt5 \
liblog4cpp5-dev libzmq3-dev python3-yaml python3-click python3-click-plugins \
python3-zmq python3-scipy libpthread-stubs0-dev libusb-1.0-0 libusb-1.0-0-dev \
libudev-dev python3-setuptools python-docutils build-essential liborc-0.4-0 liborc-0.4-dev

Install UHD from source[edit]

If you want to use GNU Radio with a USRP, install the UHD package from source using the following instructions. UHD sits at the same level as GNU Radio as an independent driver, which gr-uhd references. So if you want gr-uhd enabled, you FIRST must clone and install UHD.

For this example, we will start in the home directory to parallel the steps in InstallingGR#To_install_system_wide.

cd ~/

Clone the code into your home directory:

git clone git://github.com/EttusResearch/uhd.git
cd ~/uhd

Note: In the following command, change v3.15.0.0 to some other branch or tag if you want to build a different version.

git tag -l
git checkout v3.15.0.0

Note: Unlike most build processes, UHD builds under the host directory.

cd host
mkdir build
cd build

Note: In the following command, we will use -DCMAKE_INSTALL_PREFIX=/usr/local to install UHD into the same prefix as GNU Radio. When compiling for ARM platforms, the assumption is made that NEON extensions are available if the arm_neon.h header is found. However, for platforms such as Raspberry Pi, one must specify -DNEON_SIMD_ENABLE=OFF in the following command.

cmake -DNEON_SIMD_ENABLE=OFF -DCMAKE_INSTALL_PREFIX=/usr/local ../

Note: In the following command, if your computer's CPU has multiple cores, you can use the argument -j# to speed compilation;
e.g., make -j3 will use 3 threads in the build. Specify at least one less than the number of CPU cores so the system does not appear to 'freeze' during the build. If not specified, then a single thread is used for the build; this is not necessarily a bad thing, but it will take roughly 2 times as long to build as using 2 threads, and roughly 3 times as long to build as using 3 threads.

make -j3
make test
sudo make install

If you're running Linux, then always do the following command after installing any library:

sudo ldconfig

You can now download the UHD FPGA Images for this installation.

sudo uhd_images_downloader

On Linux, udev handles USB plug and unplug events. The following commands install a udev rule so that non-root users may access the device.

cd ~/uhd/host/utils
sudo cp uhd-usrp.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger

The installation of UHD is now complete. At this point, connect the USRP to the host computer and run:

uhd_usrp_probe

Install GNU Radio[edit]

The next steps will take two or more hours. Be patient. The terminal does show the progress.

Click InstallingGR#From_Source to go to the install instructions.