RTL Dongle Setup

Specs

sample rate / bw

226k-300k
901k-3.2M although ~2.4M

Device Driver

plug the thing

tail -F /var/log/kern.log
lsusb

E4000 gives

Product: RTL2838UHIDIR
Bus 001 Device 005: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T

assuming two devices, 0 and 1.

using binary packages,

apt install rtl-sdr librtlsdr0 librtlsdr-dev

OR from source,

apt install cmake
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr
mkdir build
cd build
cmake ../ -DDETACH_KERNEL_DRIVER=ON -DINSTALL_UDEV_RULES=ON
make
make install
echo '/usr/local/lib' >> /etc/ld.so.conf
ldconfig

check supported gain values

rtl_test

e.g.

Using device 0: Generic RTL2832U OEM
Found Elonics E4000 tuner
Supported gain values (14): -1.0 1.5 4.0 6.5 9.0 11.5 14.0 16.5 19.0 21.5 24.0 29.0 34.0 42.0 
Sampling at 2048000 S/s.

Calibrate RTL

apt install fftw3-dev librtlsdr-dev
git clone https://github.com/steve-m/kalibrate-rtl.git
cd kalibrate-rtl/
./bootstrap
#make distclean
./configure
make
cd ../

note. no make install – avoid conflicts with other kal flavors

check version,

kalibrate-rtl/src/kal | head -1
error: must enter channel or frequency
kalibrate v0.4.1-rtl, Copyright (c) 2010, Joshua Lackey

Read the serial number from the device. Is there hints on the PPMs already?

rtl_eeprom -d 0
rtl_eeprom -d 1

so if you already know the PPM that was previously accurate,

ppm=+-PPM_HERE
ppm2=+-PPM_HERE

Searching for GSM downlink channels.

kalibrate-rtl/src/kal -s GSM900 -g 34 -d 0 -e "$ppm"
kalibrate-rtl/src/kal -s GSM900 -g 34 -d 1 -e "$ppm2"
#-s EGSM -g 42

Define the strongest BTS – or the known operator/channel you like,

arfcn=ARFCN_HERE
echo $arfcn

and finally calibrate against it

kalibrate-rtl/src/kal -c $arfcn -g 34 -d 0 -e "$ppm"
kalibrate-rtl/src/kal -c $arfcn -g 34 -d 1 -e "$ppm2"

run it a few times and average it. You can now re-define the PPM error accordingly,

ppm=+-PPM_HERE
ppm2=+-PPM_HERE

for further use gr-gsm, and eventually hard-code it as S/N onto the device for convenience,

rtl_eeprom -d 0
rtl_eeprom -d 1

rtl_eeprom -s $ppm -d 0
rtl_eeprom -s $ppm2 -d 1

apparently - no need to replug the device,

rtl_eeprom -d 0
rtl_eeprom -d 1

Inspectrum

It’s nice to keep 2msps to compare with HackRF’s results (its minimum bandwidth)

rtl_sdr -f `arfcncalc -a $arfcn -d` -s 2e6 -g auto -p "$ppm" air.cu8

inspectrum --rate 2e6 air.cu8

Resources

osmocom/rtl-sdr Mirror https://github.com/osmocom/rtl-sdr

steve-m/kalibrate-rtl https://github.com/steve-m/kalibrate-rtl

ARFCN tool, Kalibrate tool and others – setup https://ferrancasanovas.wordpress.com/2014/01/27/arfcn-tool-kalibrate-tool-and-others-setup/


Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml