Search code examples
pythongnugnuradiognuradio-companionrtl-sdr

RTL2832U: Building a FM Receiver with GNC on Windows


I have been using SDRSharp for quite some time, listening to various stations, and I wanted to divulge more into how I can create tools using GNURadio.

I downloaded GNURadio Companion 3.8.0.0 and ran through the first three lessons.

I was following lessons from the official GNURadio.Wiki using the said V3 RTL-SDR Dongle (RTL2832U R820T2 TCX0 + BIAST + HF)

I have encountered trouble when creating the FM receiver as per lessons. Due to my hardware being different than what the lesson used, I did make a few revisions to the parameters of the flow graph.

  1. I used a sample rate of 2.4e6 (2.4 MS/s) which is the max stable sample rate of the said dongle
  2. I used the RTL-SDR Source Block as opposed to the UHD Block
  3. I set the stop frequency to 2e9 as this dongle will not go as high as 6GHz

After these changes, I assume all is set, and Generate/Execute the flow graph. I am greeted with the following error:

Executing: C:\Program Files\GNURadio-3.8\gr-python27\python.exe -u D:\GNURadio\TutorialsFromGNUDotOrg\FM_Radio_Receiver.py

gr-osmosdr 7da9989b (0.1.5git) gnuradio 3.8.0.0
built-in source types: file osmosdr rtl rtl_tcp uhd hackrf bladerf airspy redpitaya spyserver 
[INFO] [UHD] Win32; Microsoft Visual C++ version 14.0; Boost_106000; UHD_3.14.1.HEAD-0-g0347a6d8
[ERROR] [X300] X300 Network discovery error receive_from: An existing connection was forcibly closed by the remote host
[ERROR] [UHD] Device discovery error: receive_from: An existing connection was forcibly closed by the remote host

I know I can hit the frequencies in question, as I tune to them on SDRSharp. I also know the RTL-SDR Source block should be used as the documentation states:

 * RTL2832U based DVB-T dongles through librtlsdr

I start to think, maybe I don't have this library? I then open terminal and type python I proceed to check if librtlsdr is installed by typing:

import librtlsdr 

I get an import error, 1No module named librtlsdr I assume this is the problem, so I proceed topip install librtlsdr` and I am greeted with:

ERROR: Could not find a version that satisfies the requirement librtlsdr (from versions: none)
ERROR: No matching distribution found for librtlsdr

The latest GNU, 3.8.0.0, is using Python (Python 2.7.10) and my PIP Error shows:

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support

Is this missing library the problem, and if so, how can I import it so the GNC can work as expected?


Solution

  • For those who encounter this issue, be sure to enter a device argument. This was not a library issue. The message

    [ERROR] [UHD] Device discovery error: receive_from: An existing connection was forcibly closed by the remote host
    

    Was due to no device being found.

    I had to set rtl=0 in the Device argument section. See flow Graph below.

    Flow Graph

    New question, how can you determine what device argument you shall enter?