Project

General

Profile

SDR PHY » History » Version 20

fixeria, 08/09/2018 07:37 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 20 fixeria
h3. Building Docker image
132 19 fixeria
133
You need to clone the "docker-playground" repository first:
134
135 1 fixeria
<pre>
136 20 fixeria
$ git clone git://git.osmocom.org/docker-playground/
137
</pre>
138 1 fixeria
139 20 fixeria
Then make sure you have stable Internet connection and enough disk space, and start building:
140
141
<pre>
142
$ cd docker-playground/
143
$ cd gr-gsm-master/
144
$ make build
145 19 fixeria
</pre>
146 1 fixeria
147 20 fixeria
It will take a while...
148
149
As soon as the building process is finished, you should see the new images:
150
151
<pre>
152
$ docker image ls
153
REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
154
wmn/gr-gsm-master         latest              c5912ee7d6ae        About an hour ago   2.09GB
155
base/archlinux            latest              7477438791e3        28 hours ago        689MB
156
</pre>
157 19 fixeria
158 2 fixeria
h2. Running
159
160 4 fixeria
First of all, please see [[SDR_PHY#Project-status|known limitations]].
161 2 fixeria
162
h3. Hardware preparation
163
164
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*.
165
166
_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._
167
168
Finally, connect your SDR hardware and make sure it's working. 
169
170
h3. Transceiver
171
172
Check available configuration options:
173
174
<pre>
175
$ grgsm_trx --help
176
177
...
178
179
  TRX interface specific
180
   -i --remote-addr  Set remote address (default 127.0.0.1)
181
   -p --base-port    Set base port number (default 5700)
182
183
  Radio interface specific
184
   -a --device-args  Set device arguments
185
   -s --sample-rate  Set sample rate
186
   -g --rx-gain      Set RX gain (default 30)
187
   -G --tx-gain      Set TX gain (default 10)
188
      --rx-antenna   Set RX antenna (default RX2)
189
      --tx-antenna   Set TX antenna (default TX/RX)
190
      --ppm          Set frequency correction (default 0)
191
</pre>
192
193
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.
194
195
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.
196
197
PPM value is typically measured at runtime, so no need to specify it manually.
198
199
<pre>
200
$ grgsm_trx --rx-gain 30 --tx-gain 80
201
linux; GNU C++ version 4.8.5; Boost_105500; UHD_003.010.002.000-0-122bfae1
202
203
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
204
This is free software: you are free to change and redistribute it.
205
There is NO WARRANTY, to the extent permitted by law.
206
207
[i] Init Radio interface
208
-- Detected Device: B200
209
-- Operating over USB 3.
210
-- Initialize CODEC control...
211
-- Initialize Radio control...
212
-- Performing register loopback test... pass
213
-- Performing CODEC loopback test... pass
214
-- Setting master clock rate selection to 'automatic'.
215
-- Asking for clock rate 16.000000 MHz... 
216
-- Actually got clock rate 16.000000 MHz.
217
-- Performing timer loopback test... pass
218
-- Setting master clock rate selection to 'manual'.
219
-- Asking for clock rate 26.000000 MHz... 
220
-- Actually got clock rate 26.000000 MHz.
221
-- Performing timer loopback test... pass
222
-- Asking for clock rate 26.000000 MHz... OK
223
[i] Init CTRL interface
224
[i] Init complete
225
</pre>
226
227
At this step transceiver is ready.
228
229
h3. The trxcon application
230
231
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.
232
233
<pre>
234
$ cd osmocom-bb/src/
235
$ host/trxcon/trxcon
236
237
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
238
This is free software: you are free to change and redistribute it.
239
There is NO WARRANTY, to the extent permitted by law.
240
241
<0001> l1ctl_link.c:235 Init L1CTL link (/tmp/osmocom_l2)
242
<0003> trx_if.c:646 Init transceiver interface
243
<0005> sched_trx.c:112 Init scheduler
244
<0000> trxcon.c:277 Init complete
245
</pre>
246
247
See help details.
248
249
h3. L2&3 applications
250
251
At this step you should be able to run the higher layer applications.
252
253
For example, run [[ccch_scan]]:
254
255
<pre>
256
$ cd osmocom-bb/src/
257
$ cd host/layer23/src/misc/
258
$ ./ccch_scan -i 127.0.0.1 -a <ARFCN>
259
</pre>
260
261
It should synchronize with a BTS on specified ARFCN, and start decoding BCCH messages.
262
263
h2. Related pages
264
265
* [[TRX Interface]]
266 10 fixeria
267
{{child_pages(TRX_Interface)}}
268 2 fixeria
269
h2. Project status
270
271
Known limitations (not implemented):
272
273 14 fixeria
* Automatic PHY delay measurement
274 2 fixeria
* AGC (Automatic Gain Control)
275
* Power measurement
276
277
Work in progress:
278 1 fixeria
279 16 fixeria
* Docker scripts (Dockerfiles)
280 2 fixeria
* GAPK based audio back-end
281 1 fixeria
* TCH/H implementation
282 16 fixeria
* Frequency Hopping
283 2 fixeria
284
Future plans:
285
286
* Extend supported hardware list (Soapy?)
287
* PC/SC physical SIM interface
288
* AMR (Adaptive Multi-Rate)
289
290
h2. Further reading / watching
291
292
https://media.ccc.de/v/34c3-8952-running_gsm_mobile_phone_on_sdr
293 15 fixeria
https://www.youtube.com/watch?v=nmqzr2-yF04
Add picture from clipboard (Maximum size: 48.8 MB)