Project

General

Profile

SDR PHY » History » Version 19

fixeria, 08/09/2018 07:30 PM

1 2 fixeria
h1. SDR (Software Defined Radio) hardware
2
3 17 fixeria
{{>toc}}
4
5 2 fixeria
Unlike the obsolete [[Phones|Calypso based phones]], "SDR (Software Defined Radio)":https://en.wikipedia.org/wiki/Software-defined_radio has many advantages, providing much more freedom for the implementation of mobile side [[Software|GSM protocol stack]]. This page describes all steps required for running the higher layer (L2&3) applications (e.g. [[mobile]] or [[ccch_scan]]) on SDR hardware.
6
7
h2. SDR PHY vs Calypso
8
9
h3. What's so special about SDR?
10
11
* General purpose hardware
12
** i.e. not limited to any particular technology and/or protocol stack,
13
** could be used as PHY for GSM, LTE, IEE802.11, GPS, Bluetooth, etc.
14
* Becomes cheap and available for everyone
15
** e.g. RTL-SDR, LimeSDR-Mini
16
* Becomes even smaller than a credit card
17
** e.g. XTRX
18
* Open Source friendly
19
** GNU Radio, GQRX, OpenBTS, OsmoTRX, srsLTE, etc.
20
** some drivers, firmware and PCB schematics are available
21
22
h3. Advantages over Calypso
23
24 11 ipse
* No need to rely on a 'black box' DSP
25 2 fixeria
* No hardware availability problem
26
* No reverse engineering required
27
* No freq. band limitations
28
29
h3. Disadvantages
30
31
* Low output power
32
* General purpose hardware
33
** No screen, no keyboard,
34
** No built-in SIM reader,
35
** No built-in audio
36
** etc.
37
38
h3. What is it for?
39
40
* Another hardware platform for [[OsmocomBB]]
41
* 100% Open Source GSM L1 implementation
42
** GSM TS 05.02 scheduling
43
** GSM TS 05.03 channel coding
44
** GSM TS 05.04 (de)modulation
45
** GSM TS 05.10 synchronization
46
47
h2. Supported SDR hardware
48
49
At the moment, only USRP hardware is supported via UHD driver. This limitation caused by the requirement of RX / TX time tags persistence.
50 13 fixeria
We are currently working on adding support of RX / TX time tags to both Osmocom SDR Source and Sink...
51 2 fixeria
52
The current implementation is known to work on the following devices:
53
54
* USRP B2X0, including 'mini'
55
* Fairwaves [[UmTRX:]]
56
57
h2. Software installation
58
59 5 fixeria
!graph_trxcon.png!
60
61 2 fixeria
The signal processing part is based on [[GR-GSM:]] (https://github.com/ptrkrysik/gr-gsm) project, which is represented by a set of "GNU Radio":https://www.gnuradio.org/ blocks for GSM. So, first of all you need to install "GNU Radio":https://www.gnuradio.org/ with compiled-in "UHD driver":http://files.ettus.com/manual/ support.
62
63
h3. 1. "UHD driver":http://files.ettus.com/manual/
64
65
Follow the "Installing and/or Building UHD" section of official project documentation. After the installation, make sure that your device is recognized properly:
66
67
<pre>
68
$ uhd_find_devices
69
$ uhd_usrp_probe
70
</pre>
71
72
h3. 2. "GNU Radio":https://www.gnuradio.org/
73
74
Despite "GNU Radio":https://www.gnuradio.org/ is available as a binary package on some distributions, we recommend to build the latest release version from source. Please follow the corresponding "building guide":https://wiki.gnuradio.org/index.php/BuildGuide.
75
76
During the build configuration process, make sure you have the following components:
77
78
* python-support
79
* gr-digital
80
* gr-filter
81
* gr-blocks
82
* gr-uhd
83
84
For binary or already installed builds, use the following command to get build info:
85
86
<pre>
87
$ gnuradio-config-info --enabled-components
88
</pre>
89
90
h3. 3. [[GR-GSM:]] with transceiver
91
92 6 fixeria
!graph_trx.png!
93
94 2 fixeria
For now, the transmitter implementation lives in separate branches. This manual compilation from source is required. "General building process":https://github.com/ptrkrysik/gr-gsm/wiki/Manual-compilation-and-installation and dependences are described in the "project's wiki":https://github.com/ptrkrysik/gr-gsm/wiki/.
95
96
<pre>
97
# Get the source code
98
$ git clone git://git.osmocom.org/gr-gsm
99
$ cd gr-gsm/
100
$ git checkout fixeria/trx
101
102
# Configure and compile
103
$ mkdir build
104
$ cd build
105
$ cmake ..
106
$ make
107
108
# Install
109
$ sudo make install
110
$ sudo ldconfig
111
</pre>
112
113 12 fixeria
The transceiver logic is represented by the following flow graph:
114 8 fixeria
115
!grc_trx.png!
116
117 2 fixeria
h3. 4. [[OsmocomBB:]]
118
119
You need to compile OsmocomBB with the [[TRX_Interface|TRX interface]] support. Please refer the corresponding [[TRX_Interface|wiki page]].
120
121 18 fixeria
h2. Docker images
122
123 19 fixeria
It's possible to run the software in Docker containers. This way is recommended for beginners.
124
125
_Note:_ at the moment, there is a build script for GR-GSM TRX only.
126
127
The build script for [[GR-GSM:]] (i.e. Dockerfile) is shipped as a part of a separate project called "docker-playground".
128
It's based on "base/archlinux" image, which provides the recent versions of both UHD and GNU Radio without tons of
129
dependencies such as Xorg, GTK, fonts, etc.
130
131
h3. Building image
132
133
You need to clone the "docker-playground" repository first:
134
135
<pre>
136
137
</pre>
138
139
140 2 fixeria
h2. Running
141
142 4 fixeria
First of all, please see [[SDR_PHY#Project-status|known limitations]].
143 2 fixeria
144
h3. Hardware preparation
145
146
You need to have two antennas connected: one for RX, another for TX. Both antennas should be chosen for a proper frequency band, otherwise the distance will be limited. Also, it's strongly recommended to use a band-pass filter for TX in order to *avoid interference*.
147
148
_Note: There is a bug of USRP B2X0 hardware, which affects the burst transmission quality. It appears when both transmission and reception are performed of the same side of device. To mitigate this, please use an attenuator or antenna with some resistance between the active pin and ground._
149
150
Finally, connect your SDR hardware and make sure it's working. 
151
152
h3. Transceiver
153
154
Check available configuration options:
155
156
<pre>
157
$ grgsm_trx --help
158
159
...
160
161
  TRX interface specific
162
   -i --remote-addr  Set remote address (default 127.0.0.1)
163
   -p --base-port    Set base port number (default 5700)
164
165
  Radio interface specific
166
   -a --device-args  Set device arguments
167
   -s --sample-rate  Set sample rate
168
   -g --rx-gain      Set RX gain (default 30)
169
   -G --tx-gain      Set TX gain (default 10)
170
      --rx-antenna   Set RX antenna (default RX2)
171
      --tx-antenna   Set TX antenna (default TX/RX)
172
      --ppm          Set frequency correction (default 0)
173
</pre>
174
175
If you already have another transceiver runing, e.g. [[OsmoTRX:]], choose a different TRX base port. Keep in mind that a single transceiver process occupies six UDP ports at the same time.
176
177
Choose proper RX / TX antennas and corresponding gain values depending on your device. TX gain requires more attention and should be set depending on your environment and antennas used. Feel free to use a spectrum browser, such as GQRX or osmocom_fft, for measuring the proper values.
178
179
PPM value is typically measured at runtime, so no need to specify it manually.
180
181
<pre>
182
$ grgsm_trx --rx-gain 30 --tx-gain 80
183
linux; GNU C++ version 4.8.5; Boost_105500; UHD_003.010.002.000-0-122bfae1
184
185
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
186
This is free software: you are free to change and redistribute it.
187
There is NO WARRANTY, to the extent permitted by law.
188
189
[i] Init Radio interface
190
-- Detected Device: B200
191
-- Operating over USB 3.
192
-- Initialize CODEC control...
193
-- Initialize Radio control...
194
-- Performing register loopback test... pass
195
-- Performing CODEC loopback test... pass
196
-- Setting master clock rate selection to 'automatic'.
197
-- Asking for clock rate 16.000000 MHz... 
198
-- Actually got clock rate 16.000000 MHz.
199
-- Performing timer loopback test... pass
200
-- Setting master clock rate selection to 'manual'.
201
-- Asking for clock rate 26.000000 MHz... 
202
-- Actually got clock rate 26.000000 MHz.
203
-- Performing timer loopback test... pass
204
-- Asking for clock rate 26.000000 MHz... OK
205
[i] Init CTRL interface
206
[i] Init complete
207
</pre>
208
209
At this step transceiver is ready.
210
211
h3. The trxcon application
212
213
As we don't use Calypso-based phones, the [[osmocon]] application is useless here. Instead, you need to run another application called trxcon. You should use the same TRX base port as specified to transceiver.
214
215
<pre>
216
$ cd osmocom-bb/src/
217
$ host/trxcon/trxcon
218
219
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
220
This is free software: you are free to change and redistribute it.
221
There is NO WARRANTY, to the extent permitted by law.
222
223
<0001> l1ctl_link.c:235 Init L1CTL link (/tmp/osmocom_l2)
224
<0003> trx_if.c:646 Init transceiver interface
225
<0005> sched_trx.c:112 Init scheduler
226
<0000> trxcon.c:277 Init complete
227
</pre>
228
229
See help details.
230
231
h3. L2&3 applications
232
233
At this step you should be able to run the higher layer applications.
234
235
For example, run [[ccch_scan]]:
236
237
<pre>
238
$ cd osmocom-bb/src/
239
$ cd host/layer23/src/misc/
240
$ ./ccch_scan -i 127.0.0.1 -a <ARFCN>
241
</pre>
242
243
It should synchronize with a BTS on specified ARFCN, and start decoding BCCH messages.
244
245
h2. Related pages
246
247
* [[TRX Interface]]
248 10 fixeria
249
{{child_pages(TRX_Interface)}}
250 2 fixeria
251
h2. Project status
252
253
Known limitations (not implemented):
254
255 14 fixeria
* Automatic PHY delay measurement
256 2 fixeria
* AGC (Automatic Gain Control)
257
* Power measurement
258
259
Work in progress:
260 1 fixeria
261 16 fixeria
* Docker scripts (Dockerfiles)
262 2 fixeria
* GAPK based audio back-end
263 1 fixeria
* TCH/H implementation
264 16 fixeria
* Frequency Hopping
265 2 fixeria
266
Future plans:
267
268
* Extend supported hardware list (Soapy?)
269
* PC/SC physical SIM interface
270
* AMR (Adaptive Multi-Rate)
271
272
h2. Further reading / watching
273
274
https://media.ccc.de/v/34c3-8952-running_gsm_mobile_phone_on_sdr
275 15 fixeria
https://www.youtube.com/watch?v=nmqzr2-yF04
Add picture from clipboard (Maximum size: 48.8 MB)