Project

General

Profile

CalypsoBTS » History » Version 13

fixeria, 02/23/2020 04:40 PM

1 6 fixeria
h1. CalypsoBTS
2 1 fixeria
3 12 fixeria
{{>toc}}
4
5 6 fixeria
This tutorial describes how to turn cheap Calypso based phone(s) into a GSM BTS. We will consider both [[OsmoBTS:]] and "OpenBTS":http://openbts.org/ projects as GSM network front-ends. Due to some hardware limitations, the CalypsoBTS setup cannot provide normal quality of service and can only be used to learn how do the base stations work.
6 1 fixeria
7 6 fixeria
h2. Requirements
8 3 fixeria
9 6 fixeria
First of all, you need to understand what are you doing and any possible consequences. Please note, that you can only use the frequencies you have a valid license for. In many countries you cannot operate any GSM RF equipment until a proper license from the regulatory authority is obtained. Running a BTS without such license and/or interfering with the commercial networks is out of law and may be punished! 
10 1 fixeria
11 6 fixeria
This tutorial assumes that you already have a [[Software_Getting_Started|working setup]] of [[OsmocomBB]]. Some things (package names, etc.) can be different in your distribution, so you should be able to resolve possible problems yourself.
12 1 fixeria
13 6 fixeria
h2. Transceiver preparation
14 1 fixeria
15 6 fixeria
Transceiver is a software that performs some low-level GSM L1 operations, such as burst detection, modulation and demodulation, abstracting a BTS or MS from doing that. There are two [[OsmocomBB]] branches implementing the transceiver firmware and host application: 'sylvain/testing' and 'jolly/testing'. The last one is based on the first, but additionally allows to use multiple phones, so I advice you to choose it. 
16 1 fixeria
17 6 fixeria
h3. Dependences
18 1 fixeria
19 6 fixeria
Excepting [[libosmocore:]], the signal processing library [[libosmo-dsp:]] is also required.
20 1 fixeria
21 6 fixeria
1. Make sure you have the latest version of [[libosmocore:]]:
22 1 fixeria
23 6 fixeria
If you don't have the library:
24 1 fixeria
25 6 fixeria
<pre>
26
$ git clone git://git.osmocom.org/libosmocore
27
$ cd libosmocore/
28
</pre>
29 1 fixeria
30 6 fixeria
If you do, but need to update:
31
32 1 fixeria
<pre>
33 6 fixeria
$ cd libosmocore/
34
$ sudo make uninstall
35
$ make distclean
36
$ git pull --rebase
37
</pre>
38 1 fixeria
39 6 fixeria
Then:
40 1 fixeria
41
<pre>
42 6 fixeria
$ autoreconf -f -i
43
$ ./configure
44
$ make
45
$ sudo make install
46
</pre>
47 1 fixeria
48 6 fixeria
2. Install [[libosmo-dsp:]]:
49 1 fixeria
50 6 fixeria
<pre>
51
$ git clone git://git.osmocom.org/libosmo-dsp.git
52
$ cd libosmo-dsp/
53
$ autoreconf -i
54
$ ./configure
55
$ make
56
$ sudo make install
57
</pre>
58 1 fixeria
59 6 fixeria
h3. Firmware and host software
60 1 fixeria
61 13 fixeria
1. Clone the 'fixeria/trx' branch:
62 1 fixeria
63 6 fixeria
<pre>
64 13 fixeria
$ git clone git://git.osmocom.org/osmocom-bb.git -b fixeria/trx trx
65 6 fixeria
$ cd trx/src/
66
</pre>
67 1 fixeria
68 6 fixeria
2. Enable TX support in firmware:
69 1 fixeria
70 6 fixeria
Uncomment 'CFLAGS += -DCONFIG_TX_ENABLE' in 'target/firmware/Makefile'.
71 1 fixeria
72
73 6 fixeria
3. Compile OsmocomBB with transceiver support:
74 1 fixeria
75 6 fixeria
<pre>
76
$ make HOST_layer23_CONFARGS=--enable-transceiver
77
</pre>
78
79 1 fixeria
At this step your transceiver should be ready.
80 6 fixeria
81
h3. Clock source
82
83
Time-division (TDMA) systems require very accurate counting of the time segments (frames and timeslots) and when they start and stop. Also, multiple base stations within a network must be time-synchronized between themselves to make subscribers able to perform handover operation (switching from one BTS to another). If the towers clocking were out of sync, then communications would falter as each node would be trying to deal with segments that were slightly offset and this would introduce errors. This is why a good clock source is required to operate a base station.
84
85
The satellite systems, such as GPS and Iridium, do have pretty accurate clock that is being distributed in addition to the prime services (location, calls, etc). They could be used (and often used in commercial networks) for synchronization purposes. This approach would require one to have a corresponding receiver and a direct sky view, but there is a simpler way. We can use the SCH clock indications from existing base stations, eventually a phone is designed to do that!
86
87
So, use [[rssibin|RSSI]] or [[cell_log]] applications to find cells with good signal and remember the ARFCN numbers. One of them will be used as a clock source for our own base station.
88
89
h3. Usage
90
91
1. First, you need to run the transceiver firmware:
92
93 3 fixeria
<pre>
94 6 fixeria
$ cd trx/src/
95
$ host/osmocon/osmocon -m c123xor -p /dev/ttyUSB0 -c target/firmware/board/compal_e88/trx.highram.bin
96
</pre>
97
98
Additionally, if you have two (or more) phones, load the firmware to a second phone (optional):
99
100
<pre>
101
$ cd trx/src/
102
$ host/osmocon/osmocon -m c123xor -p /dev/ttyUSB1 -s /tmp/osmocom_l2.2 -c target/firmware/board/compal_e88/trx.highram.bin
103
</pre>
104
105
2. The host application could be found in 'src/host/layer23/transceiver/':
106
107
<pre>
108
$ cd trx/src/host/layer23/src/transceiver/
109
$ ./transceiver -h
110
</pre>
111
112
<pre>
113 1 fixeria
Usage: ./transceiver -a arfcn_sync
114
Some useful options:
115
  -h   --help             this text
116
  -d   --debug MASK       Enable debugging (e.g. -d DL1C:DTRX)
117
  -e   --log-level LOGL   Set log level (1=debug, 3=info, 5=notice)
118
  -D   --daemonize        For the process into a background daemon
119
  -s   --disable-color    Don't use colors in stderr log output
120
  -a   --arfcn-sync ARFCN Set ARFCN to sync to
121
  -p   --arfcn-sync-pcs   The ARFCN above is PCS
122
  -2   --second-phone     Use second phone for TS 1
123
  -r   --realtime PRIO    Set realtime scheduler with given prio
124 6 fixeria
</pre>
125 1 fixeria
126 6 fixeria
The --arfcn-sync or --arfcn-sync-pcs are used to specify the ARFCN of a clock source cell. The high priority scheduling is recommended for low-performance PCs.
127 1 fixeria
128 6 fixeria
3. Let's try to synchronize with a BTS:
129 1 fixeria
130 6 fixeria
If you have two (or more phones), add '-2' option.
131 2 fixeria
132 6 fixeria
<pre>
133
$ ./transceiver -a <ARFCN>
134
</pre>
135 2 fixeria
136 6 fixeria
You should see something like this:
137
138 2 fixeria
<pre>
139 1 fixeria
<0012> l1ctl.c:383 Reset received: Starting sync.
140
<0012> l1ctl.c:338 Sync acquired, setting BTS mode ...
141 3 fixeria
<0011> trx.c:194 TRX CLK Indication 1255520
142
<0011> trx.c:194 TRX CLK Indication 1255571
143 2 fixeria
<0011> trx.c:194 TRX CLK Indication 1255622
144 3 fixeria
<0011> trx.c:194 TRX CLK Indication 1255673
145 1 fixeria
<0011> trx.c:194 TRX CLK Indication 1255724
146 3 fixeria
<0011> trx.c:194 TRX CLK Indication 1255775
147 1 fixeria
<0011> trx.c:194 TRX CLK Indication 1255826
148
<0011> trx.c:194 TRX CLK Indication 1255877
149
<0011> trx.c:194 TRX CLK Indication 1255928
150 3 fixeria
<0011> trx.c:194 TRX CLK Indication 1255979
151 1 fixeria
<0011> trx.c:194 TRX CLK Indication 1256030
152 3 fixeria
<0011> trx.c:194 TRX CLK Indication 1256081
153 5 laforge
...
154 6 fixeria
</pre>
155 2 fixeria
156 3 fixeria
If something goes wrong, find another ARFCN and try again.
157 6 fixeria
As soon as you get the transceiver synchronized, just keep it running.
158 2 fixeria
159 6 fixeria
h2. CalypsoBTS with [[OsmoNITB:]]
160 2 fixeria
161 6 fixeria
The simplest way to setup a GSM network is to use [[OsmoBTS:]] with [[OpenBSC:]] in [[OsmoNITB:]] mode. [[OsmoNITB:]] is a simple core network implementation - network in the box. It emulates basic core elements like MSC, HLR, VLR, etc. [[OsmoBTS:]] is a part of Osmocom GSM core network implementation, that supports a variety of different hardware back-ends, including [[TRX Interface]] transceivers like [[OsmoTRX:]]. Unlike "OpenBTS":http://openbts.org/, this software stack is well maintained, so I would recommend you to choose it.
162 2 fixeria
163 6 fixeria
h3. Installation
164 3 fixeria
165 6 fixeria
This guide is not about building the core network software, so please follow [[openbsc:Building_OpenBSC|Building OpenBSC]]. Feel free to browse the wiki and check out the official documentation http://ftp.osmocom.org/docs/.
166 2 fixeria
167 6 fixeria
You will need to build / install the following components:
168 3 fixeria
169 6 fixeria
* openbsc (legacy Network in the Box)
170
* osmo-bts (with --enable-trx flag)
171 3 fixeria
172 6 fixeria
h3. Configuration
173 2 fixeria
174 6 fixeria
Almost each program has the configuration examples. Just look for 'doc/examples/'. I recommend you to customize them as you need and put the updated files in a separate directory. Let's use the '~/.osmocom/' for such purposes:
175
176 3 fixeria
<pre>
177 6 fixeria
$ mkdir ~/.osmocom/
178 2 fixeria
</pre>
179
180 6 fixeria
You can use the following configuration examples:
181 2 fixeria
182 6 fixeria
* [[OsmoNITB:]]: 'doc/examples/osmo-nitb/sysmobts/openbsc.cfg'
183 7 fixeria
* [[OsmoBTS:]]: 'doc/examples/calypso/osmo-bts.cfg'
184 2 fixeria
185 1 fixeria
There are some important things you need to pay attention.
186 7 fixeria
The recommended values are listed below.
187 3 fixeria
188 7 fixeria
h3. OsmoNITB configuration
189 1 fixeria
190 7 fixeria
h4. Network identification
191
192 1 fixeria
<pre>
193 7 fixeria
network
194
  ...
195
  network country code 901
196
  mobile network code 70
197
  short name OpenBSC
198
  long name OpenBSC
199 1 fixeria
</pre>
200
201 7 fixeria
h4. Network access
202 1 fixeria
203 7 fixeria
Warning! Setting the access policy to 'accept-all' may be dangerous. It's recommended to use the 'closed' policy, adding your test subscriber(s) info to the HLR database.
204
205 1 fixeria
<pre>
206 7 fixeria
network
207
  ...
208
  auth policy (closed | accept-all | regexp | token)
209
  authorized-regexp .*
210 6 fixeria
</pre>
211 1 fixeria
212 7 fixeria
h4. Encryption
213 2 fixeria
214 1 fixeria
To be able to use any encryption algorithm, you need to know the Ki of subscribers. So, it's recommended not to use any encryption (A5/0) for testing.
215
216 7 fixeria
<pre>
217
network
218
  ...
219
  encryption a5 (0 | 1 | 2 | 3)
220
</pre>
221 1 fixeria
222 7 fixeria
h4. Channel configuration
223
224 1 fixeria
Set a proper ARFCN for running BTS (don't confuse with a clock source). Also, set a corresponding band name.
225 3 fixeria
226 1 fixeria
<pre>
227 7 fixeria
network
228
  ...
229
  bts 0
230
    ...
231
    band (GSM900 | DCS1800)
232
    ...
233
    trx 0
234
      ...
235
      arfcn ARFCN
236 1 fixeria
</pre>
237
238 7 fixeria
h4. MS power control
239 1 fixeria
240 7 fixeria
If the normal phones are only one or few meters away, the maximal power should be set to 0. In case of long distance test it can be set to 30 (DCS) or 33 (GSM 900).
241
242
<pre>
243
network
244
  ...
245
  bts 0
246
    ...
247
    ms max power 0
248
</pre>
249
250
h4. Logical channel mapping
251
252 1 fixeria
I recommend you to use the combined channel configuration (CCCH+SDCCH4) for TS0, because CalypsoBTS at the moment cannot serve all timeslots.
253
254
<pre>
255 7 fixeria
network
256
  ...
257
  bts 0
258
    ...
259
    trx 0
260
      ...
261
      timeslot 0
262
        phys_chan_config CCCH+SDCCH4
263
        hopping enabled 0
264 1 fixeria
</pre>
265 6 fixeria
266 1 fixeria
If you have two or more Calypso based phones, it's also possible to serve the second timeslot (TS1). For example, 'TCH/H' channel could be used to serve one voice call between two subscribers.
267
268
<pre>
269 7 fixeria
network
270
  ...
271
  bts 0
272
    ...
273
    trx 0
274
      ...
275
      timeslot 1
276
        phys_chan_config TCH/H
277
        hopping enabled 0
278 1 fixeria
</pre>
279
280 11 fixeria
h4. Subscriber management policy
281
282
Of course, you can manually edit HLR database and configure as much subscribers as you need. But the simplest way is to create subscriber records on fly, during the Location Update Request.
283
284
<pre>
285
network
286
  ...
287
  bts 0
288
    ...
289
    trx 0
290
      ...
291
nitb
292
  subscriber-create-on-demand
293
  assign-tmsi
294
</pre>
295
296 7 fixeria
h3. OsmoBTS configuration
297 1 fixeria
298 7 fixeria
h4. GSM band configuration
299
300 1 fixeria
The band value should match one in the [[OsmoNITB:]] configuration.
301
302 7 fixeria
<pre>
303
bts 0
304
  ...
305
  band (900 | 1800)
306
</pre>
307 1 fixeria
308 7 fixeria
h4. A-bis link configuration
309
310 1 fixeria
In the most cases both [[OsmoNITB:]] and [[OsmoBTS:]] are working on the same host. So, the loopback address should be used for 'remote-ip'. The 'unit-id' should be the same as in the [[OsmoNITB:]] configuration.
311
312 7 fixeria
<pre>
313
bts 0
314
  ...
315
  oml remote-ip 127.0.0.1
316
  ipa unit-id 1801 0
317
</pre>
318 6 fixeria
319 7 fixeria
h4. Transceiver configuration
320
321
In order to prevent the input saturation, 'ms-power-loop' should be set to -65.
322
323
<pre>
324
phy 0
325
  ...
326
  osmotrx ms-power-loop -65
327
</pre>
328
329
Since the CalypsoBTS transceiver is obsolete, it still requires BSIC to be set instead of TSC.
330
331
<pre>
332
phy 0
333
  ...
334
  osmotrx legacy-setbsic
335
</pre>
336 6 fixeria
337 3 fixeria
h3. Running
338 6 fixeria
339 3 fixeria
_Tip: feel free to use tmux or screen to avoid a mess with multiple windows_
340 6 fixeria
341 2 fixeria
0. Make sure your transceiver is still runing...
342
343 6 fixeria
1. Start [[OsmoNITB:]]:
344 1 fixeria
345
<pre>
346 6 fixeria
$ osmo-nitb -c ~/.osmocom/openbsc.cfg -l ~/.osmocom/hlr.sqlite3 -P -C --debug=DRLL:DCC:DMM:DRR:DRSL:DNM
347 2 fixeria
</pre>
348
349 6 fixeria
2. Start [[OsmoBTS:]]:
350 3 fixeria
351 2 fixeria
<pre>
352 6 fixeria
$ osmo-bts-trx -c ~/.osmocom/osmo-bts.cfg
353 2 fixeria
</pre>
354
355 6 fixeria
Congratulations! Now you should get the network running. You can use telnet interface to control both [[OsmoNITB:]] and [[OsmoBTS:]]:
356
357 3 fixeria
<pre>
358 6 fixeria
# OsmoNITB telnet interface
359
$ telnet localhost 4242
360 3 fixeria
361 2 fixeria
# OsmoBTS telnet interface
362 6 fixeria
$ telnet localhost 4241
363 3 fixeria
</pre>
364 6 fixeria
365 2 fixeria
You should hopefully see the BTS by performing a manual network search with your phone. Monitor the output of osmocon and the transceiver to see if all goes well. If anything should fail, reboot the phone and start over.
366 6 fixeria
367 2 fixeria
h2. CalypsoBTS with "OpenBTS":http://openbts.org/
368 6 fixeria
369 3 fixeria
"OpenBTS":http://openbts.org/ is another open source software project aimed to replace legacy telecommunication protocols and traditionally complex, proprietary hardware systems by IP a flexible software architecture. It implements the BTS side protocol stack and also some important core network elements.
370 6 fixeria
371 3 fixeria
h3. Installation and configuration
372 6 fixeria
373 1 fixeria
Follow this "howto":https://github.com/RangeNetworks/dev/wiki in the project wiki.
374 6 fixeria
375 3 fixeria
By default, the stock transceiver is used by "OpenBTS":http://openbts.org/. It's designed to work on SDR based hardware (like USRP), but this is not our case. So, we need to replace it by OsmocomBB transceiver.
376 6 fixeria
377 1 fixeria
1. Replace the stock transceiver
378
379 6 fixeria
Make sure that "OpenBTS":http://openbts.org/ in not running. In the folder where the "OpenBTS":http://openbts.org/ executable resides, create a script with the filename 'transceiver' with the following content:
380
381 5 laforge
<pre>
382 1 fixeria
#!/bin/bash
383 6 fixeria
exec <your path to osmocom-bb>/src/host/layer23/src/transceiver/transceiver -a <ARFCN>
384 1 fixeria
</pre>
385 6 fixeria
386 1 fixeria
Where ARFCN is the channel of clock source cell. If you have two (or more phones), add '-2' option.
387
388 6 fixeria
2. And make it executable:
389 1 fixeria
390
<pre>
391 6 fixeria
sudo chmod +x ./transceiver
392 1 fixeria
</pre>
393 6 fixeria
394 1 fixeria
h3. Running
395 6 fixeria
396 10 fixeria
Run the TRX firmware on the phone as described above. No need to start transceiver, "OpenBTS":http://openbts.org/ will run it automatically.
397 1 fixeria
398
The "OpenBTS":http://openbts.org/ CLI allows you to monitor system status and change many operating parameters of "OpenBTS":http://openbts.org/ and the Transceiver in real time.
399 6 fixeria
400
h2. Demo
401
402 1 fixeria
https://www.youtube.com/watch?v=Aj1A6F-FAGU
403 6 fixeria
https://www.youtube.com/watch?v=FifvFov3RsI
404 1 fixeria
https://www.youtube.com/watch?v=PZ4-UCH2ED8
405 6 fixeria
406
h2. References
407 1 fixeria
408
https://www.youtube.com/watch?v=xFjVcxMpA6c
409 6 fixeria
https://events.ccc.de/congress/2012/Fahrplan/attachments/2244_29c3_further_hacks_on_the_calypso_platform
410 1 fixeria
411 6 fixeria
412 1 fixeria
h2. Known limitations and issues
413 6 fixeria
414 1 fixeria
* Two timeslots limitation. Due to some DSP limitations and the non-BTS nature of CalypsoBTS, one phone can serve only one timeslot. Moreover, despite the current transceiver code was extended to support multiple phones ('jolly/testing' branch), this feature is still incomplete. So, for now, up to two phones could be used to serve up to two physical timeslots.
415
416
* Non-continuous C0 transmission. According to the GSM specifications, a C0 base station should keep transmission on all timeslots even if there is nothing to transmit. This makes the mobile stations able to detect them and measure the power levels. Again, a phone isn't BTS. It takes some time to tune between DL and UL frequencies.
Add picture from clipboard (Maximum size: 48.8 MB)