summaryrefslogtreecommitdiff
path: root/2012/rtlsdr-freedomhec2012/rtl-sdr.tex
blob: 60206adf5702617b707dbf8ab9f71f0a2ede8fe0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
% $Header: /cvsroot/latex-beamer/latex-beamer/solutions/conference-talks/conference-ornate-20min.en.tex,v 1.7 2007/01/28 20:48:23 tantau Exp $

\documentclass{beamer}

\usepackage{url}
\makeatletter
\def\url@leostyle{%
  \@ifundefined{selectfont}{\def\UrlFont{\sf}}{\def\UrlFont{\tiny\ttfamily}}}
\makeatother
%% Now actually use the newly defined style.
\urlstyle{leo}


% This file is a solution template for:

% - Talk at a conference/colloquium.
% - Talk length is about 20min.
% - Style is ornate.



% Copyright 2004 by Till Tantau <tantau@users.sourceforge.net>.
%
% In principle, this file can be redistributed and/or modified under
% the terms of the GNU Public License, version 2.
%
% However, this file is supposed to be a template to be modified
% for your own needs. For this reason, if you use this file as a
% template and not specifically distribute it as part of a another
% package/program, I grant the extra permission to freely copy and
% modify this file as you see fit and even to delete this copyright
% notice. 


\mode<presentation>
{
  \usetheme{Warsaw}
  % or ...

  \setbeamercovered{transparent}
  % or whatever (possibly just delete it)
}


\usepackage[english]{babel}
% or whatever

\usepackage[latin1]{inputenc}
% or whatever

\usepackage{times}
\usepackage[T1]{fontenc}
% Or whatever. Note that the encoding and the font should match. If T1
% does not look nice, try deleting the line with the fontenc.


\title{rtl-sdr}

\subtitle
{Turning USD 20 Realtek DVB-T receiver into a SDR}

\author{Harald Welte <laforge@gnumonks.org>}

\institute
{gnumonks.org\\hmw-consulting.de\\sysmocom GmbH}
% - Use the \inst command only if there are several affiliations.
% - Keep it simple, no one is interested in your street address.

\date[] % (optional, should be abbreviation of conference name)
{June 12, FreedomHEC, Taipei}
% - Either use conference name or its abbreviation.
% - Not really informative to the audience, more for people (including
%   yourself) who are reading the slides online

\subject{Communications}
% This is only inserted into the PDF information catalog. Can be left
% out. 



% If you have a file called "university-logo-filename.xxx", where xxx
% is a graphic format that can be processed by latex or pdflatex,
% resp., then you can add a logo as follows:

% \pgfdeclareimage[height=0.5cm]{university-logo}{university-logo-filename}
% \logo{\pgfuseimage{university-logo}}



% Delete this, if you do not want the table of contents to pop up at
% the beginning of each subsection:
%\AtBeginSubsection[]
%{
%  \begin{frame}<beamer>{Outline}
%    \tableofcontents[currentsection,currentsubsection]
%  \end{frame}
%}


% If you wish to uncover everything in a step-wise fashion, uncomment
% the following command: 

%\beamerdefaultoverlayspecification{<+->}


\begin{document}

\begin{frame}
  \titlepage
\end{frame}

\begin{frame}{Outline}
  \tableofcontents[hideallsubsections]
  % You might wish to add the option [pausesections]
\end{frame}


% Structuring a talk is a difficult task and the following structure
% may not be suitable. Here are some rules that apply for this
% solution: 

% - Exactly two or three sections (other than the summary).
% - At *most* three subsections per section.
% - Talk about 30s to 2min per frame. So there should be between about
%   15 and 30 frames, all told.

% - A conference audience is likely to know very little of what you
%   are going to talk about. So *simplify*!
% - In a 20min talk, getting the main ideas across is hard
%   enough. Leave out details, even if it means being less precise than
%   you think necessary.
% - If you omit details that are vital to the proof/implementation,
%   just say so once. Everybody will be happy with that.

\begin{frame}{About the speaker}
\begin{itemize}
	\item Using + toying with Linux since 1994
	\item Kernel / bootloader / driver / firmware development since 1999
	\item IT security expert, focus on network protocol security
	\item Former core developer of Linux packet filter netfilter/iptables
	\item Board-level Electrical Engineering
	\item Always looking for interesting protocols (RFID, DECT, GSM)
	\item OpenEXZ, OpenPCD, Openmoko, OpenBSC, OsmocomBB, OsmoSGSN
\end{itemize}
\end{frame}


\begin{frame}{Disclaimer}
\begin{itemize}
	\item This talk is not about the Linux kernel
	\item This talk is not about consumer mass market
	\item It's about turning a single-purpose device into many more features
	\item ... and to illustrate the creativity unleashed when hardware / chipset makers don't lock their devices down
\end{itemize}
\end{frame}

\section{Software Defined Radio}

\subsection{Traditional radio receivers vs. SDR}

\begin{frame}{Traditional Radio}
\begin{itemize}
	\item uses hardware-based receiver + demodulator
	\item uses analog filtering with fixed filters for given
		application
	\item recovers either analog signal or digitizes demodulated bits
	\item has not changed much in close to 100 years of using radio
		waves for communications
\end{itemize}
\end{frame}

\begin{frame}{Software Defined Radio (SDR)}
\begin{itemize}
	\item uses a more or less classic radio fronted / tuner to
		down-convert either to IF or to baseband
	\item uses a high-speed ADC to digitize that IF or baseband
		signal
	\item uses digital signal processing for filtering,
		equalization, demodulation, decoding
\end{itemize}
\end{frame}

\begin{frame}{SDR advantages vs. traditional radio}
\begin{itemize}
	\item more flexibility in terms of communication system
	\item as long as tuner input frequency, ADC sampling rate and
		computing power are sufficient, any receiver can be
		implemented in pure software, without hardware changes
	\item this is used mostly by military (JTRS, SCA) and commercial
		infrastructure equipment (e.g UMTS NodeB / LTE eNodeB)
\end{itemize}
\end{frame}

\subsection{How the industry normally uses SDR}

\begin{frame}{SDR technology in consumer electronics}
\begin{itemize}
	\item lots of consumer devices already implement SDR technology
	\begin{itemize}
		\item GSM/UMTS/LTE baseband processor in mobile phones
		\item WiFi, Bluetooth, GPS
	\end{itemize}
	\item flexibility of such implementations is restricted to
		manufacturer, as low-level access to DSP code and/or raw
		samples is not intended / documented / activated
	\item user is locked out from real benefits and flexibility of SDR
\end{itemize}
\end{frame}

\begin{frame}{Existing SDR hardware marketed as SDR}
\begin{itemize}
	\item regular consumer-electronics SDR don't provide low-level
		access or documentation
	\item military / telco grade SDR device are way too expensive
		(five-digit USD per unit)
	\item Ettus developed the famous USRP family (four-digit USD per
		unit). Used a lot in education + research
	\item Even lower-cost devices now like Fun Cube Dongle Pro
		(FCDP) or OsmoSDR  (three-digit USD per unit)
\end{itemize}
\end{frame}

\subsection{How the community wants to use SDR}

\begin{frame}{Universal Software Radio Peripheral}
\begin{itemize}
	\item A general-purpose open-source hardware SDR
	\begin{itemize}
		\item Schematics and component placement information public
	\end{itemize}
	\item Generally available to academia, professional users and individuals
	\item Modular concept
	\begin{itemize}	
		\item Mainboard contains Host PC interface and baseband codec
		\item Daughter boards contain radio frontend with rf up/downconverter
	\end{itemize}
	\item Big step forward in pricing, but still not affordable for everyone
	\begin{itemize}
		\item USD~700 for mainboard
		\item frontends from USD~75 to USD~250
	\end{itemize}
\end{itemize}
\end{frame}

\begin{frame}{USRP Circuit Board Photograph}
\begin{figure}[h]
	\centering
	\includegraphics[width=55mm]{usrp_board_photo.jpg}
\end{figure}
\end{frame}

\begin{frame}{USRP Block Diagram}
\begin{figure}[h]
	\centering
	\includegraphics[width=75mm]{usrp-block-diagram.png}
\end{figure}
\end{frame}

\begin{frame}{USRP technical specs}
\begin{itemize}
	\item $4\times$ 12~bit ADCs @ 64~MS/s (digitize band of up to 32~MHz)
	\item $4\times$ 14~bit DACs @ 128~MS/s (useful output freq from DC...44~MHz)
	\item $64\times$ Digital I/O ports, 16 to each daughter-board
	\item The USRP mainboard has 4 slots for daughter-boards (2 Rx, 2 Tx)
	\item transceiver frontends occupy 2 slots (1 Rx, 1 Tx)
\end{itemize}
\end{frame}

\begin{frame}{The second generation USRP: USRP2}
Main differences from USRP1
\begin{itemize}
	\item Gigabit Ethernet replacing USB2 (full-duplex, 1~GBit/sec)
	\item 25~MHz of instantaneous RF bandwidth
	\item Xilinx Spartan 3-2000 FPGA
	\item $2\times$ 100~MHz 14~bit ADC
	\item $2\times$ 400~MHz 16~bit DAC
	\item 1~MByte high-speed SRAM
	\item Clock can be locked to external 10~MHz reference
	\item 1~pulse-per-second input (GPS clock conditioning)
	\item FPGA configuration can be stored on SD card
	\item Stand-alone operation without host PC
	\item Multiple systems can be connected for MIMO
	\item Daughterboards compatible with USRP(1)
\end{itemize}
\end{frame}

\begin{frame}{Fun Cube Dongle Pro (2010)}
\begin{itemize}
	\item 64 MHz to 1700 Mhz USB SDR receiver (193 USD)
	\item limited to 96 kHz I/Q baseband sampling
	\item great for amateur radio and TETRA, but most other
communications systems (like GSM introduced in 1992) use wider band-widths
	\item great progress in terms of size and cost, but much more
limited than USRP
	\item Hardware design and firmware sadly are proprietary
\end{itemize}
\end{frame}

\begin{frame}{Fun Cube Dongle Pro (2010)}
\begin{figure}[h]
	\centering
	\includegraphics[width=110mm]{fcdp_pcb.jpg}
\end{figure}
\end{frame}


\begin{frame}{OsmoSDR (2012)}
\begin{itemize}
	\item small, low-power / low-cost USB SDR hardware (225 USD)
	\item higher bandwidth than FunCubeDonglePro (1.2 MHz / 14bit)
	\item much lower cost than USRP, but more expensive than FCDP
	\item Open Hardware (schematics), software (FPGA, firmware)
\end{itemize}
\begin{figure}[h]
\centering
\includegraphics[width=70mm]{osmosdr.jpg}
\end{figure}
\end{frame}



\section{Gnuradio Software Defined Radio}

\subsection{Gnuradio SDR Architecture}

\begin{frame}{Gnuradio architecture}
\begin{itemize}
	\item Philosophy: Implement SDR not as hand-crafted special-case hand-optimized assembly code in some obscure DSP, but on a general purpose PC
	\begin{itemize}
		\item with modern x86 systems at multi-GHz clock speeds and with many cores this becomes feasible
		\item of course way too expensive for a mass-produced product, but very suitable for research, teaching and rapid prototyping
	\end{itemize}
	\item Implement various signal processing elements in C++
	\begin{itemize}
		\item assembly optimized libraries for low-level operations
		\item provide python bindings for all blocks
	\end{itemize}
	\item Python script to define interaction, relation, signal~routing between blocks
\end{itemize}
\end{frame}

\subsection{Gnuradio blocks and flow graphs}

\begin{frame}{Gnuradio blocks and flow graphs}
\begin{description}[flow graph]
	\item[block] represents one element of signal processing
	\begin{itemize}
		\item filters, adders, transforms, decoders, hardware interfaces
	\end{itemize}
	\item[flow graph] defines routing of signals and interconnection of blocks
	\begin{itemize}
		\item Think of it as the {\em plumbing} between the blocks
	\end{itemize}
\end{description}
Data passing between blocks can be of any C++ data type
\end{frame}

\begin{frame}{GRC flow graph for Wideband FM}
\begin{figure}[h]
	\centering
	\includegraphics[width=110mm]{grc_wbfm.png}
\end{figure}
\end{frame}

\begin{frame}{GRC flow graph for SSB}
\begin{figure}[h]
	\centering
	\includegraphics[width=100mm]{ssb_rcv_grc.png}
\end{figure}
\end{frame}


\subsection{Gnuradio sinks and sources}

\begin{frame}{Gnuradio sinks and sources}
\begin{description}[source]
	\item[sink] special block that consumes data
	\begin{description}[hardware sinks]
		\item[hardware sinks] USRP, Sound card, COMEDI
		\item[software sinks] Scope UI, UDP port, Video card
	\end{description}
	\item[source] special block that sources data
	\begin{description}[hardware sources]
		\item[hardware sources] USRP, Sound card, COMEDI
		\item[software sources] Noise source, File, UDP port
	\end{description}
\end{description}
Every flow graph needs at least one sink and one source!
\end{frame}

\section{Finally: rtl-sdr}

\subsection{The Realtek RTL2832U and its primary application}

\begin{frame}{Realtek RTL2832U based DVB-T receivers}
\begin{itemize}
	\item Realtek RTL2832U based DVB-T receivers are cheaply
		available on the market (USD 20)
	\item RTL2832U implements ADC, DVB-T demodulator and high-speed
		USB device
	\item Normal mode of operation includes full DVB-T receiver
		inside RTL2832U hardware and only sends MPEG2-TS via USB
	\item Realtek released GPL-licensed Linux kernel driver for
		watching TV (not mainline style, but at least GPL)
	\item Realtek released limited manual to V4L developers
\end{itemize}
\end{frame}

\begin{frame}{RTL2832U based devices: EzTV 668}
\begin{figure}[h]
	\centering
	\includegraphics[width=110mm]{ezcap_top.jpg}
\end{figure}
\end{frame}

\begin{frame}{RTL2832U based devices: Hama nano1}
\begin{figure}[h]
	\centering
	\includegraphics[width=110mm]{hama_nano1.jpg}
\end{figure}
\end{frame}

\begin{frame}{RTL2832U based devices}
\begin{itemize}
	\item more than 20 different devices from various vendors
	\item Brand names include ezcap, Hama, Terratec, Compro, GTek, Lifeview, Twintech, Dexatek, Genius, Gigabyte, Dikom, Peak, Sveon
	\item all based on the identical RTL2832U reference design
	\item only major difference is mechanical shape/size and silicon
tuner used.  Best tuner we know is Elonics E4000 (high frequency range)
\end{itemize}
\end{frame}

\begin{frame}{RTL2832U FM and DAB radio}
\begin{itemize}
	\item Some people realized certain windows drivers for RTL2832U
		based products implement FM Radio, others even DAB
	\item Linux driver had no FM radio or DAB support
	\item Realtek-disclosed limited data sheet didn't mention it
		either
	\item Sniffing USB protocol on Windows revealed that raw samples
		are passed from ADC over USB, FM or DAB demodulation
		happens in x86 software.
	\item Realtek didn't provide documentation or source code for
		this on request
\end{itemize}
\end{frame}

\begin{frame}{RTL2832U towards rtl-sdr}
\begin{itemize}
	\item Reverse engineering the USB protocol and replaying certain
		commands from custom libusb based code was able to trigger the raw
		sample transmission
	\item remaining Realtek driver provided information on how to
		use the I2C controller to control the tuner frontend
	\item Harald already developed Elonics E4000 driver for
		osmo-sdr, which could be re-cycled
	\item Tuning to arbitrary frequencies allows digitizing spectrum
		of any communications system within the tuner range
\end{itemize}
\end{frame}

\begin{frame}{RTL2832U towards rtl-sdr}
\begin{itemize}
	\item {\em librtlsdr} contains the major part of the driver
	\item {\em rtl\_sdr} command line capture tool
	\item {\em gr-osmosdr} gnuradio source block
	\item Homepage: http://sdr.osmocom.org/trac/wiki/rtl-sdr
	\item libusb is portable, there even are pre-built windows
		binaries
\end{itemize}
\end{frame}

\subsection{Some of the software supporting rtl-sdr}

\begin{frame}{rtl-sdr software support}
\begin{itemize}
	\item gnuradio (of course), using gr-osmosdr
	\item gr-pocsag (POCSAG pagers)
	\item simple\_fm\_rcv (FM receiver)
	\item python-librtlsdr / pyrtlsdr (generic python bindings)
	\item QtRadio
	\item qgrx
	\item rtl\_fm
	\item SDR\#
	\item gr-air-modes 
	\item tetra\_demod\_fft (TETRA radio)
	\item airprobe (GSM receiver)
\end{itemize}
\end{frame}

\begin{frame}{Free Software SDR Receivers}
Full FOSS receivers/demodulators/decoders available for
\begin{itemize}
	\item Old analog modes like AM/FM/WFM/SSB
	\item DAB (Digital Audio Broadcasting)
	\item GSM downlink + uplink (airprobe)
	\item TETRA downlink (OsmocomTETRA)
	\item ETSI GMR / Thuraya (OsmocomGMR)
	\item P25 (OsmocomOP25)
	\item AIS (Maritime transponders)
	\item Gen2 UHF RFID
	\item DECT (Digital European Cordless Telephony)
\end{itemize}
\end{frame}


\begin{frame}{Who needs all of this?}
\begin{itemize}
	\item Students learning about digital signal processing
	\item Radio Amateurs
	\item Communications (security) resarchers
	\item Anyone interested in building their own software radio
		receivers
\end{itemize}
This is of course not the 100k / million quantity consumer mass market.
But nonetheless, definitely thousands to tens of thousands
\end{frame}

\subsection{Signal Plots}

\begin{frame}{rtl-sdr: Multi-Carrier TETRA}
\begin{figure}[h]
	\centering
	\includegraphics[width=110mm]{tetra.png}
\end{figure}
\end{frame}

\begin{frame}{rtl-sdr: ETSI GMR (Thuraya Satphone)}
\begin{figure}[h]
	\centering
	\includegraphics[width=110mm]{rtl-sdr-gmr.png}
\end{figure}
\end{frame}

\begin{frame}{rtl-sdr: GPS (after filter / LNA)}
\begin{figure}[h]
	\centering
	\includegraphics[width=110mm]{gps-sps2048e3.png}
\end{figure}
\end{frame}

\begin{frame}{rtl-sdr: inmarsat (after LNA)}
\begin{figure}[h]
	\centering
	\includegraphics[width=75mm]{inmarsat.png}
\end{figure}
\end{frame}


\begin{frame}{Thanks}
I'd like to thank the many Osmocom developers and contributors,
especially
\begin{itemize}
	\item Steve Markgraf
	\item Dimitri Stolnikov
	\item Hoernchen
	\item Sylvain Munaut
\end{itemize}
also, Realtek for providing at least some (DVB oriented) documentation
and for releasing GPL licensed code for their hardware in the first
place.
\end{frame}


\begin{frame}{Thanks}
Thanks for your attention.  I hope we have time for Q\&A.
\end{frame}


\end{document}
personal git repositories of Harald Welte. Your mileage may vary