Project

General

Profile

CalypsoBTS » History » Version 9

fixeria, 11/27/2017 11:17 PM

1 6 fixeria
h1. CalypsoBTS
2 1 fixeria
3 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.
4 1 fixeria
5 6 fixeria
h2. Requirements
6 3 fixeria
7 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! 
8 1 fixeria
9 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.
10 1 fixeria
11 6 fixeria
h2. Transceiver preparation
12 1 fixeria
13 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. 
14 1 fixeria
15 6 fixeria
h3. Dependences
16 1 fixeria
17 6 fixeria
Excepting [[libosmocore:]], the signal processing library [[libosmo-dsp:]] is also required.
18 1 fixeria
19 6 fixeria
1. Make sure you have the latest version of [[libosmocore:]]:
20 1 fixeria
21 6 fixeria
If you don't have the library:
22 1 fixeria
23 6 fixeria
<pre>
24
$ git clone git://git.osmocom.org/libosmocore
25
$ cd libosmocore/
26
</pre>
27 1 fixeria
28 6 fixeria
If you do, but need to update:
29
30 1 fixeria
<pre>
31 6 fixeria
$ cd libosmocore/
32
$ sudo make uninstall
33
$ make distclean
34
$ git pull --rebase
35
</pre>
36 1 fixeria
37 6 fixeria
Then:
38 1 fixeria
39
<pre>
40 6 fixeria
$ autoreconf -f -i
41
$ ./configure
42
$ make
43
$ sudo make install
44
</pre>
45 1 fixeria
46 6 fixeria
2. Install [[libosmo-dsp:]]:
47 1 fixeria
48 6 fixeria
<pre>
49
$ git clone git://git.osmocom.org/libosmo-dsp.git
50
$ cd libosmo-dsp/
51
$ autoreconf -i
52
$ ./configure
53
$ make
54
$ sudo make install
55
</pre>
56 1 fixeria
57 6 fixeria
h3. Firmware and host software
58 1 fixeria
59 6 fixeria
1. Clone the 'jolly/testing' branch:
60 1 fixeria
61 6 fixeria
<pre>
62
$ git clone git://git.osmocom.org/osmocom-bb.git -b jolly/testing trx
63
$ cd trx/src/
64
</pre>
65 1 fixeria
66 6 fixeria
2. Enable TX support in firmware:
67 1 fixeria
68 6 fixeria
Uncomment 'CFLAGS += -DCONFIG_TX_ENABLE' in 'target/firmware/Makefile'.
69 1 fixeria
70
71 6 fixeria
3. Compile OsmocomBB with transceiver support:
72 1 fixeria
73 6 fixeria
<pre>
74
$ make HOST_layer23_CONFARGS=--enable-transceiver
75
</pre>
76 1 fixeria
77 6 fixeria
At this step your transceiver should be ready.
78 1 fixeria
79 6 fixeria
80
h3. Clock source
81
82
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.
83
84
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!
85
86
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.
87
88
h3. Usage
89
90
1. First, you need to run the transceiver firmware:
91
92 3 fixeria
<pre>
93 6 fixeria
$ cd trx/src/
94
$ host/osmocon/osmocon -m c123xor -p /dev/ttyUSB0 -c target/firmware/board/compal_e88/trx.highram.bin
95
</pre>
96
97
Additionally, if you have two (or more) phones, load the firmware to a second phone (optional):
98
99
<pre>
100
$ cd trx/src/
101
$ host/osmocon/osmocon -m c123xor -p /dev/ttyUSB1 -s /tmp/osmocom_l2.2 -c target/firmware/board/compal_e88/trx.highram.bin
102
</pre>
103
104
2. The host application could be found in 'src/host/layer23/transceiver/':
105
106
<pre>
107
$ cd trx/src/host/layer23/src/transceiver/
108
$ ./transceiver -h
109
</pre>
110
111
<pre>
112 1 fixeria
Usage: ./transceiver -a arfcn_sync
113
Some useful options:
114
  -h   --help             this text
115
  -d   --debug MASK       Enable debugging (e.g. -d DL1C:DTRX)
116
  -e   --log-level LOGL   Set log level (1=debug, 3=info, 5=notice)
117
  -D   --daemonize        For the process into a background daemon
118
  -s   --disable-color    Don't use colors in stderr log output
119
  -a   --arfcn-sync ARFCN Set ARFCN to sync to
120
  -p   --arfcn-sync-pcs   The ARFCN above is PCS
121
  -2   --second-phone     Use second phone for TS 1
122
  -r   --realtime PRIO    Set realtime scheduler with given prio
123 6 fixeria
</pre>
124 1 fixeria
125 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.
126 1 fixeria
127 6 fixeria
3. Let's try to synchronize with a BTS:
128 1 fixeria
129 6 fixeria
If you have two (or more phones), add '-2' option.
130 2 fixeria
131 6 fixeria
<pre>
132
$ ./transceiver -a <ARFCN>
133
</pre>
134 2 fixeria
135 6 fixeria
You should see something like this:
136
137 2 fixeria
<pre>
138 1 fixeria
<0012> l1ctl.c:383 Reset received: Starting sync.
139
<0012> l1ctl.c:338 Sync acquired, setting BTS mode ...
140 3 fixeria
<0011> trx.c:194 TRX CLK Indication 1255520
141
<0011> trx.c:194 TRX CLK Indication 1255571
142 2 fixeria
<0011> trx.c:194 TRX CLK Indication 1255622
143 3 fixeria
<0011> trx.c:194 TRX CLK Indication 1255673
144 1 fixeria
<0011> trx.c:194 TRX CLK Indication 1255724
145 3 fixeria
<0011> trx.c:194 TRX CLK Indication 1255775
146 1 fixeria
<0011> trx.c:194 TRX CLK Indication 1255826
147
<0011> trx.c:194 TRX CLK Indication 1255877
148
<0011> trx.c:194 TRX CLK Indication 1255928
149 3 fixeria
<0011> trx.c:194 TRX CLK Indication 1255979
150 1 fixeria
<0011> trx.c:194 TRX CLK Indication 1256030
151 3 fixeria
<0011> trx.c:194 TRX CLK Indication 1256081
152 5 laforge
...
153 6 fixeria
</pre>
154 2 fixeria
155 3 fixeria
If something goes wrong, find another ARFCN and try again.
156 6 fixeria
As soon as you get the transceiver synchronized, just keep it running.
157 2 fixeria
158 6 fixeria
h2. CalypsoBTS with [[OsmoNITB:]]
159 2 fixeria
160 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.
161 2 fixeria
162 6 fixeria
h3. Installation
163 3 fixeria
164 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/.
165 2 fixeria
166 6 fixeria
You will need to build / install the following components:
167 3 fixeria
168 6 fixeria
* openbsc (legacy Network in the Box)
169
* osmo-bts (with --enable-trx flag)
170 3 fixeria
171 6 fixeria
h3. Configuration
172 2 fixeria
173 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:
174
175 3 fixeria
<pre>
176 6 fixeria
$ mkdir ~/.osmocom/
177 2 fixeria
</pre>
178
179 6 fixeria
You can use the following configuration examples:
180 2 fixeria
181 6 fixeria
* [[OsmoNITB:]]: 'doc/examples/osmo-nitb/sysmobts/openbsc.cfg'
182 7 fixeria
* [[OsmoBTS:]]: 'doc/examples/calypso/osmo-bts.cfg'
183 2 fixeria
184 1 fixeria
There are some important things you need to pay attention.
185 7 fixeria
The recommended values are listed below.
186 3 fixeria
187 7 fixeria
h3. OsmoNITB configuration
188 1 fixeria
189 7 fixeria
h4. Network identification
190
191 1 fixeria
<pre>
192 7 fixeria
network
193
  ...
194
  network country code 901
195
  mobile network code 70
196
  short name OpenBSC
197
  long name OpenBSC
198 1 fixeria
</pre>
199
200 7 fixeria
h4. Network access
201 1 fixeria
202 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.
203
204 1 fixeria
<pre>
205 7 fixeria
network
206
  ...
207
  auth policy (closed | accept-all | regexp | token)
208
  authorized-regexp .*
209 6 fixeria
</pre>
210 1 fixeria
211 7 fixeria
h4. Encryption
212 2 fixeria
213 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.
214
215 7 fixeria
<pre>
216
network
217
  ...
218
  encryption a5 (0 | 1 | 2 | 3)
219
</pre>
220 1 fixeria
221 7 fixeria
h4. Channel configuration
222
223 1 fixeria
Set a proper ARFCN for running BTS (don't confuse with a clock source). Also, set a corresponding band name.
224 3 fixeria
225 1 fixeria
<pre>
226 7 fixeria
network
227
  ...
228
  bts 0
229
    ...
230
    band (GSM900 | DCS1800)
231
    ...
232
    trx 0
233
      ...
234
      arfcn ARFCN
235 1 fixeria
</pre>
236
237 7 fixeria
h4. MS power control
238 1 fixeria
239 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).
240
241
<pre>
242
network
243
  ...
244
  bts 0
245
    ...
246
    ms max power 0
247
</pre>
248
249
h4. Logical channel mapping
250
251 1 fixeria
I recommend you to use the combined channel configuration (CCCH+SDCCH4) for TS0, because CalypsoBTS at the moment cannot serve all timeslots.
252
253
<pre>
254 7 fixeria
network
255
  ...
256
  bts 0
257
    ...
258
    trx 0
259
      ...
260
      timeslot 0
261
        phys_chan_config CCCH+SDCCH4
262
        hopping enabled 0
263 1 fixeria
</pre>
264 6 fixeria
265 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.
266
267
<pre>
268 7 fixeria
network
269
  ...
270
  bts 0
271
    ...
272
    trx 0
273
      ...
274
      timeslot 1
275
        phys_chan_config TCH/H
276
        hopping enabled 0
277 1 fixeria
</pre>
278
279 7 fixeria
h3. OsmoBTS configuration
280 1 fixeria
281 7 fixeria
h4. GSM band configuration
282
283 1 fixeria
The band value should match one in the [[OsmoNITB:]] configuration.
284
285 7 fixeria
<pre>
286
bts 0
287
  ...
288
  band (900 | 1800)
289
</pre>
290 1 fixeria
291 7 fixeria
h4. A-bis link configuration
292
293 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.
294
295 7 fixeria
<pre>
296
bts 0
297
  ...
298
  oml remote-ip 127.0.0.1
299
  ipa unit-id 1801 0
300
</pre>
301 6 fixeria
302 7 fixeria
h4. Transceiver configuration
303
304
In order to prevent the input saturation, 'ms-power-loop' should be set to -65.
305
306
<pre>
307
phy 0
308
  ...
309
  osmotrx ms-power-loop -65
310
</pre>
311
312
Since the CalypsoBTS transceiver is obsolete, it still requires BSIC to be set instead of TSC.
313
314
<pre>
315
phy 0
316
  ...
317
  osmotrx legacy-setbsic
318
</pre>
319 6 fixeria
320 3 fixeria
h3. Running
321 6 fixeria
322 3 fixeria
_Tip: feel free to use tmux or screen to avoid a mess with multiple windows_
323 6 fixeria
324 2 fixeria
0. Make sure your transceiver is still runing...
325
326 6 fixeria
1. Start [[OsmoNITB:]]:
327 1 fixeria
328
<pre>
329 6 fixeria
$ osmo-nitb -c ~/.osmocom/openbsc.cfg -l ~/.osmocom/hlr.sqlite3 -P -C --debug=DRLL:DCC:DMM:DRR:DRSL:DNM
330 2 fixeria
</pre>
331
332 6 fixeria
2. Start [[OsmoBTS:]]:
333 3 fixeria
334 2 fixeria
<pre>
335 6 fixeria
$ osmo-bts-trx -c ~/.osmocom/osmo-bts.cfg
336 2 fixeria
</pre>
337
338 6 fixeria
Congratulations! Now you should get the network running. You can use telnet interface to control both [[OsmoNITB:]] and [[OsmoBTS:]]:
339
340 3 fixeria
<pre>
341 6 fixeria
# OsmoNITB telnet interface
342
$ telnet localhost 4242
343 3 fixeria
344 2 fixeria
# OsmoBTS telnet interface
345 6 fixeria
$ telnet localhost 4241
346 3 fixeria
</pre>
347 6 fixeria
348 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.
349 6 fixeria
350 2 fixeria
h2. CalypsoBTS with "OpenBTS":http://openbts.org/
351 6 fixeria
352 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.
353 6 fixeria
354 3 fixeria
h3. Installation and configuration
355 6 fixeria
356 1 fixeria
Follow this "howto":https://github.com/RangeNetworks/dev/wiki in the project wiki.
357 6 fixeria
358 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.
359 6 fixeria
360 1 fixeria
1. Replace the stock transceiver
361
362 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:
363
364 5 laforge
<pre>
365 1 fixeria
#!/bin/bash
366 6 fixeria
exec <your path to osmocom-bb>/src/host/layer23/src/transceiver/transceiver -a <ARFCN>
367 1 fixeria
</pre>
368 6 fixeria
369 1 fixeria
Where ARFCN is the channel of clock source cell. If you have two (or more phones), add '-2' option.
370
371 6 fixeria
2. And make it executable:
372 1 fixeria
373
<pre>
374 6 fixeria
sudo chmod +x ./transceiver
375 1 fixeria
</pre>
376 6 fixeria
377 1 fixeria
h3. Running
378 6 fixeria
379 9 fixeria
Run the TRX firmware on the phone as described above. No need to start transceiver, the "OpenBTS":http://openbts.org/ will run it automatically.
380 1 fixeria
381
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.
382 6 fixeria
383
h2. Demo
384
385 1 fixeria
https://www.youtube.com/watch?v=Aj1A6F-FAGU
386 6 fixeria
https://www.youtube.com/watch?v=FifvFov3RsI
387 1 fixeria
https://www.youtube.com/watch?v=PZ4-UCH2ED8
388 6 fixeria
389
h2. References
390 1 fixeria
391
https://www.youtube.com/watch?v=xFjVcxMpA6c
392 6 fixeria
https://events.ccc.de/congress/2012/Fahrplan/attachments/2244_29c3_further_hacks_on_the_calypso_platform
393 1 fixeria
394 6 fixeria
395 1 fixeria
h2. Known limitations and issues
396 6 fixeria
397 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.
398
399
* 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)