Project

General

Profile

CalypsoBTS » History » Version 6

fixeria, 11/23/2017 06:54 AM

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
* [[OsmoBTS:]]: 'doc/examples/trx/osmo-bts.cfg'
183 2 fixeria
184 6 fixeria
There are some important things you need to pay attention.
185 3 fixeria
186 6 fixeria
h4. Network identification (OsmoNITB):
187 3 fixeria
188 5 laforge
<pre>
189 6 fixeria
network country code 901
190
mobile network code 70
191
short name OpenBSC
192
long name OpenBSC
193 2 fixeria
</pre>
194 3 fixeria
195 6 fixeria
h4. Network access / encryption (OsmoNITB):
196 2 fixeria
197
<pre>
198 6 fixeria
auth policy (closed | accept-all | regexp | token)
199
encryption a5 (0 | 1 | 2 | 3)
200 3 fixeria
</pre>
201 2 fixeria
202 6 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 3 fixeria
204 6 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.
205 2 fixeria
206 6 fixeria
h4. Channel configuration (OsmoNITB):
207 2 fixeria
208 6 fixeria
Set a proper ARFCN for running BTS (don't confuse with a clock source). Also, set a corresponding band name.
209 2 fixeria
210 1 fixeria
<pre>
211 6 fixeria
* band (GSM900 | DCS1800)
212
* arfcn ARFCN
213 3 fixeria
</pre>
214 2 fixeria
215 6 fixeria
h4. Logical channel mapping (OsmoNITB):
216 2 fixeria
217 6 fixeria
I recommend you to use the combined channel configuration (CCCH+SDCCH4) for TS0, because CalypsoBTS at the moment cannot serve all timeslots.
218 2 fixeria
219
<pre>
220 6 fixeria
timeslot 0
221
  phys_chan_config CCCH+SDCCH4
222 2 fixeria
</pre>
223
224 6 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.
225 2 fixeria
226
<pre>
227 6 fixeria
timeslot 1
228
  phys_chan_config TCH/H
229 2 fixeria
</pre>
230
231 6 fixeria
h4. OsmoBTS configuration:
232 2 fixeria
233 6 fixeria
The band value should match one in the [[OsmoNITB:]] configuration.
234 2 fixeria
235 6 fixeria
* band (GSM900 | DCS1800)
236 3 fixeria
237 6 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.
238 2 fixeria
239 6 fixeria
* ipa unit-id 1801 0
240
* oml remote-ip 127.0.0.1
241 2 fixeria
242 3 fixeria
243 6 fixeria
h3. Running
244 3 fixeria
245 6 fixeria
_Tip: feel free to use tmux or screen to avoid a mess with multiple windows_
246 3 fixeria
247 6 fixeria
0. Make sure your transceiver is still runing...
248 3 fixeria
249 6 fixeria
1. Start [[OsmoNITB:]]:
250 2 fixeria
251
<pre>
252 6 fixeria
$ osmo-nitb -c ~/.osmocom/openbsc.cfg -l ~/.osmocom/hlr.sqlite3 -P -C --debug=DRLL:DCC:DMM:DRR:DRSL:DNM
253 1 fixeria
</pre>
254
255 6 fixeria
2. Start [[OsmoBTS:]]:
256 2 fixeria
257
<pre>
258 6 fixeria
$ osmo-bts-trx -c ~/.osmocom/osmo-bts.cfg
259 3 fixeria
</pre>
260 2 fixeria
261 6 fixeria
Congratulations! Now you should get the network running. You can use telnet interface to control both [[OsmoNITB:]] and [[OsmoBTS:]]:
262 2 fixeria
263
<pre>
264 6 fixeria
# OsmoNITB telnet interface
265
$ telnet localhost 4242
266 3 fixeria
267 6 fixeria
# OsmoBTS telnet interface
268
$ telnet localhost 4241
269 3 fixeria
</pre>
270 2 fixeria
271 6 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.
272 3 fixeria
273 6 fixeria
h2. CalypsoBTS with "OpenBTS":http://openbts.org/
274 2 fixeria
275 6 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.
276 2 fixeria
277 6 fixeria
h3. Installation and configuration
278 3 fixeria
279 6 fixeria
Follow this "howto":https://github.com/RangeNetworks/dev/wiki in the project wiki.
280 3 fixeria
281 6 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.
282 1 fixeria
283 6 fixeria
1. Replace the stock transceiver
284 3 fixeria
285 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:
286 1 fixeria
287
<pre>
288 6 fixeria
#!/bin/bash
289
exec <your path to osmocom-bb>/src/host/layer23/src/transceiver/transceiver -a <ARFCN>
290 5 laforge
</pre>
291 1 fixeria
292 6 fixeria
Where ARFCN is the channel of clock source cell. If you have two (or more phones), add '-2' option.
293 1 fixeria
294 6 fixeria
2. And make it executable:
295 1 fixeria
296
<pre>
297 6 fixeria
sudo chmod +x ./transceiver
298 1 fixeria
</pre>
299
300 6 fixeria
h3. Running
301 1 fixeria
302 6 fixeria
Run the TRX firmware on the phone as described above. No need to start transceiver, the OsmoBTS will run it automatically.
303 1 fixeria
304 6 fixeria
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.
305 1 fixeria
306
307 6 fixeria
h2. Demo
308 1 fixeria
309 6 fixeria
https://www.youtube.com/watch?v=Aj1A6F-FAGU
310
https://www.youtube.com/watch?v=FifvFov3RsI
311
https://www.youtube.com/watch?v=PZ4-UCH2ED8
312 1 fixeria
313 6 fixeria
h2. References
314 1 fixeria
315 6 fixeria
https://www.youtube.com/watch?v=xFjVcxMpA6c
316
https://events.ccc.de/congress/2012/Fahrplan/attachments/2244_29c3_further_hacks_on_the_calypso_platform
317 1 fixeria
318
319 6 fixeria
h2. Known limitations and issues
320 1 fixeria
321 6 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.
322 1 fixeria
323 6 fixeria
* 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)